TYPO3 CMS  TYPO3_7-6
adodb-pdo_oci.inc.php
Go to the documentation of this file.
1 <?php
2 
3 
4 /*
5 @version v5.20.3 01-Jan-2016
6 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
7 @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
8  Released under both BSD license and Lesser GPL library license.
9  Whenever there is any discrepancy between the two licenses,
10  the BSD license will take precedence.
11  Set tabs to 8.
12 
13 */
14 
16 
17  var $concat_operator='||';
18  var $sysDate = "TRUNC(SYSDATE)";
19  var $sysTimeStamp = 'SYSDATE';
20  var $NLS_DATE_FORMAT = 'YYYY-MM-DD'; // To include time, use 'RRRR-MM-DD HH24:MI:SS'
21  var $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)";
22  var $metaTablesSQL = "select table_name,table_type from cat where table_type in ('TABLE','VIEW')";
23  var $metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno";
24 
25  var $_initdate = true;
26  var $_hasdual = true;
27 
28  function _init($parentDriver)
29  {
30  $parentDriver->_bindInputArray = true;
31  $parentDriver->_nestedSQL = true;
32  if ($this->_initdate) {
33  $parentDriver->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'");
34  }
35  }
36 
37  function MetaTables($ttype=false,$showSchema=false,$mask=false)
38  {
39  if ($mask) {
40  $save = $this->metaTablesSQL;
41  $mask = $this->qstr(strtoupper($mask));
42  $this->metaTablesSQL .= " AND table_name like $mask";
43  }
44  $ret = ADOConnection::MetaTables($ttype,$showSchema);
45 
46  if ($mask) {
47  $this->metaTablesSQL = $save;
48  }
49  return $ret;
50  }
51 
52  function MetaColumns($table,$normalize=true)
53  {
54  global $ADODB_FETCH_MODE;
55 
56  $false = false;
57  $save = $ADODB_FETCH_MODE;
58  $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
59  if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
60 
61  $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
62 
63  if (isset($savem)) $this->SetFetchMode($savem);
64  $ADODB_FETCH_MODE = $save;
65  if (!$rs) {
66  return $false;
67  }
68  $retarr = array();
69  while (!$rs->EOF) { //print_r($rs->fields);
70  $fld = new ADOFieldObject();
71  $fld->name = $rs->fields[0];
72  $fld->type = $rs->fields[1];
73  $fld->max_length = $rs->fields[2];
74  $fld->scale = $rs->fields[3];
75  if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) {
76  $fld->type ='INT';
77  $fld->max_length = $rs->fields[4];
78  }
79  $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0);
80  $fld->binary = (strpos($fld->type,'BLOB') !== false);
81  $fld->default_value = $rs->fields[6];
82 
83  if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
84  else $retarr[strtoupper($fld->name)] = $fld;
85  $rs->MoveNext();
86  }
87  $rs->Close();
88  if (empty($retarr))
89  return $false;
90  else
91  return $retarr;
92  }
93 }
_init($parentDriver)
MetaColumns($table, $normalize=true)
if(isset($_REQUEST['nrows'])) else $rs
Definition: server.php:94
MetaTables($ttype=false, $showSchema=false, $mask=false)