mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Upgraded to ADOdb 4.5.1. Contains a lot of small fixes and speed-ups.
This commit is contained in:
parent
f5f346a594
commit
fab7e07e19
90 changed files with 1555 additions and 832 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -550,11 +550,15 @@ class ADORecordSet_ado extends ADORecordSet {
|
|||
|
||||
if ($this->hideErrors) $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null
|
||||
for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) {
|
||||
|
||||
//echo "<p>",$t,' ';var_dump($f->value); echo '</p>';
|
||||
switch($t) {
|
||||
case 135: // timestamp
|
||||
if (!strlen((string)$f->value)) $this->fields[] = false;
|
||||
else $this->fields[] = adodb_date('Y-m-d H:i:s',(float)$f->value);
|
||||
else {
|
||||
if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
|
||||
else $val = $f->value;
|
||||
$this->fields[] = adodb_date('Y-m-d H:i:s',$val);
|
||||
}
|
||||
break;
|
||||
case 133:// A date value (yyyymmdd)
|
||||
if ($val = $f->value) {
|
||||
|
@ -564,7 +568,13 @@ class ADORecordSet_ado extends ADORecordSet {
|
|||
break;
|
||||
case 7: // adDate
|
||||
if (!strlen((string)$f->value)) $this->fields[] = false;
|
||||
else $this->fields[] = adodb_date('Y-m-d',(float)$f->value);
|
||||
else {
|
||||
if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value);
|
||||
else $val = $f->value;
|
||||
|
||||
if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val);
|
||||
else $this->fields[] = adodb_date('Y-m-d H:i:s',$val);
|
||||
}
|
||||
break;
|
||||
case 1: // null
|
||||
$this->fields[] = false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -34,7 +34,6 @@ class ADODB_ado_mssql extends ADODB_ado {
|
|||
var $ansiOuter = true; // for mssql7 or later
|
||||
var $substr = "substring";
|
||||
var $length = 'len';
|
||||
var $upperCase = 'upper';
|
||||
|
||||
//var $_inTransaction = 1; // always open recordsets, so no transaction problems.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -101,9 +101,8 @@ class ADODB_DB2 extends ADODB_odbc {
|
|||
var $fmtTimeStamp = "'Y-m-d-H.i.s'";
|
||||
var $ansiOuter = true;
|
||||
var $identitySQL = 'values IDENTITY_VAL_LOCAL()';
|
||||
var $_bindInputArray = false;
|
||||
var $upperCase = 'upper';
|
||||
|
||||
var $_bindInputArray = true;
|
||||
var $hasInsertID = true;
|
||||
|
||||
function ADODB_DB2()
|
||||
{
|
||||
|
@ -135,13 +134,13 @@ class ADODB_DB2 extends ADODB_odbc {
|
|||
return $this->GetOne("select 1 as ignore from $tables where $where for update");
|
||||
}
|
||||
|
||||
function &MetaTables($ttype=false,$showSchema=false)
|
||||
function &MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%")
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$savem = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
$qid = odbc_tables($this->_connectionID);
|
||||
$qid = odbc_tables($this->_connectionID, "", $qschema, $qtable, "");
|
||||
|
||||
$rs = new ADORecordSet_odbc($qid);
|
||||
|
||||
|
@ -177,6 +176,7 @@ class ADODB_DB2 extends ADODB_odbc {
|
|||
return $arr2;
|
||||
}
|
||||
|
||||
|
||||
// Format date column in sql string given an input format that understands Y M D
|
||||
function SQLDate($fmt, $col=false)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -58,6 +58,45 @@ class ADODB_ibase extends ADOConnection {
|
|||
if (defined('IBASE_DEFAULT')) $this->ibasetrans = IBASE_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
// returns true or false
|
||||
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false)
|
||||
{
|
||||
if (!function_exists('ibase_pconnect')) return null;
|
||||
if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
|
||||
$fn = ($persist) ? 'ibase_pconnect':'ibase_connect';
|
||||
$this->_connectionID = $fn($argHostname,$argUsername,$argPassword,
|
||||
$this->charSet,$this->buffers,$this->dialect);
|
||||
|
||||
if ($this->dialect != 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
|
||||
$this->replaceQuote = "''";
|
||||
}
|
||||
if ($this->_connectionID === false) {
|
||||
$this->_handleerror();
|
||||
return false;
|
||||
}
|
||||
|
||||
// PHP5 change.
|
||||
if (function_exists('ibase_timefmt')) {
|
||||
ibase_timefmt($this->ibase_datefmt,IBASE_DATE );
|
||||
if ($this->dialect == 1) ibase_timefmt($this->ibase_datefmt,IBASE_TIMESTAMP );
|
||||
else ibase_timefmt($this->ibase_timestampfmt,IBASE_TIMESTAMP );
|
||||
ibase_timefmt($this->ibase_timefmt,IBASE_TIME );
|
||||
|
||||
} else {
|
||||
ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
|
||||
ini_set("ibase.dateformat", $this->ibase_datefmt);
|
||||
ini_set("ibase.timeformat", $this->ibase_timefmt);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// returns true or false
|
||||
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true);
|
||||
}
|
||||
|
||||
|
||||
function MetaPrimaryKeys($table,$owner_notused=false,$internalKey=false)
|
||||
{
|
||||
if ($internalKey) return array('RDB$DB_KEY');
|
||||
|
@ -257,48 +296,6 @@ class ADODB_ibase extends ADOConnection {
|
|||
return $this->_errorMsg;
|
||||
}
|
||||
|
||||
// returns true or false
|
||||
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false)
|
||||
{
|
||||
if (!function_exists('ibase_pconnect')) return null;
|
||||
if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
|
||||
$fn = ($persist) ? 'ibase_pconnect':'ibase_connect';
|
||||
$this->_connectionID = $fn($argHostname,$argUsername,$argPassword,
|
||||
$this->charSet,$this->buffers,$this->dialect);
|
||||
|
||||
if ($this->dialect != 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
|
||||
$this->replaceQuote = "''";
|
||||
}
|
||||
if ($this->_connectionID === false) {
|
||||
$this->_handleerror();
|
||||
return false;
|
||||
}
|
||||
|
||||
// PHP5 change.
|
||||
if (function_exists('ibase_timefmt')) {
|
||||
ibase_timefmt($this->ibase_datefmt,IBASE_DATE );
|
||||
if ($this->dialect == 1) ibase_timefmt($this->ibase_datefmt,IBASE_TIMESTAMP );
|
||||
else ibase_timefmt($this->ibase_timestampfmt,IBASE_TIMESTAMP );
|
||||
ibase_timefmt($this->ibase_timefmt,IBASE_TIME );
|
||||
} else {
|
||||
ini_set("ibase.timestampformat", $this->base_timestampfmt);
|
||||
ini_set("ibase.dateformat", $this->ibase_datefmt);
|
||||
ini_set("ibase.timeformat", $this->ibase_timefmt);
|
||||
}
|
||||
//you can use
|
||||
/*
|
||||
ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
|
||||
ini_set("ibase.dateformat", $this->ibase_datefmt);
|
||||
ini_set("ibase.timeformat", $this->ibase_timefmt);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
// returns true or false
|
||||
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true);
|
||||
}
|
||||
|
||||
function Prepare($sql)
|
||||
{
|
||||
$stmt = ibase_prepare($this->_connectionID,$sql);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -27,7 +27,6 @@ class ADODB_informix72 extends ADOConnection {
|
|||
var $fmtTimeStamp = "'Y-m-d H:i:s'";
|
||||
var $hasInsertID = true;
|
||||
var $hasAffectedRows = true;
|
||||
var $upperCase = 'upper';
|
||||
var $substr = 'substr';
|
||||
var $metaTablesSQL="select tabname from systables where tabtype!=' ' and owner!='informix'"; //Don't get informix tables and pseudo-tables
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -79,7 +79,6 @@ class ADODB_mssql extends ADOConnection {
|
|||
var $hasInsertID = true;
|
||||
var $substr = "substring";
|
||||
var $length = 'len';
|
||||
var $upperCase = 'upper';
|
||||
var $hasAffectedRows = true;
|
||||
var $metaDatabasesSQL = "select name from sysdatabases where name <> 'master'";
|
||||
var $metaTablesSQL="select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE','dtproperties'))";
|
||||
|
@ -376,14 +375,25 @@ order by constraint_name, referenced_table_name, keyno";
|
|||
|
||||
// "Stein-Aksel Basma" <basma@accelero.no>
|
||||
// tested with MSSQL 2000
|
||||
function MetaPrimaryKeys($table)
|
||||
function &MetaPrimaryKeys($table)
|
||||
{
|
||||
$sql = "select k.column_name from information_schema.key_column_usage k,
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$schema = '';
|
||||
$this->_findschema($table,$schema);
|
||||
if (!$schema) $schema = $this->database;
|
||||
if ($schema) $schema = "and k.table_catalog like '$schema%'";
|
||||
|
||||
$sql = "select distinct k.column_name,ordinal_position from information_schema.key_column_usage k,
|
||||
information_schema.table_constraints tc
|
||||
where tc.constraint_name = k.constraint_name and tc.constraint_type =
|
||||
'PRIMARY KEY' and k.table_name = '$table'";
|
||||
'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position ";
|
||||
|
||||
$savem = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
$a = $this->GetCol($sql);
|
||||
$ADODB_FETCH_MODE = $savem;
|
||||
|
||||
if ($a && sizeof($a)>0) return $a;
|
||||
return false;
|
||||
}
|
||||
|
@ -552,6 +562,11 @@ order by constraint_name, referenced_table_name, keyno";
|
|||
*/
|
||||
function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
|
||||
{
|
||||
|
||||
if (strtoupper($blobtype) == 'CLOB') {
|
||||
$sql = "UPDATE $table SET $column='" . $val . "' WHERE $where";
|
||||
return $this->Execute($sql) != false;
|
||||
}
|
||||
$sql = "UPDATE $table SET $column=0x".bin2hex($val)." WHERE $where";
|
||||
return $this->Execute($sql) != false;
|
||||
}
|
||||
|
@ -589,10 +604,16 @@ order by constraint_name, referenced_table_name, keyno";
|
|||
} else if (is_integer($v)) {
|
||||
$decl .= "@P$i INT";
|
||||
$params .= "@P$i=".$v;
|
||||
} else {
|
||||
} else if (is_float($v)) {
|
||||
$decl .= "@P$i FLOAT";
|
||||
$params .= "@P$i=".$v;
|
||||
}
|
||||
} else if (is_bool($v)) {
|
||||
$decl .= "@P$i INT"; # Used INT just in case BIT in not supported on the user's MSSQL version. It will cast appropriately.
|
||||
$params .= "@P$i=".(($v)?'1':'0'); # True == 1 in MSSQL BIT fields and acceptable for storing logical true in an int field
|
||||
} else {
|
||||
$decl .= "@P$i CHAR"; # Used char because a type is required even when the value is to be NULL.
|
||||
$params .= "@P$i=NULL";
|
||||
}
|
||||
$i += 1;
|
||||
}
|
||||
$decl = $this->qstr($decl);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -29,7 +29,6 @@ class ADODB_mysql extends ADOConnection {
|
|||
var $hasLimit = true;
|
||||
var $hasMoveFirst = true;
|
||||
var $hasGenID = true;
|
||||
var $upperCase = 'upper';
|
||||
var $isoDates = true; // accepts dates in ISO format
|
||||
var $sysDate = 'CURDATE()';
|
||||
var $sysTimeStamp = 'NOW()';
|
||||
|
@ -42,6 +41,7 @@ class ADODB_mysql extends ADOConnection {
|
|||
|
||||
function ADODB_mysql()
|
||||
{
|
||||
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
|
||||
}
|
||||
|
||||
function ServerInfo()
|
||||
|
@ -166,6 +166,11 @@ class ADODB_mysql extends ADOConnection {
|
|||
return false;
|
||||
}
|
||||
|
||||
function BeginTrans()
|
||||
{
|
||||
if ($this->debug) ADOConnection::outp("Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver");
|
||||
}
|
||||
|
||||
function _affectedrows()
|
||||
{
|
||||
return mysql_affected_rows($this->_connectionID);
|
||||
|
@ -239,18 +244,22 @@ class ADODB_mysql extends ADOConnection {
|
|||
for ($i=0; $i < $len; $i++) {
|
||||
$ch = $fmt[$i];
|
||||
switch($ch) {
|
||||
|
||||
default:
|
||||
if ($ch == '\\') {
|
||||
$i++;
|
||||
$ch = substr($fmt,$i,1);
|
||||
}
|
||||
/** FALL THROUGH */
|
||||
case '-':
|
||||
case '/':
|
||||
$s .= $ch;
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
case 'y':
|
||||
$s .= '%Y';
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
$s .= "'),Quarter($col)";
|
||||
|
||||
if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
|
||||
else $s .= ",('";
|
||||
$concat = true;
|
||||
break;
|
||||
case 'M':
|
||||
$s .= '%b';
|
||||
break;
|
||||
|
@ -263,6 +272,15 @@ class ADODB_mysql extends ADOConnection {
|
|||
$s .= '%d';
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
case 'q':
|
||||
$s .= "'),Quarter($col)";
|
||||
|
||||
if ($len > $i+1) $s .= ",DATE_FORMAT($col,'";
|
||||
else $s .= ",('";
|
||||
$concat = true;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
$s .= '%H';
|
||||
break;
|
||||
|
@ -284,14 +302,7 @@ class ADODB_mysql extends ADOConnection {
|
|||
$s .= '%p';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if ($ch == '\\') {
|
||||
$i++;
|
||||
$ch = substr($fmt,$i,1);
|
||||
}
|
||||
$s .= $ch;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
$s.="')";
|
||||
|
@ -449,7 +460,6 @@ class ADODB_mysql extends ADOConnection {
|
|||
return $rs;
|
||||
}
|
||||
|
||||
|
||||
// returns queryID or false
|
||||
function _query($sql,$inputarr)
|
||||
{
|
||||
|
@ -477,8 +487,6 @@ class ADODB_mysql extends ADOConnection {
|
|||
else return @mysql_errno($this->_connectionID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returns true or false
|
||||
function _close()
|
||||
{
|
||||
|
@ -509,6 +517,7 @@ class ADODB_mysql extends ADOConnection {
|
|||
Class Name: Recordset
|
||||
--------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
class ADORecordSet_mysql extends ADORecordSet{
|
||||
|
||||
var $databaseType = "mysql";
|
||||
|
@ -587,29 +596,20 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||
return @mysql_data_seek($this->_queryID,$row);
|
||||
}
|
||||
|
||||
|
||||
// 10% speedup to move MoveNext to child class
|
||||
function MoveNext()
|
||||
function MoveNext()
|
||||
{
|
||||
//global $ADODB_EXTENSION;if ($ADODB_EXTENSION) return adodb_movenext($this);
|
||||
|
||||
if ($this->EOF) return false;
|
||||
|
||||
$this->_currentRow++;
|
||||
$this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
|
||||
if (is_array($this->fields)) return true;
|
||||
|
||||
$this->EOF = true;
|
||||
|
||||
/* -- tested raising an error -- appears pointless
|
||||
$conn = $this->connection;
|
||||
if ($conn && $conn->raiseErrorFn && ($errno = $conn->ErrorNo())) {
|
||||
$fn = $conn->raiseErrorFn;
|
||||
$fn($conn->databaseType,'MOVENEXT',$errno,$conn->ErrorMsg().' ('.$this->sql.')',$conn->host,$conn->database);
|
||||
//return adodb_movenext($this);
|
||||
//if (defined('ADODB_EXTENSION')) return adodb_movenext($this);
|
||||
if (@$this->fields =& mysql_fetch_array($this->_queryID,$this->fetchMode)) {
|
||||
$this->_currentRow += 1;
|
||||
return true;
|
||||
}
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow += 1;
|
||||
$this->EOF = true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _fetch()
|
||||
{
|
||||
|
@ -676,5 +676,32 @@ class ADORecordSet_mysql extends ADORecordSet{
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class ADORecordSet_ext_mysql extends ADORecordSet_mysql {
|
||||
function ADORecordSet_ext_mysql($queryID,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
switch ($mode)
|
||||
{
|
||||
case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
|
||||
case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
|
||||
default:
|
||||
case ADODB_FETCH_DEFAULT:
|
||||
case ADODB_FETCH_BOTH:$this->fetchMode = MYSQL_BOTH; break;
|
||||
}
|
||||
|
||||
$this->ADORecordSet($queryID);
|
||||
}
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
return adodb_movenext($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -30,7 +30,6 @@ class ADODB_mysqli extends ADOConnection {
|
|||
var $hasLimit = true;
|
||||
var $hasMoveFirst = true;
|
||||
var $hasGenID = true;
|
||||
var $upperCase = 'upper';
|
||||
var $isoDates = true; // accepts dates in ISO format
|
||||
var $sysDate = 'CURDATE()';
|
||||
var $sysTimeStamp = 'NOW()';
|
||||
|
@ -39,18 +38,75 @@ class ADODB_mysqli extends ADOConnection {
|
|||
var $poorAffectedRows = true;
|
||||
var $clientFlags = 0;
|
||||
var $substr = "substring";
|
||||
//var $poorAffectedRows = true;
|
||||
var $port = false;
|
||||
var $socket = false;
|
||||
var $_bindInputArray = false;
|
||||
var $nameQuote = '`'; /// string to use to quote identifiers and names
|
||||
//var $_bindInputArray = true;
|
||||
|
||||
function ADODB_mysqli()
|
||||
{
|
||||
if(!extension_loaded("mysqli"))
|
||||
{
|
||||
trigger_error("You must have the MySQLi extension.", E_USER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// returns true or false
|
||||
// To add: parameter int $port,
|
||||
// parameter string $socket
|
||||
function _connect($argHostname = NULL,
|
||||
$argUsername = NULL,
|
||||
$argPassword = NULL,
|
||||
$argDatabasename = NULL, $persist=false)
|
||||
{
|
||||
$this->_connectionID = @mysqli_init();
|
||||
|
||||
if (is_null($this->_connectionID)) {
|
||||
// mysqli_init only fails if insufficient memory
|
||||
if ($this->debug)
|
||||
ADOConnection::outp("mysqli_init() failed : " . $this->ErrorMsg());
|
||||
return false;
|
||||
}
|
||||
// Set connection options
|
||||
// Not implemented now
|
||||
// mysqli_options($this->_connection,,);
|
||||
if (mysqli_real_connect($this->_connectionID,
|
||||
$argHostname,
|
||||
$argUsername,
|
||||
$argPassword,
|
||||
$argDatabasename,
|
||||
$this->port,
|
||||
$this->socket,
|
||||
$this->clientFlags))
|
||||
{
|
||||
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if ($this->debug)
|
||||
ADOConnection::outp("Could't connect : " . $this->ErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true or false
|
||||
// How to force a persistent connection
|
||||
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename, true);
|
||||
|
||||
}
|
||||
|
||||
// When is this used? Close old connection first?
|
||||
// In _connect(), check $this->forceNewConnect?
|
||||
function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
$this->forceNewConnect = true;
|
||||
$this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
|
||||
}
|
||||
|
||||
function IfNull( $field, $ifNull )
|
||||
{
|
||||
return " IFNULL($field, $ifNull) "; // if MySQL
|
||||
|
@ -329,70 +385,6 @@ class ADODB_mysqli extends ADOConnection {
|
|||
return "from_unixtime(unix_timestamp($date)+($dayFraction)*24*3600)";
|
||||
}
|
||||
|
||||
// returns true or false
|
||||
// To add: parameter int $port,
|
||||
// parameter string $socket
|
||||
function _connect($argHostname = NULL,
|
||||
$argUsername = NULL,
|
||||
$argPassword = NULL,
|
||||
$argDatabasename = NULL)
|
||||
{
|
||||
// @ means: error surpression on
|
||||
$this->_connectionID = @mysqli_init();
|
||||
|
||||
if (is_null($this->_connectionID))
|
||||
{
|
||||
// mysqli_init only fails if insufficient memory
|
||||
if ($this->debug)
|
||||
ADOConnection::outp("mysqli_init() failed : " . $this->ErrorMsg());
|
||||
return false;
|
||||
}
|
||||
// Set connection options
|
||||
// Not implemented now
|
||||
// mysqli_options($this->_connection,,);
|
||||
if (mysqli_real_connect($this->_connectionID,
|
||||
$argHostname,
|
||||
$argUsername,
|
||||
$argPassword,
|
||||
$argDatabasename))
|
||||
{
|
||||
if ($argDatabasename)
|
||||
{
|
||||
return $this->SelectDB($argDatabasename);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->debug)
|
||||
ADOConnection::outp("Could't connect : " . $this->ErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// returns true or false
|
||||
// How to force a persistent connection
|
||||
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
// not implemented in mysqli (yet)?
|
||||
$this->_connectionID = mysqli_connect($argHostname,
|
||||
$argUsername,
|
||||
$argPassword,
|
||||
$argDatabasename);
|
||||
if ($this->_connectionID === false) return false;
|
||||
// if ($this->autoRollback) $this->RollbackTrans();
|
||||
if ($argDatabasename) return $this->SelectDB($argDatabasename);
|
||||
return true;
|
||||
}
|
||||
|
||||
// When is this used? Close old connection first?
|
||||
// In _connect(), check $this->forceNewConnect?
|
||||
function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
$this->forceNewConnect = true;
|
||||
$this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
|
||||
}
|
||||
|
||||
function &MetaColumns($table)
|
||||
{
|
||||
|
@ -539,8 +531,11 @@ class ADODB_mysqli extends ADOConnection {
|
|||
{
|
||||
return $sql;
|
||||
|
||||
$stmt = mysqli_prepare($this->_connectionID,$sql);
|
||||
if (!$stmt) return false;
|
||||
$stmt = $this->_connectionID->prepare($sql);
|
||||
if (!$stmt) {
|
||||
echo $this->ErrorMsg();
|
||||
return $sql;
|
||||
}
|
||||
return array($sql,$stmt);
|
||||
}
|
||||
|
||||
|
@ -549,18 +544,20 @@ class ADODB_mysqli extends ADOConnection {
|
|||
function _query($sql, $inputarr)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
|
||||
|
||||
if (is_array($sql)) {
|
||||
$stmt = $sql[1];
|
||||
$a = '';
|
||||
foreach($inputarr as $k => $v) {
|
||||
if (is_string($v)) $a[] = MYSQLI_BIND_STRING;
|
||||
else if (is_integer($v)) $a[] = MYSQLI_BIND_INT;
|
||||
else $a[] = MYSQLI_BIND_DOUBLE;
|
||||
|
||||
$fnarr =& array_merge( array($stmt,$a) , $inputarr);
|
||||
$ret = call_user_func_array('mysqli_bind_param',$fnarr);
|
||||
if (is_string($v)) $a .= 's';
|
||||
else if (is_integer($v)) $a .= 'i';
|
||||
else $a .= 'd';
|
||||
}
|
||||
$ret = mysqli_execute($stmt);
|
||||
|
||||
$fnarr =& array_merge( array($stmt,$a) , $inputarr);
|
||||
$ret = call_user_func_array('mysqli_stmt_bind_param',$fnarr);
|
||||
|
||||
$ret = mysqli_stmt_execute($stmt);
|
||||
return $ret;
|
||||
}
|
||||
if (!$mysql_res = mysqli_query($this->_connectionID, $sql, ($ADODB_COUNTRECS) ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -25,6 +25,11 @@ class ADODB_mysqlt extends ADODB_mysql {
|
|||
var $hasTransactions = true;
|
||||
var $autoRollback = true; // apparently mysql does not autorollback properly
|
||||
|
||||
function ADODB_mysqlt()
|
||||
{
|
||||
global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
|
||||
}
|
||||
|
||||
function BeginTrans()
|
||||
{
|
||||
if ($this->transOff) return true;
|
||||
|
@ -59,21 +64,62 @@ class ADODB_mysqlt extends ADODB_mysql {
|
|||
class ADORecordSet_mysqlt extends ADORecordSet_mysql{
|
||||
var $databaseType = "mysqlt";
|
||||
|
||||
function ADORecordSet_mysqlt($queryID,$mode=false) {
|
||||
return $this->ADORecordSet_mysql($queryID,$mode);
|
||||
function ADORecordSet_mysqlt($queryID,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
switch ($mode)
|
||||
{
|
||||
case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
|
||||
case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
|
||||
default:
|
||||
case ADODB_FETCH_DEFAULT:
|
||||
case ADODB_FETCH_BOTH:$this->fetchMode = MYSQL_BOTH; break;
|
||||
}
|
||||
|
||||
$this->ADORecordSet($queryID);
|
||||
}
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
if ($this->EOF) return false;
|
||||
|
||||
$this->_currentRow++;
|
||||
// using & below slows things down by 20%!
|
||||
$this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode);
|
||||
if ($this->fields) return true;
|
||||
$this->EOF = true;
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
if (@$this->fields =& mysql_fetch_array($this->_queryID,$this->fetchMode)) {
|
||||
$this->_currentRow += 1;
|
||||
return true;
|
||||
}
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow += 1;
|
||||
$this->EOF = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {
|
||||
|
||||
function ADORecordSet_ext_mysqli($queryID,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
switch ($mode)
|
||||
{
|
||||
case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
|
||||
case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
|
||||
default:
|
||||
case ADODB_FETCH_DEFAULT:
|
||||
case ADODB_FETCH_BOTH:$this->fetchMode = MYSQL_BOTH; break;
|
||||
}
|
||||
|
||||
$this->ADORecordSet($queryID);
|
||||
}
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
return adodb_movenext($this);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
|
||||
First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com
|
||||
Based on the previous postgres drivers.
|
||||
|
@ -26,7 +26,6 @@ class ADODB_netezza extends ADODB_postgres64 {
|
|||
var $_resultid = false;
|
||||
var $concat_operator='||';
|
||||
var $random = 'random';
|
||||
var $upperCase = 'upper';
|
||||
var $metaDatabasesSQL = "select objname from _v_object_data where objtype='database' order by 1";
|
||||
var $metaTablesSQL = "select objname from _v_object_data where objtype='table' order by 1";
|
||||
var $isoDates = true; // accepts dates in ISO format
|
||||
|
|
|
@ -91,6 +91,7 @@ class ADODB_oci8 extends ADOConnection {
|
|||
function ADODB_oci8()
|
||||
{
|
||||
$this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
|
||||
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
|
||||
}
|
||||
|
||||
/* Function &MetaColumns($table) added by smondino@users.sourceforge.net*/
|
||||
|
@ -234,8 +235,6 @@ NATSOFT.DOMAIN =
|
|||
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returns true or false
|
||||
function _nconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
|
@ -576,7 +575,7 @@ NATSOFT.DOMAIN =
|
|||
if ($this->session_sharing_force_blob) $this->Execute('ALTER SESSION SET CURSOR_SHARING=EXACT');
|
||||
$commit = $this->autoCommit;
|
||||
if ($commit) $this->BeginTrans();
|
||||
$rs = ADODB_oci8::Execute($sql,$arr);
|
||||
$rs = $this->_Execute($sql,$arr);
|
||||
if ($rez = !empty($rs)) $desc->save($val);
|
||||
$desc->free();
|
||||
if ($commit) $this->CommitTrans();
|
||||
|
@ -748,7 +747,7 @@ NATSOFT.DOMAIN =
|
|||
return $rez;
|
||||
}
|
||||
|
||||
function Param($name)
|
||||
function Param($name,$type=false)
|
||||
{
|
||||
return ':'.$name;
|
||||
}
|
||||
|
@ -898,6 +897,8 @@ NATSOFT.DOMAIN =
|
|||
// returns true or false
|
||||
function _close()
|
||||
{
|
||||
if (!$this->_connectionID) return;
|
||||
|
||||
if (!$this->autoCommit) OCIRollback($this->_connectionID);
|
||||
if (count($this -> _refLOBs) > 0) {
|
||||
foreach ($this -> _refLOBs as $key => $value) {
|
||||
|
@ -906,6 +907,7 @@ NATSOFT.DOMAIN =
|
|||
}
|
||||
}
|
||||
OCILogoff($this->_connectionID);
|
||||
|
||||
$this->_stmt = false;
|
||||
$this->_connectionID = false;
|
||||
}
|
||||
|
@ -1126,8 +1128,9 @@ class ADORecordset_oci8 extends ADORecordSet {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
// 10% speedup to move MoveNext to child class
|
||||
function MoveNext()
|
||||
function _MoveNext()
|
||||
{
|
||||
//global $ADODB_EXTENSION;if ($ADODB_EXTENSION) return @adodb_movenext($this);
|
||||
|
||||
|
@ -1139,7 +1142,22 @@ class ADORecordset_oci8 extends ADORecordSet {
|
|||
$this->EOF = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
if (@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
|
||||
$this->_currentRow += 1;
|
||||
return true;
|
||||
}
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow += 1;
|
||||
$this->EOF = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto() */
|
||||
function &GetArrayLimit($nrows,$offset=-1)
|
||||
|
@ -1244,4 +1262,29 @@ class ADORecordset_oci8 extends ADORecordSet {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ADORecordSet_ext_oci8 extends ADORecordSet_oci8 {
|
||||
function ADORecordSet_ext_oci8($queryID,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
switch ($mode)
|
||||
{
|
||||
default:
|
||||
case ADODB_FETCH_NUM: $this->fetchMode = OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
|
||||
case ADODB_FETCH_ASSOC:$this->fetchMode = OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
|
||||
case ADODB_FETCH_DEFAULT:
|
||||
case ADODB_FETCH_BOTH:$this->fetchMode = OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS; break;
|
||||
}
|
||||
|
||||
$this->_queryID = $queryID;
|
||||
}
|
||||
|
||||
function MoveNext()
|
||||
{
|
||||
return adodb_movenext($this);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -30,7 +30,8 @@ class ADODB_oci8po extends ADODB_oci8 {
|
|||
|
||||
function ADODB_oci8po()
|
||||
{
|
||||
$this->ADODB_oci8();
|
||||
$this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
|
||||
# oci8po does not support adodb extension: adodb_movenext()
|
||||
}
|
||||
|
||||
function Param($name)
|
||||
|
@ -77,59 +78,72 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
|
|||
|
||||
var $databaseType = 'oci8po';
|
||||
|
||||
function ADORecordset_oci8po($queryID,$mode=false)
|
||||
{
|
||||
$this->ADORecordset_oci8($queryID,$mode);
|
||||
}
|
||||
function ADORecordset_oci8po($queryID,$mode=false)
|
||||
{
|
||||
$this->ADORecordset_oci8($queryID,$mode);
|
||||
}
|
||||
|
||||
function Fields($colname)
|
||||
{
|
||||
if ($this->fetchMode & OCI_ASSOC) return $this->fields[$colname];
|
||||
|
||||
if (!$this->bind) {
|
||||
$this->bind = array();
|
||||
for ($i=0; $i < $this->_numOfFields; $i++) {
|
||||
$o = $this->FetchField($i);
|
||||
$this->bind[strtoupper($o->name)] = $i;
|
||||
}
|
||||
}
|
||||
return $this->fields[$this->bind[strtoupper($colname)]];
|
||||
}
|
||||
function Fields($colname)
|
||||
{
|
||||
if ($this->fetchMode & OCI_ASSOC) return $this->fields[$colname];
|
||||
|
||||
// lowercase field names...
|
||||
function &_FetchField($fieldOffset = -1)
|
||||
{
|
||||
$fld = new ADOFieldObject;
|
||||
$fieldOffset += 1;
|
||||
$fld->name = strtolower(OCIcolumnname($this->_queryID, $fieldOffset));
|
||||
$fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
|
||||
$fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset);
|
||||
if ($fld->type == 'NUMBER') {
|
||||
//$p = OCIColumnPrecision($this->_queryID, $fieldOffset);
|
||||
$sc = OCIColumnScale($this->_queryID, $fieldOffset);
|
||||
if ($sc == 0) $fld->type = 'INT';
|
||||
}
|
||||
return $fld;
|
||||
if (!$this->bind) {
|
||||
$this->bind = array();
|
||||
for ($i=0; $i < $this->_numOfFields; $i++) {
|
||||
$o = $this->FetchField($i);
|
||||
$this->bind[strtoupper($o->name)] = $i;
|
||||
}
|
||||
}
|
||||
return $this->fields[$this->bind[strtoupper($colname)]];
|
||||
}
|
||||
|
||||
// lowercase field names...
|
||||
function &_FetchField($fieldOffset = -1)
|
||||
{
|
||||
$fld = new ADOFieldObject;
|
||||
$fieldOffset += 1;
|
||||
$fld->name = strtolower(OCIcolumnname($this->_queryID, $fieldOffset));
|
||||
$fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
|
||||
$fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset);
|
||||
if ($fld->type == 'NUMBER') {
|
||||
//$p = OCIColumnPrecision($this->_queryID, $fieldOffset);
|
||||
$sc = OCIColumnScale($this->_queryID, $fieldOffset);
|
||||
if ($sc == 0) $fld->type = 'INT';
|
||||
}
|
||||
return $fld;
|
||||
}
|
||||
/*
|
||||
function MoveNext()
|
||||
{
|
||||
if (@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
|
||||
$this->_currentRow += 1;
|
||||
return true;
|
||||
}
|
||||
if (!$this->EOF) {
|
||||
$this->_currentRow += 1;
|
||||
$this->EOF = true;
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
|
||||
// 10% speedup to move MoveNext to child class
|
||||
function MoveNext()
|
||||
{
|
||||
|
||||
if (!$this->EOF) {
|
||||
if(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
|
||||
global $ADODB_ANSI_PADDING_OFF;
|
||||
$this->_currentRow++;
|
||||
if(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
|
||||
global $ADODB_ANSI_PADDING_OFF;
|
||||
|
||||
if ($this->fetchMode & OCI_ASSOC) $this->_updatefields();
|
||||
if (!empty($ADODB_ANSI_PADDING_OFF)) {
|
||||
foreach($this->fields as $k => $v) {
|
||||
if (is_string($v)) $this->fields[$k] = rtrim($v);
|
||||
}
|
||||
|
||||
if ($this->fetchMode & OCI_ASSOC) $this->_updatefields();
|
||||
if (!empty($ADODB_ANSI_PADDING_OFF)) {
|
||||
foreach($this->fields as $k => $v) {
|
||||
if (is_string($v)) $this->fields[$k] = rtrim($v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!$this->EOF) {
|
||||
$this->EOF = true;
|
||||
$this->_currentRow++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -190,4 +204,6 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -37,6 +37,7 @@ class ADODB_odbc extends ADOConnection {
|
|||
var $_haserrorfunctions = true;
|
||||
var $_has_stupid_odbc_fetch_api_change = true;
|
||||
var $_lastAffectedRows = 0;
|
||||
var $uCaseTables = true; // for meta* functions, uppercase table names
|
||||
|
||||
function ADODB_odbc()
|
||||
{
|
||||
|
@ -56,7 +57,7 @@ class ADODB_odbc extends ADOConnection {
|
|||
|
||||
while(true) {
|
||||
|
||||
$rez = odbc_data_source($this->_connectionID,
|
||||
$rez = @odbc_data_source($this->_connectionID,
|
||||
$first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT);
|
||||
$first = false;
|
||||
if (!is_array($rez)) break;
|
||||
|
@ -232,9 +233,13 @@ class ADODB_odbc extends ADOConnection {
|
|||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
if ($this->uCaseTables) $table = strtoupper($table);
|
||||
$schema = '';
|
||||
$this->_findschema($table,$schema);
|
||||
|
||||
$savem = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
$qid = @odbc_primarykeys($this->_connectionID,'','',$table);
|
||||
$qid = @odbc_primarykeys($this->_connectionID,'',$schema,$table);
|
||||
|
||||
if (!$qid) {
|
||||
$ADODB_FETCH_MODE = $savem;
|
||||
|
@ -361,14 +366,14 @@ class ADODB_odbc extends ADOConnection {
|
|||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$table = strtoupper($table);
|
||||
$schema = false;
|
||||
if ($this->uCaseTables) $table = strtoupper($table);
|
||||
$schema = '';
|
||||
$this->_findschema($table,$schema);
|
||||
|
||||
$savem = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
|
||||
if (false) { // after testing, confirmed that the following does not work becoz of a bug
|
||||
/*if (false) { // after testing, confirmed that the following does not work becoz of a bug
|
||||
$qid2 = odbc_tables($this->_connectionID);
|
||||
$rs = new ADORecordSet_odbc($qid2);
|
||||
$ADODB_FETCH_MODE = $savem;
|
||||
|
@ -387,12 +392,19 @@ class ADODB_odbc extends ADOConnection {
|
|||
$rs->Close();
|
||||
|
||||
$qid = odbc_columns($this->_connectionID,$q,$o,strtoupper($table),'%');
|
||||
} else switch ($this->databaseType) {
|
||||
} */
|
||||
|
||||
switch ($this->databaseType) {
|
||||
case 'access':
|
||||
case 'vfp':
|
||||
case 'db2':
|
||||
$qid = odbc_columns($this->_connectionID);
|
||||
$qid = odbc_columns($this->_connectionID);#,'%','',strtoupper($table),'%');
|
||||
break;
|
||||
|
||||
|
||||
case 'db2':
|
||||
$colname = "%";
|
||||
$qid = odbc_columns($this->_connectionID, "", $schema, $table, $colname);
|
||||
break;
|
||||
|
||||
default:
|
||||
$qid = @odbc_columns($this->_connectionID,'%','%',strtoupper($table),'%');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -32,7 +32,6 @@ class ADODB_odbc_mssql extends ADODB_odbc {
|
|||
var $sysTimeStamp = 'GetDate()';
|
||||
var $leftOuter = '*=';
|
||||
var $rightOuter = '=*';
|
||||
var $upperCase = 'upper';
|
||||
var $substr = 'substring';
|
||||
var $length = 'len';
|
||||
var $ansiOuter = true; // for mssql7 or later
|
||||
|
@ -146,12 +145,23 @@ order by constraint_name, referenced_table_name, keyno";
|
|||
// tested with MSSQL 2000
|
||||
function &MetaPrimaryKeys($table)
|
||||
{
|
||||
$sql = "select k.column_name from information_schema.key_column_usage k,
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$schema = '';
|
||||
$this->_findschema($table,$schema);
|
||||
//if (!$schema) $schema = $this->database;
|
||||
if ($schema) $schema = "and k.table_catalog like '$schema%'";
|
||||
|
||||
$sql = "select distinct k.column_name,ordinal_position from information_schema.key_column_usage k,
|
||||
information_schema.table_constraints tc
|
||||
where tc.constraint_name = k.constraint_name and tc.constraint_type =
|
||||
'PRIMARY KEY' and k.table_name = '$table'";
|
||||
'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position ";
|
||||
|
||||
$savem = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
$a = $this->GetCol($sql);
|
||||
$ADODB_FETCH_MODE = $savem;
|
||||
|
||||
if ($a && sizeof($a)>0) return $a;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
|
@ -174,7 +174,6 @@ class ADODB_odbtp extends ADOConnection{
|
|||
$this->_canSelectDb = true;
|
||||
$this->substr = "substring";
|
||||
$this->length = 'len';
|
||||
$this->upperCase = 'upper';
|
||||
$this->identitySQL = 'select @@IDENTITY';
|
||||
$this->metaDatabasesSQL = "select name from master..sysdatabases where name <> 'master'";
|
||||
break;
|
||||
|
@ -202,7 +201,6 @@ class ADODB_odbtp extends ADOConnection{
|
|||
$this->replaceQuote = "'+chr(39)+'";
|
||||
$this->true = '.T.';
|
||||
$this->false = '.F.';
|
||||
$this->upperCase = 'upper';
|
||||
break;
|
||||
case ODB_DRIVER_ORACLE:
|
||||
$this->fmtDate = "'Y-m-d 00:00:00'";
|
||||
|
@ -222,7 +220,6 @@ class ADODB_odbtp extends ADOConnection{
|
|||
$this->rightOuter = '=*';
|
||||
$this->hasInsertID = true;
|
||||
$this->hasTransactions = true;
|
||||
$this->upperCase = 'upper';
|
||||
$this->identitySQL = 'select @@IDENTITY';
|
||||
break;
|
||||
default:
|
||||
|
@ -628,6 +625,4 @@ class ADORecordSet_odbtp extends ADORecordSet {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
?>
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
|
@ -59,5 +59,4 @@ class ADORecordSet_odbtp_unicode extends ADORecordSet_odbtp {
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
||||
Latest version is available at http://adodb.sourceforge.net
|
||||
|
||||
Oracle data driver. Requires Oracle client. Works on Windows and Unix and Oracle 7 and 8.
|
||||
Oracle data driver. Requires Oracle client. Works on Windows and Unix and Oracle 7.
|
||||
|
||||
If you are using Oracle 8, use the oci8 driver which is much better and more reliable.
|
||||
If you are using Oracle 8 or later, use the oci8 driver which is much better and more reliable.
|
||||
*/
|
||||
|
||||
// security - hide paths
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -390,14 +390,14 @@ select viewname,'V' from pg_views where viewname like $mask";
|
|||
|
||||
// for schema support, pass in the $table param "$schema.$tabname".
|
||||
// converts field names to lowercase, $upper is ignored
|
||||
function &MetaColumns($table,$upper=true)
|
||||
function &MetaColumns($table,$normalize=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$schema = false;
|
||||
$this->_findschema($table,$schema);
|
||||
|
||||
$table = strtolower($table);
|
||||
if ($normalize) $table = strtolower($table);
|
||||
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
|
@ -486,7 +486,7 @@ select viewname,'V' from pg_views where viewname like $mask";
|
|||
}
|
||||
|
||||
if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
|
||||
else $retarr[($upper) ? strtoupper($fld->name) : $fld->name] = $fld;
|
||||
else $retarr[($normalize) ? strtoupper($fld->name) : $fld->name] = $fld;
|
||||
|
||||
$rs->MoveNext();
|
||||
}
|
||||
|
@ -803,9 +803,9 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
|||
// cache types for blob decode check
|
||||
for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
|
||||
if (pg_fieldtype($qid,$i) == 'bytea') {
|
||||
$this->_blobArr[$i] = pg_fieldname($qid,$off);
|
||||
$this->_blobArr[$i] = pg_fieldname($qid,$i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Use associative array to get fields array */
|
||||
|
@ -867,7 +867,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
|||
if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) {
|
||||
$this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode);
|
||||
if (is_array($this->fields) && $this->fields) {
|
||||
if ($this->fields && isset($this->_blobArr)) $this->_fixblobs();
|
||||
if (isset($this->_blobArr)) $this->_fixblobs();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -155,7 +155,7 @@ class ADODB_sybase extends ADOConnection {
|
|||
if ($offset > 0 && $cnt) $cnt += $offset;
|
||||
|
||||
$this->Execute("set rowcount $cnt");
|
||||
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
|
||||
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0);
|
||||
$this->Execute("set rowcount 0");
|
||||
|
||||
return $rs;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/*
|
||||
V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence.
|
||||
|
@ -27,7 +27,6 @@ class ADODB_vfp extends ADODB_odbc {
|
|||
var $true = '.T.';
|
||||
var $false = '.F.';
|
||||
var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
|
||||
var $upperCase = 'upper';
|
||||
var $_bindInputArray = false; // strangely enough, setting to true does not work reliably
|
||||
var $sysTimeStamp = 'datetime()';
|
||||
var $sysDate = 'date()';
|
||||
|
@ -45,7 +44,6 @@ class ADODB_vfp extends ADODB_odbc {
|
|||
return time();
|
||||
}
|
||||
|
||||
|
||||
function BeginTrans() { return false;}
|
||||
|
||||
// quote string to be sent back to database
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue