TYPO3 CMS  TYPO3_7-6
adodb-db2ora.inc.php
Go to the documentation of this file.
1 <?php
2 /*
3 @version v5.20.3 01-Jan-2016
4 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6  Released under both BSD license and Lesser GPL library license.
7  Whenever there is any discrepancy between the two licenses,
8  the BSD license will take precedence.
9 Set tabs to 4 for best viewing.
10 
11  Latest version is available at http://adodb.sourceforge.net
12 
13  Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows.
14 */
15 
16 // security - hide paths
17 if (!defined('ADODB_DIR')) die();
18 include(ADODB_DIR."/drivers/adodb-db2.inc.php");
19 
20 
21 if (!defined('ADODB_DB2OCI')){
22 define('ADODB_DB2OCI',1);
23 
24 
30 function _colontrack($p)
31 {
32  global $_COLONARR, $_COLONSZ;
33  $v = (integer) substr($p[1], 1);
34  if ($v > $_COLONSZ) return $p[1];
35  $_COLONARR[] = $v;
36  return '?';
37 }
38 
45 function _colonscope($sql,$arr)
46 {
47 global $_COLONARR,$_COLONSZ;
48 
49  $_COLONARR = array();
50  $_COLONSZ = sizeof($arr);
51 
52  $sql2 = preg_replace_callback('/(:[0-9]+)/', '_colontrack', $sql);
53 
54  if (empty($_COLONARR)) return array($sql,$arr);
55 
56  foreach($_COLONARR as $k => $v) {
57  $arr2[] = $arr[$v];
58  }
59 
60  return array($sql2,$arr2);
61 }
62 
63 class ADODB_db2oci extends ADODB_db2 {
64  var $databaseType = "db2oci";
65  var $sysTimeStamp = 'sysdate';
66  var $sysDate = 'trunc(sysdate)';
67 
68  function _Execute($sql, $inputarr = false)
69  {
70  if ($inputarr) list($sql,$inputarr) = _colonscope($sql, $inputarr);
71  return parent::_Execute($sql, $inputarr);
72  }
73 };
74 
75 
76 class ADORecordSet_db2oci extends ADORecordSet_odbc {
77 
78  var $databaseType = "db2oci";
79 
80  function __construct($id,$mode=false)
81  {
82  return parent::__construct($id,$mode);
83  }
84 }
85 
86 } //define
$sql
Definition: server.php:84