[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/adodb/drivers/ -> adodb-odbc_oracle.inc.php (source)

   1  <?php
   2  /*
   3  V5.19  23-Apr-2014  (c) 2000-2014 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.
   8  
   9    Latest version is available at http://adodb.sourceforge.net
  10  
  11    Oracle support via ODBC. Requires ODBC. Works on Windows.
  12  */
  13  // security - hide paths
  14  if (!defined('ADODB_DIR')) die();
  15  
  16  if (!defined('_ADODB_ODBC_LAYER')) {
  17      include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
  18  }
  19  
  20  
  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';
  31  
  32      //var $_bindInputArray = false;
  33  
  34  	function ADODB_odbc_oracle()
  35      {
  36          $this->ADODB_odbc();
  37      }
  38  
  39  	function MetaTables()
  40      {
  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];
  48          }
  49          $rs->Close();
  50          return $arr2;
  51      }
  52  
  53  	function MetaColumns($table, $normalize=true)
  54      {
  55      global $ADODB_FETCH_MODE;
  56  
  57          $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
  58          if ($rs === false) {
  59              $false = false;
  60              return $false;
  61          }
  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];
  68  
  69  
  70              if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
  71              else $retarr[strtoupper($fld->name)] = $fld;
  72  
  73              $rs->MoveNext();
  74          }
  75          $rs->Close();
  76          return $retarr;
  77      }
  78  
  79      // returns true or false
  80  	function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
  81      {
  82      global $php_errormsg;
  83  
  84          $php_errormsg = '';
  85          $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
  86          $this->_errorMsg = $php_errormsg;
  87  
  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;
  91      }
  92      // returns true or false
  93  	function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
  94      {
  95      global $php_errormsg;
  96          $php_errormsg = '';
  97          $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
  98          $this->_errorMsg = $php_errormsg;
  99  
 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;
 103      }
 104  }
 105  
 106  class  ADORecordSet_odbc_oracle extends ADORecordSet_odbc {
 107  
 108      var $databaseType = 'odbc_oracle';
 109  
 110  	function ADORecordSet_odbc_oracle($id,$mode=false)
 111      {
 112          return $this->ADORecordSet_odbc($id,$mode);
 113      }
 114  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1