fix for escaping in the code search popup
[openemr.git] / library / adodb / drivers / adodb-odbc_oracle.inc.php
bloba00fab219baa1c8500c676d718d91c83546e7ca4
1 <?php
2 /*
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()
36 $this->ADODB_odbc();
39 function MetaTables()
41 $false = false;
42 $rs = $this->Execute($this->metaTablesSQL);
43 if ($rs === false) return $false;
44 $arr = $rs->GetArray();
45 $arr2 = array();
46 for ($i=0; $i < sizeof($arr); $i++) {
47 $arr2[] = $arr[$i][0];
49 $rs->Close();
50 return $arr2;
53 function MetaColumns($table, $normalize=true)
55 global $ADODB_FETCH_MODE;
57 $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
58 if ($rs === false) {
59 $false = false;
60 return $false;
62 $retarr = array();
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;
73 $rs->MoveNext();
75 $rs->Close();
76 return $retarr;
79 // returns true or false
80 function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
82 global $php_errormsg;
84 $php_errormsg = '';
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)
95 global $php_errormsg;
96 $php_errormsg = '';
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);