1 | <?php |
---|
2 | /* |
---|
3 | V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. |
---|
4 | Released under both BSD license and Lesser GPL library license. |
---|
5 | Whenever there is any discrepancy between the two licenses, |
---|
6 | the BSD license will take precedence. |
---|
7 | Set tabs to 4 for best viewing. |
---|
8 | |
---|
9 | Latest version is available at http://adodb.sourceforge.net |
---|
10 | |
---|
11 | Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. |
---|
12 | */ |
---|
13 | |
---|
14 | // security - hide paths |
---|
15 | if (!defined('ADODB_DIR')) die(); |
---|
16 | include(ADODB_DIR."/drivers/adodb-db2.inc.php"); |
---|
17 | |
---|
18 | |
---|
19 | if (!defined('ADODB_DB2OCI')){ |
---|
20 | define('ADODB_DB2OCI',1); |
---|
21 | |
---|
22 | |
---|
23 | function _colontrack($p) |
---|
24 | { |
---|
25 | global $_COLONARR,$_COLONSZ; |
---|
26 | $v = (integer) substr($p,1); |
---|
27 | if ($v > $_COLONSZ) return $p; |
---|
28 | $_COLONARR[] = $v; |
---|
29 | return '?'; |
---|
30 | } |
---|
31 | |
---|
32 | function _colonscope($sql,$arr) |
---|
33 | { |
---|
34 | global $_COLONARR,$_COLONSZ; |
---|
35 | |
---|
36 | $_COLONARR = array(); |
---|
37 | $_COLONSZ = sizeof($arr); |
---|
38 | |
---|
39 | $sql2 = preg_replace("/(:[0-9]+)/e","_colontrack('\\1')",$sql); |
---|
40 | |
---|
41 | if (empty($_COLONARR)) return array($sql,$arr); |
---|
42 | |
---|
43 | foreach($_COLONARR as $k => $v) { |
---|
44 | $arr2[] = $arr[$v]; |
---|
45 | } |
---|
46 | |
---|
47 | return array($sql2,$arr2); |
---|
48 | } |
---|
49 | |
---|
50 | class ADODB_db2oci extends ADODB_db2 { |
---|
51 | var $databaseType = "db2oci"; |
---|
52 | var $sysTimeStamp = 'sysdate'; |
---|
53 | var $sysDate = 'trunc(sysdate)'; |
---|
54 | |
---|
55 | function ADODB_db2oci() |
---|
56 | { |
---|
57 | $this->ADODB_db2(); |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | function _Execute($sql, $inputarr) |
---|
62 | { |
---|
63 | if ($inputarr) list($sql,$inputarr) = _colonscope($sql, $inputarr); |
---|
64 | return parent::_Execute($sql, $inputarr); |
---|
65 | } |
---|
66 | }; |
---|
67 | |
---|
68 | |
---|
69 | class ADORecordSet_db2oci extends ADORecordSet_odbc { |
---|
70 | |
---|
71 | var $databaseType = "db2oci"; |
---|
72 | |
---|
73 | function ADORecordSet_db2oci($id,$mode=false) |
---|
74 | { |
---|
75 | return $this->ADORecordSet_db2($id,$mode); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | } //define |
---|
80 | ?> |
---|