Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403]
1 <?php 2 /** 3 * Oracle driver via ODBC 4 * 5 * This file is part of ADOdb, a Database Abstraction Layer library for PHP. 6 * 7 * @package ADOdb 8 * @link https://adodb.org Project's web site and documentation 9 * @link https://github.com/ADOdb/ADOdb Source code and issue tracker 10 * 11 * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause 12 * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, 13 * any later version. This means you can use it in proprietary products. 14 * See the LICENSE.md file distributed with this source code for details. 15 * @license BSD-3-Clause 16 * @license LGPL-2.1-or-later 17 * 18 * @copyright 2000-2013 John Lim 19 * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community 20 */ 21 22 // security - hide paths 23 if (!defined('ADODB_DIR')) die(); 24 25 if (!defined('_ADODB_ODBC_LAYER')) { 26 include_once(ADODB_DIR."/drivers/adodb-odbc.inc.php"); 27 } 28 29 30 class ADODB_odbc_oracle extends ADODB_odbc { 31 var $databaseType = 'odbc_oracle'; 32 var $replaceQuote = "''"; // string to use to replace quotes 33 var $concat_operator='||'; 34 var $fmtDate = "'Y-m-d 00:00:00'"; 35 var $fmtTimeStamp = "'Y-m-d h:i:sA'"; 36 var $metaTablesSQL = 'select table_name from cat'; 37 var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"; 38 var $sysDate = "TRUNC(SYSDATE)"; 39 var $sysTimeStamp = 'SYSDATE'; 40 41 //var $_bindInputArray = false; 42 43 function MetaTables($ttype = false, $showSchema = false, $mask = false) 44 { 45 $false = false; 46 $rs = $this->Execute($this->metaTablesSQL); 47 if ($rs === false) return $false; 48 $arr = $rs->GetArray(); 49 $arr2 = array(); 50 for ($i=0; $i < sizeof($arr); $i++) { 51 $arr2[] = $arr[$i][0]; 52 } 53 $rs->Close(); 54 return $arr2; 55 } 56 57 function MetaColumns($table, $normalize=true) 58 { 59 global $ADODB_FETCH_MODE; 60 61 $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table))); 62 if ($rs === false) { 63 $false = false; 64 return $false; 65 } 66 $retarr = array(); 67 while (!$rs->EOF) { //print_r($rs->fields); 68 $fld = new ADOFieldObject(); 69 $fld->name = $rs->fields[0]; 70 $fld->type = $rs->fields[1]; 71 $fld->max_length = $rs->fields[2]; 72 73 74 if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; 75 else $retarr[strtoupper($fld->name)] = $fld; 76 77 $rs->MoveNext(); 78 } 79 $rs->Close(); 80 return $retarr; 81 } 82 83 // returns true or false 84 function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) 85 { 86 $last_php_error = $this->resetLastError(); 87 $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 88 $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); 89 90 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 91 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 92 return $this->_connectionID != false; 93 } 94 // returns true or false 95 function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) 96 { 97 $last_php_error = $this->resetLastError(); 98 $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 99 $this->_errorMsg = $this->getChangedErrorMsg($last_php_error); 100 101 $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 102 //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 103 return $this->_connectionID != false; 104 } 105 } 106 107 class ADORecordSet_odbc_oracle extends ADORecordSet_odbc { 108 109 var $databaseType = 'odbc_oracle'; 110 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body