3 V5.14 8 Sept 2011 (c) 2000-2011 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.
9 Latest version is available at http://adodb.sourceforge.net
11 Oracle support via ODBC. Requires ODBC. Works on Windows.
13 // security - hide paths
14 if (!defined('ADODB_DIR')) die();
16 if (!defined('_ADODB_ODBC_LAYER')) {
17 include(ADODB_DIR
."/drivers/adodb-odbc.inc.php");
21 class ADODB_odbc_oracle
extends ADODB_odbc
{
22 var $databaseType = 'odbc_oracle';
23 var $replaceQuote = "''"; // string to use to replace quotes
24 var $concat_operator='||';
25 var $fmtDate = "'Y-m-d 00:00:00'";
26 var $fmtTimeStamp = "'Y-m-d h:i:sA'";
27 var $metaTablesSQL = 'select table_name from cat';
28 var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno";
29 var $sysDate = "TRUNC(SYSDATE)";
30 var $sysTimeStamp = 'SYSDATE';
32 //var $_bindInputArray = false;
34 function ADODB_odbc_oracle()
42 $rs = $this->Execute($this->metaTablesSQL
);
43 if ($rs === false) return $false;
44 $arr = $rs->GetArray();
46 for ($i=0; $i < sizeof($arr); $i++
) {
47 $arr2[] = $arr[$i][0];
53 function MetaColumns($table, $normalize=true)
55 global $ADODB_FETCH_MODE;
57 $rs = $this->Execute(sprintf($this->metaColumnsSQL
,strtoupper($table)));
63 while (!$rs->EOF
) { //print_r($rs->fields);
64 $fld = new ADOFieldObject();
65 $fld->name
= $rs->fields
[0];
66 $fld->type
= $rs->fields
[1];
67 $fld->max_length
= $rs->fields
[2];
70 if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM
) $retarr[] = $fld;
71 else $retarr[strtoupper($fld->name
)] = $fld;
79 // returns true or false
80 function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
85 $this->_connectionID
= odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC
);
86 $this->_errorMsg
= $php_errormsg;
88 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
89 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
90 return $this->_connectionID
!= false;
92 // returns true or false
93 function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
97 $this->_connectionID
= odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC
);
98 $this->_errorMsg
= $php_errormsg;
100 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
101 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
102 return $this->_connectionID
!= false;
106 class ADORecordSet_odbc_oracle
extends ADORecordSet_odbc
{
108 var $databaseType = 'odbc_oracle';
110 function ADORecordSet_odbc_oracle($id,$mode=false)
112 return $this->ADORecordSet_odbc($id,$mode);