Documentation TYPO3 par Ameos |
00001 <?php 00002 /* 00003 V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. 00004 Released under both BSD license and Lesser GPL library license. 00005 Whenever there is any discrepancy between the two licenses, 00006 the BSD license will take precedence. 00007 Set tabs to 4 for best viewing. 00008 00009 Latest version is available at http://adodb.sourceforge.net 00010 00011 Oracle support via ODBC. Requires ODBC. Works on Windows. 00012 */ 00013 // security - hide paths 00014 if (!defined('ADODB_DIR')) die(); 00015 00016 if (!defined('_ADODB_ODBC_LAYER')) { 00017 include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); 00018 } 00019 00020 00021 class ADODB_odbc_oracle extends ADODB_odbc { 00022 var $databaseType = 'odbc_oracle'; 00023 var $replaceQuote = "''"; // string to use to replace quotes 00024 var $concat_operator='||'; 00025 var $fmtDate = "'Y-m-d 00:00:00'"; 00026 var $fmtTimeStamp = "'Y-m-d h:i:sA'"; 00027 var $metaTablesSQL = 'select table_name from cat'; 00028 var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"; 00029 var $sysDate = "TRUNC(SYSDATE)"; 00030 var $sysTimeStamp = 'SYSDATE'; 00031 00032 //var $_bindInputArray = false; 00033 00034 function ADODB_odbc_oracle() 00035 { 00036 $this->ADODB_odbc(); 00037 } 00038 00039 function &MetaTables() 00040 { 00041 $false = false; 00042 $rs = $this->Execute($this->metaTablesSQL); 00043 if ($rs === false) return $false; 00044 $arr = $rs->GetArray(); 00045 $arr2 = array(); 00046 for ($i=0; $i < sizeof($arr); $i++) { 00047 $arr2[] = $arr[$i][0]; 00048 } 00049 $rs->Close(); 00050 return $arr2; 00051 } 00052 00053 function &MetaColumns($table) 00054 { 00055 global $ADODB_FETCH_MODE; 00056 00057 $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table))); 00058 if ($rs === false) { 00059 $false = false; 00060 return $false; 00061 } 00062 $retarr = array(); 00063 while (!$rs->EOF) { //print_r($rs->fields); 00064 $fld = new ADOFieldObject(); 00065 $fld->name = $rs->fields[0]; 00066 $fld->type = $rs->fields[1]; 00067 $fld->max_length = $rs->fields[2]; 00068 00069 00070 if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; 00071 else $retarr[strtoupper($fld->name)] = $fld; 00072 00073 $rs->MoveNext(); 00074 } 00075 $rs->Close(); 00076 return $retarr; 00077 } 00078 00079 // returns true or false 00080 function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) 00081 { 00082 global $php_errormsg; 00083 00084 $php_errormsg = ''; 00085 $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 00086 $this->_errorMsg = $php_errormsg; 00087 00088 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 00089 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 00090 return $this->_connectionID != false; 00091 } 00092 // returns true or false 00093 function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) 00094 { 00095 global $php_errormsg; 00096 $php_errormsg = ''; 00097 $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 00098 $this->_errorMsg = $php_errormsg; 00099 00100 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 00101 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 00102 return $this->_connectionID != false; 00103 } 00104 } 00105 00106 class ADORecordSet_odbc_oracle extends ADORecordSet_odbc { 00107 00108 var $databaseType = 'odbc_oracle'; 00109 00110 function ADORecordSet_odbc_oracle($id,$mode=false) 00111 { 00112 return $this->ADORecordSet_odbc($id,$mode); 00113 } 00114 } 00115 ?>