TYPO3 CMS  TYPO3_7-6
adodb-odbc_oracle.inc.php
Go to the documentation of this file.
1 <?php
2 /*
3 @version v5.20.3 01-Jan-2016
4 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
5 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
6  Released under both BSD license and Lesser GPL library license.
7  Whenever there is any discrepancy between the two licenses,
8  the BSD license will take precedence.
9 Set tabs to 4 for best viewing.
10 
11  Latest version is available at http://adodb.sourceforge.net
12 
13  Oracle support via ODBC. Requires ODBC. Works on Windows.
14 */
15 // security - hide paths
16 if (!defined('ADODB_DIR')) die();
17 
18 if (!defined('_ADODB_ODBC_LAYER')) {
19  include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
20 }
21 
22 
24  var $databaseType = 'odbc_oracle';
25  var $replaceQuote = "''"; // string to use to replace quotes
26  var $concat_operator='||';
27  var $fmtDate = "'Y-m-d 00:00:00'";
28  var $fmtTimeStamp = "'Y-m-d h:i:sA'";
29  var $metaTablesSQL = 'select table_name from cat';
30  var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno";
31  var $sysDate = "TRUNC(SYSDATE)";
32  var $sysTimeStamp = 'SYSDATE';
33 
34  //var $_bindInputArray = false;
35 
36  function MetaTables($ttype = false, $showSchema = false, $mask = false)
37  {
38  $false = false;
39  $rs = $this->Execute($this->metaTablesSQL);
40  if ($rs === false) return $false;
41  $arr = $rs->GetArray();
42  $arr2 = array();
43  for ($i=0; $i < sizeof($arr); $i++) {
44  $arr2[] = $arr[$i][0];
45  }
46  $rs->Close();
47  return $arr2;
48  }
49 
50  function MetaColumns($table, $normalize=true)
51  {
52  global $ADODB_FETCH_MODE;
53 
54  $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
55  if ($rs === false) {
56  $false = false;
57  return $false;
58  }
59  $retarr = array();
60  while (!$rs->EOF) { //print_r($rs->fields);
61  $fld = new ADOFieldObject();
62  $fld->name = $rs->fields[0];
63  $fld->type = $rs->fields[1];
64  $fld->max_length = $rs->fields[2];
65 
66 
67  if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
68  else $retarr[strtoupper($fld->name)] = $fld;
69 
70  $rs->MoveNext();
71  }
72  $rs->Close();
73  return $retarr;
74  }
75 
76  // returns true or false
77  function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
78  {
79  global $php_errormsg;
80 
81  $php_errormsg = '';
82  $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
83  $this->_errorMsg = $php_errormsg;
84 
85  $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
86  //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
87  return $this->_connectionID != false;
88  }
89  // returns true or false
90  function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
91  {
92  global $php_errormsg;
93  $php_errormsg = '';
94  $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
95  $this->_errorMsg = $php_errormsg;
96 
97  $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
98  //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
99  return $this->_connectionID != false;
100  }
101 }
102 
104 
105  var $databaseType = 'odbc_oracle';
106 
107  function __construct($id,$mode=false)
108  {
109  return parent::__construct($id,$mode);
110  }
111 }
if(isset($_REQUEST['nrows'])) else $rs
Definition: server.php:94
_connect($argDSN, $argUsername, $argPassword, $argDatabasename)
MetaTables($ttype=false, $showSchema=false, $mask=false)
_pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
MetaColumns($table, $normalize=true)