Documentation TYPO3 par Ameos

adodb-pdo_oci.inc.php

00001 <?php
00002 
00003 
00004 /*
00005 V4.80 8 Mar 2006  (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
00006   Released under both BSD license and Lesser GPL library license. 
00007   Whenever there is any discrepancy between the two licenses, 
00008   the BSD license will take precedence.
00009   Set tabs to 8.
00010  
00011 */ 
00012 
00013 class ADODB_pdo_oci extends ADODB_pdo_base {
00014 
00015         var $concat_operator='||';
00016         var $sysDate = "TRUNC(SYSDATE)";
00017         var $sysTimeStamp = 'SYSDATE';
00018         var $NLS_DATE_FORMAT = 'YYYY-MM-DD';  // To include time, use 'RRRR-MM-DD HH24:MI:SS'
00019         var $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)";
00020         var $metaTablesSQL = "select table_name,table_type from cat where table_type in ('TABLE','VIEW')";
00021         var $metaColumnsSQL = "select cname,coltype,width, SCALE, PRECISION, NULLS, DEFAULTVAL from col where tname='%s' order by colno"; 
00022                 
00023         var $_initdate = true;
00024         var $_hasdual = true;
00025         
00026         function _init($parentDriver)
00027         {
00028                 $parentDriver->_bindInputArray = true;
00029                 
00030                 if ($this->_initdate) {
00031                         $parentDriver->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'");
00032                 }
00033         }
00034         
00035         function &MetaTables($ttype=false,$showSchema=false,$mask=false) 
00036         {
00037                 if ($mask) {
00038                         $save = $this->metaTablesSQL;
00039                         $mask = $this->qstr(strtoupper($mask));
00040                         $this->metaTablesSQL .= " AND table_name like $mask";
00041                 }
00042                 $ret =& ADOConnection::MetaTables($ttype,$showSchema);
00043                 
00044                 if ($mask) {
00045                         $this->metaTablesSQL = $save;
00046                 }
00047                 return $ret;
00048         }
00049         
00050         function &MetaColumns($table) 
00051         {
00052         global $ADODB_FETCH_MODE;
00053         
00054                 $false = false;
00055                 $save = $ADODB_FETCH_MODE;
00056                 $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
00057                 if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
00058                 
00059                 $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
00060                 
00061                 if (isset($savem)) $this->SetFetchMode($savem);
00062                 $ADODB_FETCH_MODE = $save;
00063                 if (!$rs) {
00064                         return $false;
00065                 }
00066                 $retarr = array();
00067                 while (!$rs->EOF) { //print_r($rs->fields);
00068                         $fld = new ADOFieldObject();
00069                         $fld->name = $rs->fields[0];
00070                         $fld->type = $rs->fields[1];
00071                         $fld->max_length = $rs->fields[2];
00072                         $fld->scale = $rs->fields[3];
00073                         if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) {
00074                                 $fld->type ='INT';
00075                         $fld->max_length = $rs->fields[4];
00076                 }       
00077                         $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0);
00078                         $fld->binary = (strpos($fld->type,'BLOB') !== false);
00079                         $fld->default_value = $rs->fields[6];
00080                         
00081                         if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;     
00082                         else $retarr[strtoupper($fld->name)] = $fld;
00083                         $rs->MoveNext();
00084                 }
00085                 $rs->Close();
00086                 if (empty($retarr))
00087                         return  $false;
00088                 else 
00089                         return $retarr;
00090         }
00091 }
00092 
00093 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6