MDL-14672 adodb PHP5 only version V5.04a import - yay!

This commit is contained in:
skodak 2008-05-02 22:50:22 +00:00
parent 32ba2f0dd4
commit ef85daa2b7
102 changed files with 5693 additions and 5461 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
@version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
@version V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Latest version is available at http://adodb.sourceforge.net
Released under both BSD license and Lesser GPL library license.
@ -10,7 +10,7 @@
Active Record implementation. Superset of Zend Framework's.
Version 0.09
Version 0.08
See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord
for info on Ruby on Rails Active Record implementation
@ -53,7 +53,7 @@ function ADODB_SetDatabaseAdapter(&$db)
}
$obj = new ADODB_Active_DB();
$obj->db =& $db;
$obj->db = $db;
$obj->tables = array();
$_ADODB_ACTIVE_DBS[] = $obj;
@ -71,8 +71,7 @@ class ADODB_Active_Record {
var $_lasterr = false; // last error message
var $_original = false; // the original values loaded or inserted, refreshed on update
// should be static
function UseDefaultValues($bool=null)
static function UseDefaultValues($bool=null)
{
global $ADODB_ACTIVE_DEFVALS;
if (isset($bool)) $ADODB_ACTIVE_DEFVALS = $bool;
@ -80,15 +79,16 @@ class ADODB_Active_Record {
}
// should be static
function SetDatabaseAdapter(&$db)
static function SetDatabaseAdapter(&$db)
{
return ADODB_SetDatabaseAdapter($db);
}
// php4 constructor
function ADODB_Active_Record($table = false, $pkeyarr=false, $db=false)
public function __set($name, $value)
{
ADODB_Active_Record::__construct($table,$pkeyarr,$db);
$name = str_replace(' ', '_', $name);
$this->$name = $value;
}
// php5 constructor
@ -153,23 +153,24 @@ class ADODB_Active_Record {
global $ADODB_ASSOC_CASE,$_ADODB_ACTIVE_DBS , $ADODB_CACHE_DIR, $ADODB_ACTIVE_CACHESECS;
global $ADODB_ACTIVE_DEFVALS;
$activedb =& $_ADODB_ACTIVE_DBS[$this->_dbat];
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$table = $this->_table;
$tables = $activedb->tables;
$tableat = $this->_tableat;
if (!$forceUpdate && !empty($tables[$tableat])) {
$tobj =& $tables[$tableat];
$tobj = $tables[$tableat];
foreach($tobj->flds as $name => $fld) {
if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value))
$this->$name = $fld->default_value;
else
$this->$name = null;
if ($ADODB_ACTIVE_DEFVALS && isset($fld->default_value))
$this->$name = $fld->default_value;
else
$this->$name = null;
}
return;
}
$db =& $activedb->db;
$db = $activedb->db;
$fname = $ADODB_CACHE_DIR . '/adodb_' . $db->databaseType . '_active_'. $table . '.cache';
if (!$forceUpdate && $ADODB_ACTIVE_CACHESECS && $ADODB_CACHE_DIR && file_exists($fname)) {
$fp = fopen($fname,'r');
@ -288,7 +289,7 @@ class ADODB_Active_Record {
if ($this->_dbat < 0) $db = false;
else {
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db =& $activedb->db;
$db = $activedb->db;
}
if (function_exists('adodb_throw')) {
@ -322,7 +323,7 @@ class ADODB_Active_Record {
// retrieve ADOConnection from _ADODB_Active_DBs
function &DB()
function DB()
{
global $_ADODB_ACTIVE_DBS;
@ -332,17 +333,17 @@ class ADODB_Active_Record {
return $false;
}
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$db =& $activedb->db;
$db = $activedb->db;
return $db;
}
// retrieve ADODB_Active_Table
function &TableInfo()
function TableInfo()
{
global $_ADODB_ACTIVE_DBS;
$activedb = $_ADODB_ACTIVE_DBS[$this->_dbat];
$table =& $activedb->tables[$this->_tableat];
$table = $activedb->tables[$this->_tableat];
return $table;
}
@ -351,7 +352,7 @@ class ADODB_Active_Record {
{
global $ACTIVE_RECORD_SAFETY;
$db =& $this->DB();
$db = $this->DB();
if (!$row) {
$this->_saved = false;
@ -360,8 +361,9 @@ class ADODB_Active_Record {
$this->_saved = true;
$table =& $this->TableInfo();
$table = $this->TableInfo();
if ($ACTIVE_RECORD_SAFETY && sizeof($table->flds) != sizeof($row)) {
# <AP>
$bad_size = TRUE;
if (sizeof($row) == 2 * sizeof($table->flds)) {
// Only keep string keys
@ -370,13 +372,14 @@ class ADODB_Active_Record {
$bad_size = FALSE;
}
if ($bad_size) {
$this->Error("Table structure of $this->_table has changed","Load");
return false;
}
$this->Error("Table structure of $this->_table has changed","Load");
return false;
}
# </AP>
}
else
$keys = array_keys($row);
$keys = array_keys($row);
# <AP>
reset($keys);
$this->_original = array();
foreach($table->flds as $name=>$fld) {
@ -446,7 +449,7 @@ class ADODB_Active_Record {
function Load($where,$bindarr=false)
{
$db =& $this->DB(); if (!$db) return false;
$db = $this->DB(); if (!$db) return false;
$this->_where = $where;
$save = $db->SetFetchMode(ADODB_FETCH_NUM);
@ -468,9 +471,9 @@ class ADODB_Active_Record {
// false on error
function Insert()
{
$db =& $this->DB(); if (!$db) return false;
$db = $this->DB(); if (!$db) return false;
$cnt = 0;
$table =& $this->TableInfo();
$table = $this->TableInfo();
$valarr = array();
$names = array();
@ -518,8 +521,8 @@ class ADODB_Active_Record {
function Delete()
{
$db =& $this->DB(); if (!$db) return false;
$table =& $this->TableInfo();
$db = $this->DB(); if (!$db) return false;
$table = $this->TableInfo();
$where = $this->GenWhere($db,$table);
$sql = 'DELETE FROM '.$this->_table.' WHERE '.$where;
@ -529,10 +532,10 @@ class ADODB_Active_Record {
}
// returns an array of active record objects
function &Find($whereOrderBy,$bindarr=false,$pkeysArr=false)
function Find($whereOrderBy,$bindarr=false,$pkeysArr=false)
{
$db =& $this->DB(); if (!$db || empty($this->_table)) return false;
$arr =& $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr);
$db = $this->DB(); if (!$db || empty($this->_table)) return false;
$arr = $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr);
return $arr;
}
@ -541,8 +544,8 @@ class ADODB_Active_Record {
{
global $ADODB_ASSOC_CASE;
$db =& $this->DB(); if (!$db) return false;
$table =& $this->TableInfo();
$db = $this->DB(); if (!$db) return false;
$table = $this->TableInfo();
$pkey = $table->keys;
@ -593,7 +596,7 @@ class ADODB_Active_Record {
}
}
$this->_original =& $valarr;
$this->_original = $valarr;
}
return $ok;
}
@ -601,8 +604,8 @@ class ADODB_Active_Record {
// returns 0 on error, 1 on update, -1 if no change in data (no update)
function Update()
{
$db =& $this->DB(); if (!$db) return false;
$table =& $this->TableInfo();
$db = $this->DB(); if (!$db) return false;
$table = $this->TableInfo();
$where = $this->GenWhere($db, $table);
@ -647,7 +650,7 @@ class ADODB_Active_Record {
$sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where;
$ok = $db->Execute($sql,$valarr);
if ($ok) {
$this->_original =& $neworig;
$this->_original = $neworig;
return 1;
}
return 0;
@ -655,7 +658,7 @@ class ADODB_Active_Record {
function GetAttributeNames()
{
$table =& $this->TableInfo();
$table = $this->TableInfo();
if (!$table) return false;
return array_keys($table->flds);
}

View File

@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1;
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -54,7 +54,7 @@ $ADODB_INCLUDED_CSV = 1;
$line = "====1,$tt,$sql\n";
if ($rs->databaseType == 'array') {
$rows =& $rs->_array;
$rows = $rs->_array;
} else {
$rows = array();
while (!$rs->EOF) {
@ -64,7 +64,7 @@ $ADODB_INCLUDED_CSV = 1;
}
for($i=0; $i < $max; $i++) {
$o =& $rs->FetchField($i);
$o = $rs->FetchField($i);
$flds[] = $o;
}
@ -90,7 +90,7 @@ $ADODB_INCLUDED_CSV = 1;
* error occurred in sql INSERT/UPDATE/DELETE,
* empty recordset is returned
*/
function &csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
function csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
{
$false = false;
$err = false;

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -215,7 +215,6 @@ class ADODB_DataDict {
return $this->connection->MetaIndexes($this->TableName($table), $primary, $owner);
}
function MetaType($t,$len=-1,$fieldobj=false)
{
static $typeMap = array(
@ -369,7 +368,7 @@ class ADODB_DataDict {
function ExecuteSQLArray($sql, $continueOnError = true)
{
$rez = 2;
$conn = &$this->connection;
$conn = $this->connection;
$saved = $conn->debug;
foreach($sql as $line) {

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -78,7 +78,7 @@ global $ADODB_Last_PEAR_Error;
* Returns last PEAR_Error object. This error might be for an error that
* occured several sql statements ago.
*/
function &ADODB_PEAR_Error()
function ADODB_PEAR_Error()
{
global $ADODB_Last_PEAR_Error;

View File

@ -1,7 +1,7 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -18,68 +18,13 @@
Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
Moved to adodb.inc.php to improve performance.
*/
class ADODB_Iterator implements Iterator {
private $rs;
function __construct($rs)
{
$this->rs = $rs;
}
function rewind()
{
$this->rs->MoveFirst();
}
function valid()
{
return !$this->rs->EOF;
}
function key()
{
return $this->rs->_currentRow;
}
function current()
{
return $this->rs->fields;
}
function next()
{
$this->rs->MoveNext();
}
function __call($func, $params)
{
return call_user_func_array(array($this->rs, $func), $params);
}
function hasMore()
{
return !$this->rs->EOF;
}
}
class ADODB_BASE_RS implements IteratorAggregate {
function getIterator() {
return new ADODB_Iterator($this);
}
/* this is experimental - i don't really know what to return... */
function __toString()
{
include_once(ADODB_DIR.'/toexport.inc.php');
return _adodb_export($this,',',',',false,true);
}
}
?>

View File

@ -1,5 +1,8 @@
<?php
// security - hide paths
if (!defined('ADODB_DIR')) die();
@ -7,7 +10,7 @@ global $ADODB_INCLUDED_LIB;
$ADODB_INCLUDED_LIB = 1;
/*
@version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved.
@version V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -55,7 +58,7 @@ function adodb_probetypes(&$array,&$types,$probe=8)
for ($j=0;$j < $max; $j++) {
$row =& $array[$j];
$row = $array[$j];
if (!$row) break;
$i = -1;
foreach($row as $v) {
@ -417,9 +420,9 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
} else if (strncmp($zthis->databaseType,'postgres',8) == 0 || strncmp($zthis->databaseType,'mysql',5) == 0) {
$rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_";
} else {
$rewritesql = "SELECT COUNT(*) FROM ($rewritesql) ";
$rewritesql = "SELECT COUNT(*) FROM ($rewritesql)";
}
} else {
} else {
// now replace SELECT ... FROM with SELECT COUNT(*) FROM
$rewritesql = preg_replace(
'/^\s*SELECT\s.*\s+FROM\s/Uis','SELECT COUNT(*) FROM ',$sql);
@ -431,7 +434,7 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
if (isset($rewritesql) && $rewritesql != $sql) {
if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
if ($secs2cache) {
// we only use half the time of secs2cache because the count can quickly
// become inaccurate if new records are added
@ -452,7 +455,7 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
$rstest = &$zthis->Execute($rewritesql,$inputarr);
$rstest = $zthis->Execute($rewritesql,$inputarr);
if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
if ($rstest) {
@ -486,7 +489,7 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
data will get out of synch. use CachePageExecute() only with tables that
rarely change.
*/
function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
$inputarr=false, $secs2cache=0)
{
$atfirstpage = false;
@ -522,9 +525,9 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
// We get the data we want
$offset = $nrows * ($page-1);
if ($secs2cache > 0)
$rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
$rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
else
$rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
$rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
// Before returning the RecordSet, we set the pagination properties we need
@ -539,8 +542,8 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page,
return $rsreturn;
}
// Iván Oliva version
function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0)
// Iv<EFBFBD>n Oliva version
function _adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $secs2cache=0)
{
$atfirstpage = false;
@ -556,16 +559,16 @@ function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputar
// the last page number.
$pagecounter = $page + 1;
$pagecounteroffset = ($pagecounter * $nrows) - $nrows;
if ($secs2cache>0) $rstest = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr);
else $rstest = &$zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache);
if ($secs2cache>0) $rstest = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr);
else $rstest = $zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache);
if ($rstest) {
while ($rstest && $rstest->EOF && $pagecounter>0) {
$atlastpage = true;
$pagecounter--;
$pagecounteroffset = $nrows * ($pagecounter - 1);
$rstest->Close();
if ($secs2cache>0) $rstest = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr);
else $rstest = &$zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache);
if ($secs2cache>0) $rstest = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr);
else $rstest = $zthis->SelectLimit($sql, $nrows, $pagecounteroffset, $inputarr, $secs2cache);
}
if ($rstest) $rstest->Close();
}
@ -577,8 +580,8 @@ function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputar
// We get the data we want
$offset = $nrows * ($page-1);
if ($secs2cache > 0) $rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
else $rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
if ($secs2cache > 0) $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
else $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
// Before returning the RecordSet, we set the pagination properties we need
if ($rsreturn) {
@ -773,10 +776,10 @@ static $cacheCols;
//php can't do a $rsclass::MetaType()
$rsclass = $zthis->rsPrefix.$zthis->databaseType;
$recordSet = new $rsclass(-1,$zthis->fetchMode);
$recordSet->connection = &$zthis;
$recordSet->connection = $zthis;
if (is_string($cacheRS) && $cacheRS == $rs) {
$columns =& $cacheCols;
$columns = $cacheCols;
} else {
$columns = $zthis->MetaColumns( $tableName );
$cacheRS = $tableName;
@ -784,7 +787,7 @@ static $cacheCols;
}
} else if (is_subclass_of($rs, 'adorecordset')) {
if (isset($rs->insertSig) && is_integer($cacheRS) && $cacheRS == $rs->insertSig) {
$columns =& $cacheCols;
$columns = $cacheCols;
} else {
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++)
$columns[] = $rs->FetchField($i);
@ -792,7 +795,7 @@ static $cacheCols;
$cacheCols = $columns;
$rs->insertSig = $cacheSig++;
}
$recordSet =& $rs;
$recordSet = $rs;
} else {
printf(ADODB_BAD_RS,'GetInsertSQL');
@ -993,7 +996,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
case "D":
$val = $zthis->DBDate($arrFields[$fname]);
break;
case "T":
$val = $zthis->DBTimeStamp($arrFields[$fname]);
break;
@ -1002,7 +1005,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields,
case "N":
$val = $arrFields[$fname];
if (!is_numeric($val)) $val = str_replace(',', '.', (float)$val);
break;
break;
case "L": //Integer field suitable for storing booleans (0 or 1) // Moodle added
case "I":
@ -1178,4 +1181,4 @@ function _adodb_find_from($sql)
}
*/
?>
?>

View File

@ -18,7 +18,7 @@ $ADODB_INCLUDED_MEMCACHE = 1;
*/
function &getmemcache($key,&$err, $timeout=0, $host, $port)
function getmemcache($key,&$err, $timeout=0, $host, $port)
{
$false = false;
$err = false;

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -247,12 +247,12 @@ class ADODB_Pager {
$savec = $ADODB_COUNTRECS;
if ($this->db->pageExecuteCountRows) $ADODB_COUNTRECS = true;
if ($this->cache)
$rs = &$this->db->CachePageExecute($this->cache,$this->sql,$rows,$this->curr_page);
$rs = $this->db->CachePageExecute($this->cache,$this->sql,$rows,$this->curr_page);
else
$rs = &$this->db->PageExecute($this->sql,$rows,$this->curr_page);
$rs = $this->db->PageExecute($this->sql,$rows,$this->curr_page);
$ADODB_COUNTRECS = $savec;
$this->rs = &$rs;
$this->rs = $rs;
if (!$rs) {
print "<h3>Query failed: $this->sql</h3>";
return;

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -109,11 +109,11 @@ class DB
* error
*/
function &factory($type)
function factory($type)
{
include_once(ADODB_DIR."/drivers/adodb-$type.inc.php");
$obj = &NewADOConnection($type);
if (!is_object($obj)) $obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
$obj = NewADOConnection($type);
if (!is_object($obj)) $obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
return $obj;
}
@ -136,7 +136,7 @@ class DB
* @see DB::parseDSN
* @see DB::isError
*/
function &connect($dsn, $options = false)
function connect($dsn, $options = false)
{
if (is_array($dsn)) {
$dsninfo = $dsn;
@ -157,9 +157,9 @@ class DB
@include_once("adodb-$type.inc.php");
}
@$obj =& NewADOConnection($type);
@$obj = NewADOConnection($type);
if (!is_object($obj)) {
$obj =& new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
$obj = new PEAR_Error('Unknown Database Driver: '.$dsninfo['phptype'],-1);
return $obj;
}
if (is_array($options)) {

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -19,11 +19,12 @@ V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights rese
if (!defined('ADODB_DIR')) include_once(dirname(__FILE__).'/adodb.inc.php');
include_once(ADODB_DIR.'/tohtml.inc.php');
define( 'ADODB_OPT_HIGH', 2);
define( 'ADODB_OPT_LOW', 1);
global $ADODB_PERF_MIN;
$ADODB_PERF_MIN = 0.05; // log only if >= minimum number of secs to run
define( 'ADODB_OPT_HIGH', 2);
define( 'ADODB_OPT_LOW', 1);
// returns in K the memory of current process, or 0 if not known
function adodb_getmem()
@ -65,25 +66,25 @@ function adodb_microtime()
}
/* sql code timing */
function& adodb_log_sql(&$connx,$sql,$inputarr)
function adodb_log_sql(&$connx,$sql,$inputarr)
{
$perf_table = adodb_perf::table();
$connx->fnExecute = false;
$t0 = microtime();
$rs =& $connx->Execute($sql,$inputarr);
$rs = $connx->Execute($sql,$inputarr);
$t1 = microtime();
if (!empty($connx->_logsql) && (empty($connx->_logsqlErrors) || !$rs)) {
global $ADODB_LOG_CONN;
if (!empty($ADODB_LOG_CONN)) {
$conn = &$ADODB_LOG_CONN;
$conn = $ADODB_LOG_CONN;
if ($conn->databaseType != $connx->databaseType)
$prefix = '/*dbx='.$connx->databaseType .'*/ ';
else
$prefix = '';
} else {
$conn =& $connx;
$conn = $connx;
$prefix = '';
}
@ -168,12 +169,13 @@ function& adodb_log_sql(&$connx,$sql,$inputarr)
if ($dbT == 'db2') $arr['f'] = (float) $arr['f'];
$isql = "insert into $perf_table (created,sql0,sql1,params,tracer,timer) values( $d,?,?,?,?,?)";
}
global $ADODB_PERF_MIN;
if ($errN != 0 || $time >= $ADODB_PERF_MIN) {
$ok = $conn->Execute($isql,$arr);
} else {
} else
$ok = true;
}
$conn->debug = $saved;
if ($ok) {
@ -181,7 +183,7 @@ function& adodb_log_sql(&$connx,$sql,$inputarr)
} else {
$err2 = $conn->ErrorMsg();
$conn->_logsql = true; // enable logsql error simulation
$perf =& NewPerfMonitor($conn);
$perf = NewPerfMonitor($conn);
if ($perf) {
if ($perf->CreateLogTable()) $ok = $conn->Execute($isql,$arr);
} else {
@ -235,7 +237,7 @@ class adodb_perf {
var $maxLength = 2000;
// Sets the tablename to be used
function table($newtable = false)
static function table($newtable = false)
{
static $_table;
@ -416,7 +418,7 @@ Committed_AS: 348732 kB
$saveE = $this->conn->fnExecute;
$this->conn->fnExecute = false;
$perf_table = adodb_perf::table();
$rs =& $this->conn->SelectLimit("select distinct count(*),sql1,tracer as error_msg from $perf_table where tracer like 'ERROR:%' group by sql1,tracer order by 1 desc",$numsql);//,$numsql);
$rs = $this->conn->SelectLimit("select distinct count(*),sql1,tracer as error_msg from $perf_table where tracer like 'ERROR:%' group by sql1,tracer order by 1 desc",$numsql);//,$numsql);
$this->conn->fnExecute = $saveE;
if ($rs) {
$s .= rs2html($rs,false,false,false,false);
@ -450,7 +452,7 @@ Committed_AS: 348732 kB
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
//$this->conn->debug=1;
$rs =& $this->conn->SelectLimit(
$rs = $this->conn->SelectLimit(
"select avg(timer) as avg_timer,$sql1,count(*),max(timer) as max_timer,min(timer) as min_timer
from $perf_table
where {$this->conn->upperCase}({$this->conn->substr}(sql0,1,5)) not in ('DROP ','INSER','COMMI','CREAT')
@ -529,7 +531,7 @@ Committed_AS: 348732 kB
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
$rs =& $this->conn->SelectLimit(
$rs = $this->conn->SelectLimit(
"select sum(timer) as total,$sql1,count(*),max(timer) as max_timer,min(timer) as min_timer
from $perf_table
where {$this->conn->upperCase}({$this->conn->substr}(sql0,1,5)) not in ('DROP ','INSER','COMMI','CREAT')
@ -578,7 +580,7 @@ Committed_AS: 348732 kB
/*
Raw function returning array of poll paramters
*/
function &PollParameters()
function PollParameters()
{
$arr[0] = (float)$this->DBParameter('data cache hit ratio');
$arr[1] = (float)$this->DBParameter('data reads');
@ -653,11 +655,10 @@ Committed_AS: 348732 kB
$perf_table = adodb_perf::table();
$this->conn->Execute("delete from $perf_table where created<".$this->conn->sysTimeStamp);
}
/***********************************************************************************************/
// HIGH LEVEL UI FUNCTIONS
/***********************************************************************************************/
function UI($pollsecs=5)
{
@ -719,13 +720,11 @@ Committed_AS: 348732 kB
switch ($do) {
default:
case 'stats':
if (empty($ADODB_LOG_CONN))
echo "<p>&nbsp; <a href=\"?do=viewsql&clearsql=1\">Clear SQL Log</a><br>";
echo $this->HealthCheck();
//$this->conn->debug=1;
echo $this->CheckMemory();
global $ADODB_LOG_CONN;
echo $this->CheckMemory();
break;
case 'poll':
echo "<iframe width=720 height=80%
@ -764,13 +763,13 @@ Committed_AS: 348732 kB
//$this->conn->debug=1;
if ($secs <= 1) $secs = 1;
echo "Accumulating statistics, every $secs seconds...\n";flush();
$arro =& $this->PollParameters();
$arro = $this->PollParameters();
$cnt = 0;
set_time_limit(0);
sleep($secs);
while (1) {
$arr =& $this->PollParameters();
$arr = $this->PollParameters();
$hits = sprintf('%2.2f',$arr[0]);
$reads = sprintf('%12.4f',($arr[1]-$arro[1])/$secs);

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -411,7 +411,7 @@ function adodb_date_test_date($y1,$m,$d=13)
$t = adodb_mktime($h,0,0,$m,$d,$y1);
$rez = adodb_date('Y-n-j H:i:s',$t);
if ($h == 0) $h = '00';
else if ($h < 10) $h = '0'.$h;
else if ($h < 10) $h = '0'.$h;
if ("$y1-$m-$d $h:00:00" != $rez) {
print "<b>$y1 error, expected=$y1-$m-$d $h:00:00, adodb=$rez</b><br>";
return false;
@ -432,7 +432,7 @@ function adodb_date_test_strftime($fmt)
/**
Test Suite
*/
*/
function adodb_date_test()
{
@ -1423,4 +1423,5 @@ global $ADODB_DATE_LOCALE;
return $ret;
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -83,7 +83,7 @@ class ADODB2_db2 extends ADODB_DataDict {
$validTypes = array("CHAR","VARC");
$invalidTypes = array("BIGI","BLOB","CLOB","DATE", "DECI","DOUB", "INTE", "REAL","SMAL", "TIME");
// check table exists
$cols = &$this->MetaColumns($tablename);
$cols = $this->MetaColumns($tablename);
if ( empty($cols)) {
return $this->CreateTableSQL($tablename, $flds, $tableoptions);
}

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -150,7 +150,7 @@ class ADODB2_postgres extends ADODB_DataDict {
}
return $sql;
}
function DropIndexSQL ($idxname, $tabname = NULL)
{
@ -168,7 +168,8 @@ class ADODB2_postgres extends ADODB_DataDict {
* @param array/ $tableoptions options for the new table see CreateTableSQL, default ''
* @return array with SQL strings
*/
/*function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
/*
function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
if (!$tableflds) {
if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL");

View File

@ -1,7 +1,7 @@
<?php
/**
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -49,7 +49,7 @@ class ADODB_access extends ADODB_odbc {
return " IIF(IsNull($field), $ifNull, $field) "; // if Access
}
/*
function &MetaTables()
function MetaTables()
{
global $ADODB_FETCH_MODE;
@ -62,7 +62,7 @@ class ADODB_access extends ADODB_odbc {
$rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
$arr = &$rs->GetArray();
$arr = $rs->GetArray();
//print_pre($arr);
$arr2 = array();
for ($i=0; $i < sizeof($arr); $i++) {

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -147,7 +147,7 @@ class ADODB_ado extends ADOConnection {
*/
function &MetaTables()
function MetaTables()
{
$arr= array();
$dbc = $this->_connectionID;
@ -169,7 +169,7 @@ class ADODB_ado extends ADOConnection {
return $arr;
}
function &MetaColumns($table)
function MetaColumns($table)
{
$table = strtoupper($table);
$arr = array();
@ -204,7 +204,7 @@ class ADODB_ado extends ADOConnection {
/* returns queryID or false */
function &_query($sql,$inputarr=false)
function _query($sql,$inputarr=false)
{
$dbc = $this->_connectionID;
@ -337,7 +337,7 @@ class ADORecordSet_ado extends ADORecordSet {
// returns the field object
function &FetchField($fieldOffset = -1) {
function FetchField($fieldOffset = -1) {
$off=$fieldOffset+1; // offsets begin at 1
$o= new ADOFieldObject();
@ -597,7 +597,6 @@ class ADORecordSet_ado extends ADORecordSet {
$this->fields[] = $val;
break;
default:
$this->fields[] = $f->value;
break;
@ -610,7 +609,7 @@ class ADORecordSet_ado extends ADORecordSet {
@$rs->MoveNext(); // @ needed for some versions of PHP!
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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,6 +101,9 @@ class ADODB_ado extends ADOConnection {
if ($argProvider) $dbc->Provider = $argProvider;
if ($argProvider) $argHostname = "PROVIDER=$argProvider;DRIVER={SQL Server};SERVER=$argHostname";
if ($argDatabasename) $argHostname .= ";DATABASE=$argDatabasename";
if ($argUsername) $argHostname .= ";$u=$argUsername";
if ($argPassword)$argHostname .= ";$p=$argPassword";
@ -167,7 +170,7 @@ class ADODB_ado extends ADOConnection {
*/
function &MetaTables()
function MetaTables()
{
$arr= array();
$dbc = $this->_connectionID;
@ -189,7 +192,7 @@ class ADODB_ado extends ADOConnection {
return $arr;
}
function &MetaColumns($table)
function MetaColumns($table)
{
$table = strtoupper($table);
$arr= array();
@ -221,7 +224,7 @@ class ADODB_ado extends ADOConnection {
}
/* returns queryID or false */
function &_query($sql,$inputarr=false)
function _query($sql,$inputarr=false)
{
try { // In PHP5, all COM errors are exceptions, so to maintain old behaviour...
@ -367,7 +370,7 @@ class ADORecordSet_ado extends ADORecordSet {
// returns the field object
function &FetchField($fieldOffset = -1) {
function FetchField($fieldOffset = -1) {
$off=$fieldOffset+1; // offsets begin at 1
$o= new ADOFieldObject();
@ -640,7 +643,7 @@ class ADORecordSet_ado extends ADORecordSet {
@$rs->MoveNext(); // @ needed for some versions of PHP!
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -55,7 +55,7 @@ class ADODB_borland_ibase extends ADODB_ibase {
// SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
// Firebird uses
// SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
if ($nrows > 0) {
if ($offset <= 0) $str = " ROWS $nrows ";

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -50,7 +50,7 @@ class ADODB_csv extends ADOConnection {
return $this->_affectedrows;
}
function &MetaDatabases()
function MetaDatabases()
{
return false;
}
@ -72,14 +72,14 @@ class ADODB_csv extends ADOConnection {
return true;
}
function &MetaColumns($table)
function MetaColumns($table)
{
return false;
}
// parameters use PostgreSQL convention, not MySQL
function &SelectLimit($sql,$nrows=-1,$offset=-1)
function SelectLimit($sql,$nrows=-1,$offset=-1)
{
global $ADODB_FETCH_MODE;
@ -108,13 +108,13 @@ class ADODB_csv extends ADOConnection {
$rs->databaseType='csv';
$rs->fetchMode = ($this->fetchMode !== false) ? $this->fetchMode : $ADODB_FETCH_MODE;
$rs->connection = &$this;
$rs->connection = $this;
}
return $rs;
}
// returns queryID or false
function &_Execute($sql,$inputarr=false)
function _Execute($sql,$inputarr=false)
{
global $ADODB_FETCH_MODE;
@ -166,7 +166,7 @@ class ADODB_csv extends ADOConnection {
$this->_affectedrows = $rs->affectedrows;
$this->_insertid = $rs->insertid;
$rs->databaseType='csv';
$rs->connection = &$this;
$rs->connection = $this;
}
return $rs;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved.
This is a version of the ADODB driver for DB2. It uses the 'ibm_db2' PECL extension
for PHP (http://pecl.php.net/package/ibm_db2), which in turn requires DB2 V8.2.2 or
@ -335,7 +335,7 @@ class ADODB_db2 extends ADOConnection {
if (!$rs) return false;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$rs->Close();
$arr2 = array();
for ($i=0; $i < sizeof($arr); $i++) {
@ -390,7 +390,7 @@ class ADODB_db2 extends ADOConnection {
}
function &MetaTables($ttype=false,$schema=false)
function MetaTables($ttype=false,$schema=false)
{
global $ADODB_FETCH_MODE;
@ -406,7 +406,7 @@ class ADODB_db2 extends ADOConnection {
return $false;
}
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$rs->Close();
$arr2 = array();
@ -495,7 +495,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
}
}
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;
@ -511,7 +511,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
$qid = db2_columns($this->_connectionID, "", $schema, $table, $colname);
if (empty($qid)) return $false;
$rs =& new ADORecordSet_db2($qid);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) return $false;
@ -563,7 +563,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
$qid = db2_primary_keys($this->_connectionID, "", $schema, $table);
if (empty($qid)) return $false;
$rs =& new ADORecordSet_db2($qid);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) return $retarr;
@ -719,7 +719,7 @@ class ADORecordSet_db2 extends ADORecordSet {
// returns the field object
function &FetchField($offset = -1)
function FetchField($offset = -1)
{
$o= new ADOFieldObject();
$o->name = @db2_field_name($this->_queryID,$offset);
@ -761,10 +761,10 @@ class ADORecordSet_db2 extends ADORecordSet {
}
// speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated
function &GetArrayLimit($nrows,$offset=-1)
function GetArrayLimit($nrows,$offset=-1)
{
if ($offset <= 0) {
$rs =& $this->GetArray($nrows);
$rs = $this->GetArray($nrows);
return $rs;
}
$savem = $this->fetchMode;
@ -773,7 +773,7 @@ class ADORecordSet_db2 extends ADORecordSet {
$this->fetchMode = $savem;
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
$results = array();
@ -795,7 +795,7 @@ class ADORecordSet_db2 extends ADORecordSet {
$this->fields = @db2_fetch_array($this->_queryID);
if ($this->fields) {
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}
@ -811,7 +811,7 @@ class ADORecordSet_db2 extends ADORecordSet {
$this->fields = db2_fetch_array($this->_queryID);
if ($this->fields) {
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}

View File

@ -1,6 +1,6 @@
<?php
/*
@version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
@version V5.04a 25 Mar 2008 (c) 2000-2008 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,7 +37,7 @@ class ADODB_fbsql extends ADOConnection {
return fbsql_affected_rows($this->_connectionID);
}
function &MetaDatabases()
function MetaDatabases()
{
$qid = fbsql_list_dbs($this->_connectionID);
$arr = array();
@ -80,7 +80,7 @@ class ADODB_fbsql extends ADOConnection {
return true;
}
function &MetaColumns($table)
function MetaColumns($table)
{
if ($this->metaColumnsSQL) {
@ -187,7 +187,7 @@ class ADORecordSet_fbsql extends ADORecordSet{
function &FetchField($fieldOffset = -1) {
function FetchField($fieldOffset = -1) {
if ($fieldOffset != -1) {
$o = @fbsql_fetch_field($this->_queryID, $fieldOffset);
//$o->max_length = -1; // fbsql returns the max length less spaces -- so it is unrealiable

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -44,7 +44,7 @@ class ADODB_firebird extends ADODB_ibase {
// Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars!
// SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
// SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0)
{
$nrows = (integer) $nrows;
$offset = (integer) $offset;
@ -54,9 +54,9 @@ class ADODB_firebird extends ADODB_ibase {
$sql = preg_replace('/^[ \t]*select/i',$str,$sql);
if ($secs)
$rs =& $this->CacheExecute($secs,$sql,$inputarr);
$rs = $this->CacheExecute($secs,$sql,$inputarr);
else
$rs =& $this->Execute($sql,$inputarr);
$rs = $this->Execute($sql,$inputarr);
return $rs;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -159,17 +159,17 @@ class ADODB_ibase extends ADOConnection {
// there are some compat problems with ADODB_COUNTRECS=false and $this->_logsql currently.
// it appears that ibase extension cannot support multiple concurrent queryid's
function &_Execute($sql,$inputarr=false)
function _Execute($sql,$inputarr=false)
{
global $ADODB_COUNTRECS;
if ($this->_logsql) {
$savecrecs = $ADODB_COUNTRECS;
$ADODB_COUNTRECS = true; // force countrecs
$ret =& ADOConnection::_Execute($sql,$inputarr);
$ret = ADOConnection::_Execute($sql,$inputarr);
$ADODB_COUNTRECS = $savecrecs;
} else {
$ret =& ADOConnection::_Execute($sql,$inputarr);
$ret = ADOConnection::_Execute($sql,$inputarr);
}
return $ret;
}
@ -187,7 +187,7 @@ class ADODB_ibase extends ADOConnection {
return $ret;
}
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
function MetaIndexes ($table, $primary = FALSE, $owner=false)
{
// save old fetch mode
global $ADODB_FETCH_MODE;
@ -326,7 +326,7 @@ class ADODB_ibase extends ADOConnection {
if (is_array($iarr)) {
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
$fnarr =& array_merge( array($sql) , $iarr);
$fnarr = array_merge( array($sql) , $iarr);
$ret = call_user_func_array($fn,$fnarr);
} else {
switch(sizeof($iarr)) {
@ -348,7 +348,7 @@ class ADODB_ibase extends ADOConnection {
if (is_array($iarr)) {
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
if (sizeof($iarr) == 0) $iarr[0] = ''; // PHP5 compat hack
$fnarr =& array_merge( array($conn,$sql) , $iarr);
$fnarr = array_merge( array($conn,$sql) , $iarr);
$ret = call_user_func_array($fn,$fnarr);
} else {
switch(sizeof($iarr)) {
@ -476,7 +476,7 @@ class ADODB_ibase extends ADOConnection {
}
//OPN STUFF end
// returns array of ADOFieldObjects for current table
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;
@ -743,7 +743,7 @@ class ADORecordset_ibase extends ADORecordSet
fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$ibf = ibase_field_info($this->_queryID,$fieldOffset);
@ -822,9 +822,9 @@ class ADORecordset_ibase extends ADORecordSet
$this->fields = $f;
if ($this->fetchMode == ADODB_FETCH_ASSOC) {
$this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
} else if ($this->fetchMode == ADODB_FETCH_BOTH) {
$this->fields =& array_merge($this->fields,$this->GetRowAssoc(ADODB_ASSOC_CASE));
$this->fields = array_merge($this->fields,$this->GetRowAssoc(ADODB_ASSOC_CASE));
}
return true;
}

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -147,7 +147,7 @@ class ADODB_informix72 extends ADOConnection {
}
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;
@ -199,7 +199,7 @@ class ADODB_informix72 extends ADOConnection {
return $false;
}
function &xMetaColumns($table)
function xMetaColumns($table)
{
return ADOConnection::MetaColumns($table,false);
}
@ -219,7 +219,7 @@ class ADODB_informix72 extends ADOConnection {
$rs = $this->Execute($sql);
if (!$rs || $rs->EOF) return false;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$a = array();
foreach($arr as $v) {
$coldest=$this->metaColumnNames($v["tabname"]);
@ -362,7 +362,7 @@ class ADORecordset_informix72 extends ADORecordSet {
Get column information in the Recordset object. fetchField() can be used in order to obtain information about
fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
if (empty($this->_fieldprops)) {
$fp = ifx_fieldproperties($this->_queryID);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -39,15 +39,16 @@ class ADODB_ldap extends ADOConnection {
# Options configuration information
var $LDAP_CONNECT_OPTIONS;
# error on binding, eg. "Binding: invalid credentials"
var $_bind_errmsg = "Binding: %s";
function ADODB_ldap()
{
}
// returns true or false
function _connect( $host, $username, $password, $ldapbase)
{
global $LDAP_CONNECT_OPTIONS;
@ -79,7 +80,7 @@ class ADODB_ldap extends ADOConnection {
}
if (!$bind) {
$e = sprintf($this->_bind_errmsg,ldap_error($this->_connectionID));;
$e = sprintf($this->_bind_errmsg,ldap_error($this->_connectionID));
$this->_errorMsg = $e;
if ($this->debug) ADOConnection::outp($e);
return false;
@ -152,10 +153,10 @@ class ADODB_ldap extends ADOConnection {
function _query($sql,$inputarr)
{
$rs = @ldap_search( $this->_connectionID, $this->database, $sql );
$this->_errorMsg = ($rs) ? '' : 'Search error on '.$sql.': '. ldap_error($this->_connectionID);
$this->_errorMsg = ($rs) ? '' : 'Search error on '.$sql.': '.ldap_error($this->_connectionID);
return $rs;
}
function ErrorMsg()
{
return $this->_errorMsg;
@ -165,7 +166,7 @@ class ADODB_ldap extends ADOConnection {
{
return @ldap_errno($this->_connectionID);
}
/* closes the LDAP connection */
function _close()
{
@ -323,7 +324,7 @@ class ADORecordSet_ldap extends ADORecordSet{
/*
Return whole recordset as a multi-dimensional associative array
*/
function &GetAssoc($force_array = false, $first2cols = false)
function GetAssoc($force_array = false, $first2cols = false)
{
$records = $this->_numOfRows;
$results = array();
@ -343,7 +344,7 @@ class ADORecordSet_ldap extends ADORecordSet{
return $results;
}
function &GetRowAssoc()
function GetRowAssoc()
{
$results = array();
foreach ( $this->fields as $k=>$v ) {

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -14,6 +14,7 @@ Set tabs to 4 for best viewing.
*/
// security - hide paths
if (!defined('ADODB_DIR')) die();
@ -33,11 +34,6 @@ if (!defined('ADODB_DIR')) die();
// http://support.microsoft.com/default.aspx?scid=kb;EN-US;q220918
// Alternatively use:
// CONVERT(char(12),datecol,120)
//
// Also if your month is showing as month-1,
// e.g. Jan 13, 2002 is showing as 13/0/2002, then see
// http://phplens.com/lens/lensforum/msgs.php?id=7048&x=1
// it's a localisation problem.
//----------------------------------------------------------------
@ -205,14 +201,14 @@ class ADODB_mssql extends ADOConnection {
}
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
if ($nrows > 0 && $offset <= 0) {
$sql = preg_replace(
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop." $nrows ",$sql);
$rs =& $this->Execute($sql,$inputarr);
$rs = $this->Execute($sql,$inputarr);
} else
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $rs;
}
@ -333,7 +329,7 @@ class ADODB_mssql extends ADOConnection {
}
function &MetaIndexes($table,$primary=false)
function MetaIndexes($table,$primary=false)
{
$table = $this->qstr($table);
@ -390,7 +386,7 @@ from sysforeignkeys
where upper(object_name(fkeyid)) = $table
order by constraint_name, referenced_table_name, keyno";
$constraints =& $this->GetArray($sql);
$constraints = $this->GetArray($sql);
$ADODB_FETCH_MODE = $save;
@ -436,7 +432,7 @@ order by constraint_name, referenced_table_name, keyno";
// "Stein-Aksel Basma" <basma@accelero.no>
// tested with MSSQL 2000
function &MetaPrimaryKeys($table)
function MetaPrimaryKeys($table)
{
global $ADODB_FETCH_MODE;
@ -461,14 +457,14 @@ order by constraint_name, referenced_table_name, keyno";
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr(($mask));
$this->metaTablesSQL .= " AND name like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -727,12 +723,12 @@ order by constraint_name, referenced_table_name, keyno";
}
// mssql uses a default date like Dec 30 2000 12:00AM
function UnixDate($v)
static function UnixDate($v)
{
return ADORecordSet_array_mssql::UnixDate($v);
}
function UnixTimeStamp($v)
static function UnixTimeStamp($v)
{
return ADORecordSet_array_mssql::UnixTimeStamp($v);
}
@ -804,7 +800,7 @@ class ADORecordset_mssql extends ADORecordSet {
fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
if ($fieldOffset != -1) {
$f = @mssql_fetch_field($this->_queryID, $fieldOffset);
@ -922,12 +918,12 @@ class ADORecordset_mssql extends ADORecordSet {
return $rez;
}
// mssql uses a default date like Dec 30 2000 12:00AM
function UnixDate($v)
static function UnixDate($v)
{
return ADORecordSet_array_mssql::UnixDate($v);
}
function UnixTimeStamp($v)
static function UnixTimeStamp($v)
{
return ADORecordSet_array_mssql::UnixTimeStamp($v);
}
@ -942,7 +938,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array {
}
// mssql uses a default date like Dec 30 2000 12:00AM
function UnixDate($v)
static function UnixDate($v)
{
if (is_numeric(substr($v,0,1)) && ADODB_PHPVER >= 0x4200) return parent::UnixDate($v);
@ -973,7 +969,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array {
return mktime(0,0,0,$themth,$theday,$rr[3]);
}
function UnixTimeStamp($v)
static function UnixTimeStamp($v)
{
if (is_numeric(substr($v,0,1)) && ADODB_PHPVER >= 0x4200) return parent::UnixTimeStamp($v);

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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,7 +58,7 @@ class ADODB_mysql extends ADOConnection {
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$save = $this->metaTablesSQL;
if ($showSchema && is_string($showSchema)) {
@ -69,14 +69,14 @@ class ADODB_mysql extends ADOConnection {
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
$this->metaTablesSQL = $save;
return $ret;
}
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
function MetaIndexes ($table, $primary = FALSE, $owner=false)
{
// save old fetch mode
global $ADODB_FETCH_MODE;
@ -133,7 +133,6 @@ class ADODB_mysql extends ADOConnection {
function qstr($s,$magic_quotes=false)
{
if (is_null($s)) return 'NULL';
if (!$magic_quotes) {
if (ADODB_PHPVER >= 0x4300) {
@ -160,7 +159,7 @@ class ADODB_mysql extends ADOConnection {
function GetOne($sql,$inputarr=false)
{
if ($this->compat323 == false && strncasecmp($sql,'sele',4) == 0) {
$rs =& $this->SelectLimit($sql,1,-1,$inputarr);
$rs = $this->SelectLimit($sql,1,-1,$inputarr);
if ($rs) {
$rs->Close();
if ($rs->EOF) return false;
@ -182,7 +181,7 @@ class ADODB_mysql extends ADOConnection {
return mysql_affected_rows($this->_connectionID);
}
// See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
// See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
// Reference on Last_Insert_ID on the recommended way to simulate sequences
var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
var $_genSeqSQL = "create table %s (id int not null)";
@ -230,7 +229,7 @@ class ADODB_mysql extends ADOConnection {
return $this->genID;
}
function &MetaDatabases()
function MetaDatabases()
{
$qid = mysql_list_dbs($this->_connectionID);
$arr = array();
@ -395,7 +394,7 @@ class ADODB_mysql extends ADOConnection {
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
}
function &MetaColumns($table)
function MetaColumns($table)
{
$this->_findschema($table,$schema);
if ($schema) {
@ -449,9 +448,9 @@ class ADODB_mysql extends ADOConnection {
$fld->primary_key = ($rs->fields[3] == 'PRI');
$fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false);
$fld->binary = (strpos($type,'blob') !== false);
$fld->unsigned = (strpos($type,'unsigned') !== false);
$fld->unsigned = (strpos($type,'unsigned') !== false);
$fld->zerofill = (strpos($type,'zerofill') !== false);
if (!$fld->binary) {
$d = $rs->fields[4];
if ($d != '' && $d != 'NULL') {
@ -486,16 +485,16 @@ class ADODB_mysql extends ADOConnection {
}
// parameters use PostgreSQL convention, not MySQL
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
{
$offsetStr =($offset>=0) ? ((integer)$offset)."," : '';
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
if ($nrows < 0) $nrows = '18446744073709551615';
if ($secs)
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr".((integer)$nrows),$inputarr);
$rs = $this->CacheExecute($secs,$sql." LIMIT $offsetStr".((integer)$nrows),$inputarr);
else
$rs =& $this->Execute($sql." LIMIT $offsetStr".((integer)$nrows),$inputarr);
$rs = $this->Execute($sql." LIMIT $offsetStr".((integer)$nrows),$inputarr);
return $rs;
}
@ -631,28 +630,28 @@ class ADORecordSet_mysql extends ADORecordSet{
$this->_numOfFields = @mysql_num_fields($this->_queryID);
}
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
if ($fieldOffset != -1) {
$o = @mysql_fetch_field($this->_queryID, $fieldOffset);
$f = @mysql_field_flags($this->_queryID,$fieldOffset);
$o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); // suggested by: Jim Nicholson (jnich#att.com)
if ($o) $o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); // suggested by: Jim Nicholson (jnich#att.com)
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
$o->binary = (strpos($f,'binary')!== false);
if ($o) $o->binary = (strpos($f,'binary')!== false);
}
else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */
$o = @mysql_fetch_field($this->_queryID);
$o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich#att.com)
if ($o) $o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich#att.com)
//$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable
}
return $o;
}
function &GetRowAssoc($upper=true)
function GetRowAssoc($upper=true)
{
if ($this->fetchMode == MYSQL_ASSOC && !$upper) $row = $this->fields;
else $row =& ADORecordSet::GetRowAssoc($upper);
else $row = ADORecordSet::GetRowAssoc($upper);
return $row;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -144,7 +144,7 @@ class ADODB_mysqli extends ADOConnection {
function GetOne($sql,$inputarr=false)
{
$ret = false;
$rs = &$this->Execute($sql,$inputarr);
$rs = $this->Execute($sql,$inputarr);
if ($rs) {
if (!$rs->EOF) $ret = reset($rs->fields);
$rs->Close();
@ -198,7 +198,7 @@ class ADODB_mysqli extends ADOConnection {
{
if ($this->transCnt==0) $this->BeginTrans();
if ($where) $where = ' where '.$where;
$rs =& $this->Execute("select $flds from $tables $where for update");
$rs = $this->Execute("select $flds from $tables $where for update");
return !empty($rs);
}
@ -251,6 +251,7 @@ class ADODB_mysqli extends ADOConnection {
// Reference on Last_Insert_ID on the recommended way to simulate sequences
var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
var $_genSeqSQL = "create table %s (id int not null)";
var $_genSeqCountSQL = "select count(*) from %s";
var $_genSeq2SQL = "insert into %s values (%s)";
var $_dropSeqSQL = "drop table %s";
@ -290,10 +291,10 @@ class ADODB_mysqli extends ADOConnection {
return $this->genID;
}
function &MetaDatabases()
function MetaDatabases()
{
$query = "SHOW DATABASES";
$ret =& $this->Execute($query);
$ret = $this->Execute($query);
if ($ret && is_object($ret)){
$arr = array();
while (!$ret->EOF){
@ -307,7 +308,7 @@ class ADODB_mysqli extends ADOConnection {
}
function &MetaIndexes ($table, $primary = FALSE)
function MetaIndexes ($table, $primary = FALSE)
{
// save old fetch mode
global $ADODB_FETCH_MODE;
@ -462,7 +463,7 @@ class ADODB_mysqli extends ADOConnection {
// return "from_unixtime(unix_timestamp($date)+$fraction)";
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$save = $this->metaTablesSQL;
if ($showSchema && is_string($showSchema)) {
@ -473,7 +474,7 @@ class ADODB_mysqli extends ADOConnection {
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
$this->metaTablesSQL = $save;
return $ret;
@ -521,7 +522,7 @@ class ADODB_mysqli extends ADOConnection {
return $foreign_keys;
}
function &MetaColumns($table)
function MetaColumns($table)
{
$false = false;
if (!$this->metaColumnsSQL)
@ -610,7 +611,7 @@ class ADODB_mysqli extends ADOConnection {
}
// parameters use PostgreSQL convention, not MySQL
function &SelectLimit($sql,
function SelectLimit($sql,
$nrows = -1,
$offset = -1,
$inputarr = false,
@ -620,9 +621,9 @@ class ADODB_mysqli extends ADOConnection {
if ($nrows < 0) $nrows = '18446744073709551615';
if ($secs)
$rs =& $this->CacheExecute($secs, $sql . " LIMIT $offsetStr$nrows" , $inputarr);
$rs = $this->CacheExecute($secs, $sql . " LIMIT $offsetStr$nrows" , $inputarr );
else
$rs =& $this->Execute($sql . " LIMIT $offsetStr$nrows" , $inputarr);
$rs = $this->Execute($sql . " LIMIT $offsetStr$nrows" , $inputarr );
return $rs;
}
@ -816,7 +817,7 @@ class ADORecordSet_mysqli extends ADORecordSet{
131072 = MYSQLI_BINCMP_FLAG
*/
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$fieldnr = $fieldOffset;
if ($fieldOffset != -1) {
@ -834,11 +835,11 @@ class ADORecordSet_mysqli extends ADORecordSet{
return $o;
}
function &GetRowAssoc($upper = true)
function GetRowAssoc($upper = true)
{
if ($this->fetchMode == MYSQLI_ASSOC && !$upper)
return $this->fields;
$row =& ADORecordSet::GetRowAssoc($upper);
$row = ADORecordSet::GetRowAssoc($upper);
return $row;
}
@ -1027,12 +1028,12 @@ class ADORecordSet_mysqli extends ADORecordSet{
}
class ADORecordSet_array_mysqli extends ADORecordSet_array {
function ADORecordSet_array_mysqli($id=-1,$mode=false)
{
$this->ADORecordSet_array($id,$mode);
}
function MetaType($t, $len = -1, $fieldobj = false)
{
if (is_object($t)) {
@ -1130,4 +1131,4 @@ class ADORecordSet_array_mysqli extends ADORecordSet_array {
}
?>
?>

View File

@ -0,0 +1,138 @@
<?php
/*
V5.04a 25 Mar 2008 (c) 2000-2008 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.
Set tabs to 8.
MySQL code that supports transactions. For MySQL 3.23 or later.
Code from James Poon <jpoon88@yahoo.com>
Requires mysql client. Works on Windows and Unix.
*/
// security - hide paths
if (!defined('ADODB_DIR')) die();
include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");
class ADODB_mysqlt extends ADODB_mysql {
var $databaseType = 'mysqlt';
var $ansiOuter = true; // for Version 3.23.17 or later
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;
$this->transCnt += 1;
$this->Execute('SET AUTOCOMMIT=0');
$this->Execute('BEGIN');
return true;
}
function CommitTrans($ok=true)
{
if ($this->transOff) return true;
if (!$ok) return $this->RollbackTrans();
if ($this->transCnt) $this->transCnt -= 1;
$this->Execute('COMMIT');
$this->Execute('SET AUTOCOMMIT=1');
return true;
}
function RollbackTrans()
{
if ($this->transOff) return true;
if ($this->transCnt) $this->transCnt -= 1;
$this->Execute('ROLLBACK');
$this->Execute('SET AUTOCOMMIT=1');
return true;
}
function RowLock($tables,$where='',$flds='1 as adodb_ignore')
{
if ($this->transCnt==0) $this->BeginTrans();
if ($where) $where = ' where '.$where;
$rs = $this->Execute("select $flds from $tables $where for update");
return !empty($rs);
}
}
class ADORecordSet_mysqlt extends ADORecordSet_mysql{
var $databaseType = "mysqlt";
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;
case ADODB_FETCH_DEFAULT:
case ADODB_FETCH_BOTH:
default: $this->fetchMode = MYSQL_BOTH; break;
}
$this->adodbFetchMode = $mode;
$this->ADORecordSet($queryID);
}
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_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;
case ADODB_FETCH_DEFAULT:
case ADODB_FETCH_BOTH:
default:
$this->fetchMode = MYSQL_BOTH; break;
}
$this->adodbFetchMode = $mode;
$this->ADORecordSet($queryID);
}
function MoveNext()
{
return adodb_movenext($this);
}
}
?>

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -80,7 +80,7 @@ class ADODB_mysqlt extends ADODB_mysql {
{
if ($this->transCnt==0) $this->BeginTrans();
if ($where) $where = ' where '.$where;
$rs =& $this->Execute("select $flds from $tables $where for update");
$rs = $this->Execute("select $flds from $tables $where for update");
return !empty($rs);
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -53,7 +53,7 @@ class ADODB_netezza extends ADODB_postgres64 {
}
function &MetaColumns($table,$upper=true)
function MetaColumns($table,$upper=true)
{
// Changed this function to support Netezza which has no concept of keys
@ -67,7 +67,7 @@ class ADODB_netezza extends ADODB_postgres64 {
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
$rs =& $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
$rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;

View File

@ -1,7 +1,7 @@
<?php
/*
version V4.98 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved.
version V5.04a 25 Mar 2008 (c) 2000-2008 John Lim. All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@ -83,11 +83,11 @@ class ADODB_oci8 extends ADOConnection {
var $firstrows = true; // enable first rows optimization on SelectLimit()
var $selectOffsetAlg1 = 100; // when to use 1st algorithm of selectlimit.
var $NLS_DATE_FORMAT = 'YYYY-MM-DD'; // To include time, use 'RRRR-MM-DD HH24:MI:SS'
var $dateformat = 'YYYY-MM-DD'; // for DBDate()
var $dateformat = 'YYYY-MM-DD'; // DBDate format
var $useDBDateFormatForTextInput=false;
var $datetime = false; // MetaType('DATE') returns 'D' (datetime==false) or 'T' (datetime == true)
var $_refLOBs = array();
// var $ansiOuter = true; // if oracle9
function ADODB_oci8()
@ -96,8 +96,8 @@ class ADODB_oci8 extends ADOConnection {
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
}
/* Function &MetaColumns($table) added by smondino@users.sourceforge.net*/
function &MetaColumns($table)
/* function MetaColumns($table) added by smondino@users.sourceforge.net*/
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;
@ -141,7 +141,7 @@ class ADODB_oci8 extends ADOConnection {
function Time()
{
$rs =& $this->Execute("select TO_CHAR($this->sysTimeStamp,'YYYY-MM-DD HH24:MI:SS') from dual");
$rs = $this->Execute("select TO_CHAR($this->sysTimeStamp,'YYYY-MM-DD HH24:MI:SS') from dual");
if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
return false;
@ -310,14 +310,14 @@ NATSOFT.DOMAIN =
return $this->GetOne("select $flds from $tables where $where for update");
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr(strtoupper($mask));
$this->metaTablesSQL .= " AND upper(table_name) like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -326,7 +326,7 @@ NATSOFT.DOMAIN =
}
// Mark Newnham
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
function MetaIndexes ($table, $primary = FALSE, $owner=false)
{
// save old fetch mode
global $ADODB_FETCH_MODE;
@ -563,7 +563,7 @@ NATSOFT.DOMAIN =
This implementation does not appear to work with oracle 8.0.5 or earlier. Comment
out this function then, and the slower SelectLimit() in the base class will be used.
*/
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
// seems that oracle only supports 1 hint comment in 8i
if ($this->firstrows) {
@ -573,7 +573,7 @@ NATSOFT.DOMAIN =
$sql = preg_replace('/^[ \t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql);
}
if ($offset < $this->selectOffsetAlg1 && 0 < $nrows && $nrows < 1000) {
if ($offset < $this->selectOffsetAlg1 && 0 < $nrows && $nrows < 1000) {
if ($nrows > 0) {
if ($offset > 0) $nrows += $offset;
//$inputarr['adodb_rownum'] = $nrows;
@ -587,7 +587,7 @@ NATSOFT.DOMAIN =
}
// note that $nrows = 0 still has to work ==> no rows returned
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $rs;
} else {
@ -651,8 +651,8 @@ NATSOFT.DOMAIN =
$inputarr['adodb_nrows'] = $nrows;
$inputarr['adodb_offset'] = $offset;
if ($secs2cache>0) $rs =& $this->CacheExecute($secs2cache, $sql,$inputarr);
else $rs =& $this->Execute($sql,$inputarr);
if ($secs2cache>0) $rs = $this->CacheExecute($secs2cache, $sql,$inputarr);
else $rs = $this->Execute($sql,$inputarr);
return $rs;
}
@ -745,17 +745,19 @@ NATSOFT.DOMAIN =
* @param [inputarr] holds the input data to bind to. Null elements will be set to null.
* @return RecordSet or false
*/
function &Execute($sql,$inputarr=false)
function Execute($sql,$inputarr=false)
{
if ($this->fnExecute) {
$fn = $this->fnExecute;
$ret =& $fn($this,$sql,$inputarr);
$ret = $fn($this,$sql,$inputarr);
if (isset($ret)) return $ret;
}
if ($inputarr) {
#if (!is_array($inputarr)) $inputarr = array($inputarr);
$element0 = reset($inputarr);
if (!$this->_bindInputArray) {
# is_object check because oci8 descriptors can be passed in
if (is_array($element0) && !is_object(reset($element0))) {
if (is_string($sql))
@ -764,15 +766,48 @@ NATSOFT.DOMAIN =
$stmt = $sql;
foreach($inputarr as $arr) {
$ret =& $this->_Execute($stmt,$arr);
$ret = $this->_Execute($stmt,$arr);
if (!$ret) return $ret;
}
} else {
$ret =& $this->_Execute($sql,$inputarr);
$sqlarr = explode(':',$sql);
$sql = '';
$lastnomatch = -2;
#var_dump($sqlarr);echo "<hr>";var_dump($inputarr);echo"<hr>";
foreach($sqlarr as $k => $str) {
if ($k == 0) { $sql = $str; continue; }
// we need $lastnomatch because of the following datetime,
// eg. '10:10:01', which causes code to think that there is bind param :10 and :1
$ok = preg_match('/^([0-9]*)/', $str, $arr);
if (!$ok) $sql .= $str;
else {
$at = $arr[1];
if (isset($inputarr[$at]) || is_null($inputarr[$at])) {
if ((strlen($at) == strlen($str) && $k < sizeof($arr)-1)) {
$sql .= ':'.$str;
$lastnomatch = $k;
} else if ($lastnomatch == $k-1) {
$sql .= ':'.$str;
} else {
if (is_null($inputarr[$at])) $sql .= 'null';
else $sql .= $this->qstr($inputarr[$at]);
$sql .= substr($str, strlen($at));
}
} else {
$sql .= ':'.$str;
}
}
}
$inputarr = false;
}
}
$ret = $this->_Execute($sql,$inputarr);
} else {
$ret =& $this->_Execute($sql,false);
$ret = $this->_Execute($sql,false);
}
return $ret;
@ -823,7 +858,7 @@ NATSOFT.DOMAIN =
array('VAR1' => 'Mr Bean'));
*/
function &ExecuteCursor($sql,$cursorName='rs',$params=false)
function ExecuteCursor($sql,$cursorName='rs',$params=false)
{
if (is_array($sql)) $stmt = $sql;
else $stmt = ADODB_oci8::Prepare($sql,true); # true to allocate OCINewCursor
@ -840,7 +875,7 @@ NATSOFT.DOMAIN =
} else
$hasref = false;
$rs =& $this->Execute($stmt);
$rs = $this->Execute($stmt);
if ($rs) {
if ($rs->databaseType == 'array') OCIFreeCursor($stmt[4]);
else if ($hasref) $rs->_refcursor = $stmt[4];
@ -900,7 +935,7 @@ NATSOFT.DOMAIN =
$this->_refLOBs[$numlob]['LOB'] = OCINewDescriptor($this->_connectionID, oci_lob_desc($type));
$this->_refLOBs[$numlob]['TYPE'] = $isOutput;
$tmp = &$this->_refLOBs[$numlob]['LOB'];
$tmp = $this->_refLOBs[$numlob]['LOB'];
$rez = OCIBindByName($stmt[1], ":".$name, $tmp, -1, $type);
if ($this->debug) {
ADOConnection::outp("<b>Bind</b>: descriptor has been allocated, var (".$name.") binded");
@ -910,12 +945,12 @@ NATSOFT.DOMAIN =
if ($isOutput == false) {
$var = $this->BlobEncode($var);
$tmp->WriteTemporary($var);
$this->_refLOBs[$numlob]['VAR'] = &$var;
$this->_refLOBs[$numlob]['VAR'] = $var;
if ($this->debug) {
ADOConnection::outp("<b>Bind</b>: LOB has been written to temp");
}
} else {
$this->_refLOBs[$numlob]['VAR'] = &$var;
$this->_refLOBs[$numlob]['VAR'] = $var;
}
$rez = $tmp;
} else {
@ -986,7 +1021,7 @@ NATSOFT.DOMAIN =
$bindpos = $sql[3];
if (isset($this->_bind[$bindpos])) {
// all tied up already
$bindarr = &$this->_bind[$bindpos];
$bindarr = $this->_bind[$bindpos];
} else {
// one statement to bind them all
$bindarr = array();
@ -994,7 +1029,7 @@ NATSOFT.DOMAIN =
$bindarr[$k] = $v;
OCIBindByName($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 : 4000);
}
$this->_bind[$bindpos] = &$bindarr;
$this->_bind[$bindpos] = $bindarr;
}
}
} else {
@ -1014,7 +1049,13 @@ NATSOFT.DOMAIN =
else
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
if ($this->debug==99) echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'<br>';
if ($this->debug==99) {
if (is_object($v[0]))
echo "name=:$k",' len='.$v[1],' type='.$v[2],'<br>';
else
echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'<br>';
}
} else {
$len = -1;
if ($v === ' ') $len = 1;
@ -1123,7 +1164,7 @@ SELECT /*+ RULE */ distinct b.column_name
$rs = $this->Execute($sql);
if ($rs && !$rs->EOF) {
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$a = array();
foreach($arr as $v) {
$a[] = reset($v);
@ -1154,7 +1195,7 @@ SELECT /*+ RULE */ distinct b.column_name
from {$tabp}constraints
where constraint_type = 'R' and table_name = $table $owner";
$constraints =& $this->GetArray($sql);
$constraints = $this->GetArray($sql);
$arr = false;
foreach($constraints as $constr) {
$cons = $this->qstr($constr[0]);
@ -1319,7 +1360,7 @@ class ADORecordset_oci8 extends ADORecordSet {
}
/* For some reason, OCIcolumnname fails when called after _initrs() so we cache it */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
return $this->_fieldobjs[$fieldOffset];
}
@ -1357,7 +1398,7 @@ class ADORecordset_oci8 extends ADORecordSet {
/*
# does not work as first record is retrieved in _initrs(), so is not included in GetArray()
function &GetArray($nRows = -1)
function GetArray($nRows = -1)
{
global $ADODB_OCI8_GETARRAY;
@ -1376,7 +1417,7 @@ class ADORecordset_oci8 extends ADORecordSet {
if (ADODB_ASSOC_CASE != 2 || $this->databaseType != 'oci8') break;
$ncols = @OCIfetchstatement($this->_queryID, $assoc, 0, $nRows, OCI_FETCHSTATEMENT_BY_ROW);
$results =& array_merge(array($this->fields),$assoc);
$results = array_merge(array($this->fields),$assoc);
return $results;
default:
@ -1384,16 +1425,16 @@ class ADORecordset_oci8 extends ADORecordSet {
}
}
$results =& ADORecordSet::GetArray($nRows);
$results = ADORecordSet::GetArray($nRows);
return $results;
} */
/* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto() */
function &GetArrayLimit($nrows,$offset=-1)
function GetArrayLimit($nrows,$offset=-1)
{
if ($offset <= 0) {
$arr =& $this->GetArray($nrows);
$arr = $this->GetArray($nrows);
return $arr;
}
$arr = array();

View File

@ -1,6 +1,6 @@
<?php
/**
* @version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
* @version V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -26,7 +26,7 @@ class ADODB_oci805 extends ADODB_oci8 {
$this->ADODB_oci8();
}
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
// seems that oracle only supports 1 hint comment in 8i
if (strpos($sql,'/*+') !== false)

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -98,7 +98,7 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
}
// lowercase field names...
function &_FetchField($fieldOffset = -1)
function _FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$fieldOffset += 1;
@ -149,7 +149,7 @@ class ADORecordset_oci8po extends ADORecordset_oci8 {
}
/* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto() */
function &GetArrayLimit($nrows,$offset=-1)
function GetArrayLimit($nrows,$offset=-1)
{
if ($offset <= 0) {
$arr = $this->GetArray($nrows);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -252,7 +252,7 @@ class ADODB_odbc extends ADOConnection {
if (!$rs) return false;
$rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$rs->Close();
//print_r($arr);
$arr2 = array();
@ -264,7 +264,7 @@ class ADODB_odbc extends ADOConnection {
function &MetaTables($ttype=false)
function MetaTables($ttype=false)
{
global $ADODB_FETCH_MODE;
@ -281,7 +281,7 @@ class ADODB_odbc extends ADOConnection {
}
$rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
//print_r($arr);
$rs->Close();
@ -370,7 +370,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
}
}
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;
@ -422,7 +422,7 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
}
if (empty($qid)) return $false;
$rs =& new ADORecordSet_odbc($qid);
$rs = new ADORecordSet_odbc($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) return $false;
@ -614,7 +614,7 @@ class ADORecordSet_odbc extends ADORecordSet {
// returns the field object
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$off=$fieldOffset+1; // offsets begin at 1
@ -661,10 +661,10 @@ class ADORecordSet_odbc extends ADORecordSet {
}
// speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated
function &GetArrayLimit($nrows,$offset=-1)
function GetArrayLimit($nrows,$offset=-1)
{
if ($offset <= 0) {
$rs =& $this->GetArray($nrows);
$rs = $this->GetArray($nrows);
return $rs;
}
$savem = $this->fetchMode;
@ -673,7 +673,7 @@ class ADORecordSet_odbc extends ADORecordSet {
$this->fetchMode = $savem;
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
$results = array();
@ -700,7 +700,7 @@ class ADORecordSet_odbc extends ADORecordSet {
}
if ($rez) {
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}
@ -721,7 +721,7 @@ class ADORecordSet_odbc extends ADORecordSet {
}
if ($rez) {
if ($this->fetchMode & ADODB_FETCH_ASSOC) {
$this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE);
$this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE);
}
return true;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -140,7 +140,7 @@ class ADODB_ODBC_DB2 extends ADODB_odbc {
return $this->GetOne("select $flds from $tables where $where for update");
}
function &MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%")
function MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%")
{
global $ADODB_FETCH_MODE;
@ -157,7 +157,7 @@ class ADODB_ODBC_DB2 extends ADODB_odbc {
}
$rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
//print_r($arr);
$rs->Close();
@ -184,7 +184,7 @@ class ADODB_ODBC_DB2 extends ADODB_odbc {
return $arr2;
}
function &MetaIndexes ($table, $primary = FALSE, $owner=false)
function MetaIndexes ($table, $primary = FALSE, $owner=false)
{
// save old fetch mode
global $ADODB_FETCH_MODE;
@ -278,20 +278,20 @@ class ADODB_ODBC_DB2 extends ADODB_odbc {
}
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false)
{
$nrows = (integer) $nrows;
if ($offset <= 0) {
// could also use " OPTIMIZE FOR $nrows ROWS "
if ($nrows >= 0) $sql .= " FETCH FIRST $nrows ROWS ONLY ";
$rs =& $this->Execute($sql,$inputArr);
$rs = $this->Execute($sql,$inputArr);
} else {
if ($offset > 0 && $nrows < 0);
else {
$nrows += $offset;
$sql .= " FETCH FIRST $nrows ROWS ONLY ";
}
$rs =& ADOConnection::SelectLimit($sql,-1,$offset,$inputArr);
$rs = ADOConnection::SelectLimit($sql,-1,$offset,$inputArr);
}
return $rs;

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -93,7 +93,7 @@ from sysforeignkeys
where upper(object_name(fkeyid)) = $table
order by constraint_name, referenced_table_name, keyno";
$constraints =& $this->GetArray($sql);
$constraints = $this->GetArray($sql);
$ADODB_FETCH_MODE = $save;
@ -115,14 +115,14 @@ order by constraint_name, referenced_table_name, keyno";
return $arr2;
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
if ($mask) {$this->debug=1;
$save = $this->metaTablesSQL;
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " AND name like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -130,14 +130,14 @@ order by constraint_name, referenced_table_name, keyno";
return $ret;
}
function &MetaColumns($table)
function MetaColumns($table)
{
$arr = ADOConnection::MetaColumns($table);
return $arr;
}
function &MetaIndexes($table,$primary=false)
function MetaIndexes($table,$primary=false)
{
$table = $this->qstr($table);
@ -196,7 +196,7 @@ order by constraint_name, referenced_table_name, keyno";
// "Stein-Aksel Basma" <basma@accelero.no>
// tested with MSSQL 2000
function &MetaPrimaryKeys($table)
function MetaPrimaryKeys($table)
{
global $ADODB_FETCH_MODE;
@ -220,14 +220,14 @@ order by constraint_name, referenced_table_name, keyno";
return $false;
}
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
if ($nrows > 0 && $offset <= 0) {
$sql = preg_replace(
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop." $nrows ",$sql);
$rs =& $this->Execute($sql,$inputarr);
$rs = $this->Execute($sql,$inputarr);
} else
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $rs;
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -36,7 +36,7 @@ class ADODB_odbc_oracle extends ADODB_odbc {
$this->ADODB_odbc();
}
function &MetaTables()
function MetaTables()
{
$false = false;
$rs = $this->Execute($this->metaTablesSQL);
@ -50,7 +50,7 @@ class ADODB_odbc_oracle extends ADODB_odbc {
return $arr2;
}
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -273,7 +273,7 @@ class ADODB_odbtp extends ADOConnection{
return true;
}
function &MetaTables($ttype='',$showSchema=false,$mask=false)
function MetaTables($ttype='',$showSchema=false,$mask=false)
{
global $ADODB_FETCH_MODE;
@ -281,7 +281,7 @@ class ADODB_odbtp extends ADOConnection{
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savefm = $this->SetFetchMode(false);
$arr =& $this->GetArray("||SQLTables||||$ttype");
$arr = $this->GetArray("||SQLTables||||$ttype");
if (isset($savefm)) $this->SetFetchMode($savefm);
$ADODB_FETCH_MODE = $savem;
@ -295,7 +295,7 @@ class ADODB_odbtp extends ADOConnection{
return $arr2;
}
function &MetaColumns($table,$upper=true)
function MetaColumns($table,$upper=true)
{
global $ADODB_FETCH_MODE;
@ -341,13 +341,13 @@ class ADODB_odbtp extends ADOConnection{
return $retarr;
}
function &MetaPrimaryKeys($table, $owner='')
function MetaPrimaryKeys($table, $owner='')
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$arr =& $this->GetArray("||SQLPrimaryKeys||$owner|$table");
$arr = $this->GetArray("||SQLPrimaryKeys||$owner|$table");
$ADODB_FETCH_MODE = $savem;
//print_r($arr);
@ -358,13 +358,13 @@ class ADODB_odbtp extends ADOConnection{
return $arr2;
}
function &MetaForeignKeys($table, $owner='', $upper=false)
function MetaForeignKeys($table, $owner='', $upper=false)
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$constraints =& $this->GetArray("||SQLForeignKeys|||||$owner|$table");
$constraints = $this->GetArray("||SQLForeignKeys|||||$owner|$table");
$ADODB_FETCH_MODE = $savem;
$arr = false;
@ -424,13 +424,13 @@ class ADODB_odbtp extends ADOConnection{
return $ret;
}
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
// TOP requires ORDER BY for Visual FoxPro
if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) {
if (!preg_match('/ORDER[ \t\r\n]+BY/is',$sql)) $sql .= ' ORDER BY 1';
}
$ret =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $ret;
}
@ -602,7 +602,7 @@ class ADORecordSet_odbtp extends ADORecordSet {
}
}
function &FetchField($fieldOffset = 0)
function FetchField($fieldOffset = 0)
{
$off=$fieldOffset; // offsets begin at 0
$o= new ADOFieldObject();

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -248,7 +248,7 @@ class ADORecordset_oracle extends ADORecordSet {
fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$fld->name = ora_columnname($this->_queryID, $fieldOffset);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -64,6 +64,9 @@ function adodb_pdo_type($t)
class ADODB_pdo extends ADOConnection {
var $databaseType = "pdo";
var $dataProvider = "pdo";
@ -89,7 +92,7 @@ class ADODB_pdo extends ADOConnection {
function _UpdatePDO()
{
$d = &$this->_driver;
$d = $this->_driver;
$this->fmtDate = $d->fmtDate;
$this->fmtTimeStamp = $d->fmtTimeStamp;
$this->replaceQuote = $d->replaceQuote;
@ -112,7 +115,7 @@ class ADODB_pdo extends ADOConnection {
if (!empty($this->_driver->_hasdual)) $sql = "select $this->sysTimeStamp from dual";
else $sql = "select $this->sysTimeStamp";
$rs =& $this->_Execute($sql);
$rs = $this->_Execute($sql);
if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
return false;
@ -355,8 +358,6 @@ class ADODB_pdo extends ADOConnection {
}
}
class ADODB_pdo_base extends ADODB_pdo {
var $sysDate = "'?'";
@ -391,7 +392,6 @@ class ADODB_pdo_base extends ADODB_pdo {
}
}
class ADOPDOStatement {
var $databaseType = "pdo";
@ -508,7 +508,7 @@ class ADORecordSet_pdo extends ADORecordSet {
}
// returns the field object
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$off=$fieldOffset+1; // offsets begin at 1

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -18,7 +18,7 @@ class ADODB_pdo_mysql extends ADODB_pdo {
var $hasGenID = true;
var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);";
var $_dropSeqSQL = "drop table %s";
var $nameQuote = '`';
function _init($parentDriver)
@ -48,7 +48,7 @@ class ADODB_pdo_mysql extends ADODB_pdo {
return $arr;
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$save = $this->metaTablesSQL;
if ($showSchema && is_string($showSchema)) {
@ -59,7 +59,7 @@ class ADODB_pdo_mysql extends ADODB_pdo {
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
$this->metaTablesSQL = $save;
return $ret;
@ -76,7 +76,7 @@ class ADODB_pdo_mysql extends ADODB_pdo {
$this->Execute("SET SESSION TRANSACTION ".$transaction_mode);
}
function &MetaColumns($table)
function MetaColumns($table)
{
$this->_findschema($table,$schema);
if ($schema) {
@ -156,16 +156,16 @@ class ADODB_pdo_mysql extends ADODB_pdo {
// parameters use PostgreSQL convention, not MySQL
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
{
$offsetStr =($offset>=0) ? "$offset," : '';
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
if ($nrows < 0) $nrows = '18446744073709551615';
if ($secs)
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr);
$rs = $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr);
else
$rs =& $this->Execute($sql." LIMIT $offsetStr$nrows",$inputarr);
$rs = $this->Execute($sql." LIMIT $offsetStr$nrows",$inputarr);
return $rs;
}
}

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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,14 +32,14 @@ class ADODB_pdo_oci extends ADODB_pdo_base {
}
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr(strtoupper($mask));
$this->metaTablesSQL .= " AND table_name like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -47,7 +47,7 @@ class ADODB_pdo_oci extends ADODB_pdo_base {
return $ret;
}
function &MetaColumns($table)
function MetaColumns($table)
{
global $ADODB_FETCH_MODE;

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -69,19 +69,19 @@ WHERE relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s'))
return $arr;
}
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : '';
if ($secs2cache)
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
else
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
return $rs;
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$info = $this->ServerInfo();
if ($info['version'] >= 7.3) {
@ -104,7 +104,7 @@ select tablename,'T' from pg_tables where tablename like $mask
union
select viewname,'V' from pg_views where viewname like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -112,7 +112,7 @@ select viewname,'V' from pg_views where viewname like $mask";
return $ret;
}
function &MetaColumns($table,$normalize=true)
function MetaColumns($table,$normalize=true)
{
global $ADODB_FETCH_MODE;
@ -125,8 +125,8 @@ select viewname,'V' from pg_views where viewname like $mask";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
if ($schema) $rs =& $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
else $rs =& $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
if ($schema) $rs = $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
else $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
@ -144,7 +144,7 @@ select viewname,'V' from pg_views where viewname like $mask";
$rskey = $this->Execute(sprintf($this->metaKeySQL,($table)));
// fetch all result in once for performance.
$keys =& $rskey->GetArray();
$keys = $rskey->GetArray();
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -201,7 +201,7 @@ a different OID if a database must be reloaded. */
return @pg_Exec($this->_connectionID, "rollback");
}
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$info = $this->ServerInfo();
if ($info['version'] >= 7.3) {
@ -224,7 +224,7 @@ select tablename,'T' from pg_tables where tablename like $mask
union
select viewname,'V' from pg_views where viewname like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
$ret = ADOConnection::MetaTables($ttype,$showSchema);
if ($mask) {
$this->metaTablesSQL = $save;
@ -464,7 +464,7 @@ 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
// see http://phplens.com/lens/lensforum/msgs.php?id=14018 for more info
function &MetaColumns($table,$normalize=true)
function MetaColumns($table,$normalize=true)
{
global $ADODB_FETCH_MODE;
@ -478,8 +478,8 @@ select viewname,'V' from pg_views where viewname like $mask";
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
if ($schema) $rs =& $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
else $rs =& $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
if ($schema) $rs = $this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
else $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
@ -496,7 +496,7 @@ select viewname,'V' from pg_views where viewname like $mask";
$rskey = $this->Execute(sprintf($this->metaKeySQL,($table)));
// fetch all result in once for performance.
$keys =& $rskey->GetArray();
$keys = $rskey->GetArray();
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
@ -578,7 +578,7 @@ select viewname,'V' from pg_views where viewname like $mask";
}
function &MetaIndexes ($table, $primary = FALSE)
function MetaIndexes ($table, $primary = FALSE)
{
global $ADODB_FETCH_MODE;
@ -886,10 +886,10 @@ class ADORecordSet_postgres64 extends ADORecordSet{
$this->ADORecordSet($queryID);
}
function &GetRowAssoc($upper=true)
function GetRowAssoc($upper=true)
{
if ($this->fetchMode == PGSQL_ASSOC && !$upper) return $this->fields;
$row =& ADORecordSet::GetRowAssoc($upper);
$row = ADORecordSet::GetRowAssoc($upper);
return $row;
}
@ -925,7 +925,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{
return $this->fields[$this->bind[strtoupper($colname)]];
}
function &FetchField($off = 0)
function FetchField($off = 0)
{
// offsets begin at 0

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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,14 +34,14 @@ class ADODB_postgres7 extends ADODB_postgres64 {
// the following should be compat with postgresql 7.2,
// which makes obsolete the LIMIT limit,offset syntax
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : '';
$limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : '';
if ($secs2cache)
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
else
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
return $rs;
}
@ -72,11 +72,11 @@ class ADODB_postgres7 extends ADODB_postgres64 {
ORDER BY
t.tgrelid';
$rs =& $this->Execute($sql);
$rs = $this->Execute($sql);
if (!$rs || $rs->EOF) return false;
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$a = array();
foreach($arr as $v) {
$data = explode(chr(0), $v['args']);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -53,7 +53,7 @@ class ADODB_SAPDB extends ADODB_odbc {
return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos");
}
function &MetaIndexes ($table, $primary = FALSE)
function MetaIndexes ($table, $primary = FALSE)
{
$table = $this->Quote(strtoupper($table));
@ -92,7 +92,7 @@ class ADODB_SAPDB extends ADODB_odbc {
return $indexes;
}
function &MetaColumns ($table)
function MetaColumns ($table)
{
global $ADODB_FETCH_MODE;
$save = $ADODB_FETCH_MODE;

View File

@ -1,6 +1,6 @@
<?php
/*
version V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights
version V5.04a 25 Mar 2008 (c) 2000-2008 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,

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -78,7 +78,7 @@ class ADODB_sqlite extends ADOConnection {
}
// mark newnham
function &MetaColumns($tab)
function MetaColumns($tab)
{
global $ADODB_FETCH_MODE;
$false = false;
@ -190,14 +190,14 @@ class ADODB_sqlite extends ADOConnection {
return $rez;
}
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ($offset >= 0 ? ' LIMIT 999999999' : '');
if ($secs2cache)
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
$rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
else
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
$rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr);
return $rs;
}
@ -261,7 +261,7 @@ class ADODB_sqlite extends ADOConnection {
return @sqlite_close($this->_connectionID);
}
function &MetaIndexes($table, $primary = FALSE, $owner=false)
function MetaIndexes($table, $primary = FALSE, $owner=false)
{
$false = false;
// save old fetch mode
@ -350,7 +350,7 @@ class ADORecordset_sqlite extends ADORecordSet {
}
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject;
$fld->name = sqlite_field_name($this->_queryID, $fieldOffset);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -151,10 +151,10 @@ class ADODB_sybase extends ADOConnection {
}
// See http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
{
if ($secs2cache > 0) {// we do not cache rowcount, so we have to load entire recordset
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
return $rs;
}
@ -165,7 +165,7 @@ class ADODB_sybase extends ADOConnection {
if ($offset > 0 && $cnt) $cnt += $offset;
$this->Execute("set rowcount $cnt");
$rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0);
$rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0);
$this->Execute("set rowcount 0");
return $rs;
@ -300,7 +300,7 @@ class ADORecordset_sybase extends ADORecordSet {
Get column information in the Recordset object. fetchField() can be used in order to obtain information about
fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
function &FetchField($fieldOffset = -1)
function FetchField($fieldOffset = -1)
{
if ($fieldOffset != -1) {
$o = @sybase_fetch_field($this->_queryID, $fieldOffset);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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,7 +25,7 @@ class ADODB_sybase_ase extends ADODB_sybase {
}
// split the Views, Tables and procedures.
function &MetaTables($ttype=false,$showSchema=false,$mask=false)
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$false = false;
if ($this->metaTablesSQL) {
@ -43,7 +43,7 @@ class ADODB_sybase_ase extends ADODB_sybase {
if ($rs === false || !method_exists($rs, 'GetArray')){
return $false;
}
$arr =& $rs->GetArray();
$arr = $rs->GetArray();
$arr2 = array();
foreach($arr as $key=>$value){
@ -71,7 +71,7 @@ class ADODB_sybase_ase extends ADODB_sybase {
}
// fix a bug which prevent the metaColumns query to be executed for Sybase ASE
function &MetaColumns($table,$upper=false)
function MetaColumns($table,$upper=false)
{
$false = false;
if (!empty($this->metaColumnsSQL)) {
@ -81,7 +81,7 @@ class ADODB_sybase_ase extends ADODB_sybase {
$retarr = array();
while (!$rs->EOF) {
$fld =& new ADOFieldObject();
$fld = new ADOFieldObject();
$fld->name = $rs->Fields('field_name');
$fld->type = $rs->Fields('type');
$fld->max_length = $rs->Fields('width');

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -55,7 +55,7 @@ class ADODB_vfp extends ADODB_odbc {
// TOP requires ORDER BY for VFP
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
{
$this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
$ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -58,7 +58,7 @@ class perf_db2 extends adodb_perf{
function perf_db2(&$conn)
{
$this->conn =& $conn;
$this->conn = $conn;
}
function Explain($sql,$partial=false)

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -63,7 +63,7 @@ class perf_informix extends adodb_perf{
function perf_informix(&$conn)
{
$this->conn =& $conn;
$this->conn = $conn;
}
}

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -71,7 +71,7 @@ class perf_mssql extends adodb_perf{
$this->sql1 = 'sql1';
//$this->explain = false;
}
$this->conn =& $conn;
$this->conn = $conn;
}
function Explain($sql,$partial=false)
@ -96,7 +96,7 @@ class perf_mssql extends adodb_perf{
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs =& $this->conn->Execute($sql);
$rs = $this->conn->Execute($sql);
//adodb_printr($rs);
$ADODB_FETCH_MODE = $save;
if ($rs) {

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -83,7 +83,7 @@ class perf_mysql extends adodb_perf{
function perf_mysql(&$conn)
{
$this->conn =& $conn;
$this->conn = $conn;
}
function Explain($sql,$partial=false)

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -109,7 +109,7 @@ AND b.name = 'sorts (memory)'",
where name = 'free memory' and pool = 'shared pool'",
'Percentage of data cache actually in use - should be over 85%'),
'shared pool utilization ratio' => array('RATIOU',
'shared pool utilization ratio' => array('RATIOU',
'select round((sga.bytes/case when p.value=0 then sga.bytes else to_number(p.value) end)*100,2)
from v$sgastat sga, v$parameter p
where sga.name = \'free memory\' and sga.pool = \'shared pool\'
@ -156,7 +156,7 @@ having count(*) > 100)",'These are sql statements that should be using bind vari
'random page cost' => array('COST',
"select value from v\$parameter where name = 'optimizer_index_cost_adj'",
'=WarnPageCost'),
'Backup',
'Achivelog Mode' => array('BACKUP', 'select log_mode from v$database', 'To turn on archivelog:<br>
<pre>
@ -185,7 +185,7 @@ FROM v\$parameter v1, v\$parameter v2 WHERE v1.name='log_archive_dest' AND v2.na
$savelog = $conn->LogSQL(false);
$this->version = $conn->ServerInfo();
$conn->LogSQL($savelog);
$this->conn =& $conn;
$this->conn = $conn;
}
function WarnPageCost($val)
@ -229,7 +229,7 @@ FROM v\$parameter v1, v\$parameter v2 WHERE v1.name='log_archive_dest' AND v2.na
function Explain($sql,$partial=false)
{
$savelog = $this->conn->LogSQL(false);
$rs =& $this->conn->SelectLimit("select ID FROM PLAN_TABLE");
$rs = $this->conn->SelectLimit("select ID FROM PLAN_TABLE");
if (!$rs) {
echo "<p><b>Missing PLAN_TABLE</b></p>
<pre>
@ -282,7 +282,7 @@ CREATE TABLE PLAN_TABLE (
$this->conn->BeginTrans();
$id = "ADODB ".microtime();
$rs =& $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql");
$rs = $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql");
$m = $this->conn->ErrorMsg();
if ($m) {
$this->conn->RollbackTrans();
@ -290,7 +290,7 @@ CREATE TABLE PLAN_TABLE (
$s .= "<p>$m</p>";
return $s;
}
$rs =& $this->conn->Execute("
$rs = $this->conn->Execute("
select
'<pre>'||lpad('--', (level-1)*2,'-') || trim(operation) || ' ' || trim(options)||'</pre>' as Operation,
object_name,COST,CARDINALITY,bytes
@ -310,7 +310,7 @@ CONNECT BY prior id=parent_id and statement_id='$id'");
{
if ($this->version['version'] < 9) return 'Oracle 9i or later required';
$rs =& $this->conn->Execute("
$rs = $this->conn->Execute("
select a.size_for_estimate as cache_mb_estimate,
case when a.size_factor=1 then
'&lt;&lt;= current'
@ -438,7 +438,7 @@ order by
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
$savelog = $this->conn->LogSQL(false);
$rs =& $this->conn->SelectLimit($sql);
$rs = $this->conn->SelectLimit($sql);
$this->conn->LogSQL($savelog);
if (isset($savem)) $this->conn->SetFetchMode($savem);
@ -509,7 +509,7 @@ order by
if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false);
$savelog = $this->conn->LogSQL(false);
$rs =& $this->conn->Execute($sql);
$rs = $this->conn->Execute($sql);
$this->conn->LogSQL($savelog);
if (isset($savem)) $this->conn->SetFetchMode($savem);
@ -525,7 +525,6 @@ order by
function clearsql()
{
$this->conn->debug=1;
$perf_table = adodb_perf::table();
// using the naive "delete from $perf_table where created<".$this->conn->sysTimeStamp will cause the table to lock, possibly
// for a long time
@ -546,5 +545,6 @@ END;";
$ok = $this->conn->Execute($sql);
}
}
?>

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -89,7 +89,7 @@ class perf_postgres extends adodb_perf{
function perf_postgres(&$conn)
{
$this->conn =& $conn;
$this->conn = $conn;
}
var $optimizeTableLow = 'VACUUM %s';
@ -121,8 +121,6 @@ class perf_postgres extends adodb_perf{
return $conn->Execute($sql) !== false;
}
function Explain($sql,$partial=false)
{
$save = $this->conn->LogSQL(false);

View File

@ -1,4 +1,4 @@
Description of ADODB v4.98 library import into Moodle
Description of ADODB V5.04a library import into Moodle
Removed:
* contrib/

View File

@ -33,12 +33,12 @@
}
$rs = RSFilter($rs,'do_ucwords');
*/
function &RSFilter($rs,$fn)
function RSFilter($rs,$fn)
{
if ($rs->databaseType != 'array') {
if (!$rs->connection) return false;
$rs = &$rs->connection->_rs2rs($rs);
$rs = $rs->connection->_rs2rs($rs);
}
$rows = $rs->RecordCount();
for ($i=0; $i < $rows; $i++) {

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@ -21,14 +21,14 @@ class ADODB_Encrypt_MD5 {
/**
*/
function write($data, $key) {
$md5crypt =& new MD5Crypt();
$md5crypt = new MD5Crypt();
return $md5crypt->encrypt($data, $key);
}
/**
*/
function read($data, $key) {
$md5crypt =& new MD5Crypt();
$md5crypt = new MD5Crypt();
return $md5crypt->decrypt($data, $key);
}

View File

@ -1,7 +1,7 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -1,32 +1,32 @@
<?php
if (!defined('ADODB_SESSION')) die();
include_once ADODB_SESSION . '/crypt.inc.php';
/**
*/
class ADODB_Encrypt_SHA1 {
function write($data, $key)
{
$sha1crypt =& new SHA1Crypt();
return $sha1crypt->encrypt($data, $key);
}
function read($data, $key)
{
$sha1crypt =& new SHA1Crypt();
return $sha1crypt->decrypt($data, $key);
}
}
return 1;
<?php
if (!defined('ADODB_SESSION')) die();
include_once ADODB_SESSION . '/crypt.inc.php';
/**
*/
class ADODB_Encrypt_SHA1 {
function write($data, $key)
{
$sha1crypt = new SHA1Crypt();
return $sha1crypt->encrypt($data, $key);
}
function read($data, $key)
{
$sha1crypt = new SHA1Crypt();
return $sha1crypt->decrypt($data, $key);
}
}
return 1;
?>

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@ -59,7 +59,7 @@ function adodb_unserialize( $serialized_string )
*/
function adodb_session_regenerate_id()
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if (!$conn) return false;
$old_id = session_id();
@ -72,7 +72,7 @@ function adodb_session_regenerate_id()
//@session_start();
}
$new_id = session_id();
$ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
$ok = $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
/* it is possible that the update statement fails due to a collision */
if (!$ok) {
@ -95,7 +95,7 @@ function adodb_session_create_table($schemaFile=null,$conn = null)
{
// set default values
if ($schemaFile===null) $schemaFile = ADODB_SESSION . '/session_schema.xml';
if ($conn===null) $conn =& ADODB_Session::_conn();
if ($conn===null) $conn = ADODB_Session::_conn();
if (!$conn) return 0;
@ -421,7 +421,7 @@ class ADODB_Session {
/*!
*/
function &_conn($conn=null) {
function _conn($conn=null) {
return $GLOBALS['ADODB_SESS_CONN'];
}
@ -463,7 +463,7 @@ class ADODB_Session {
/*!
*/
function _dumprs($rs) {
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$debug = ADODB_Session::debug();
if (!$conn) {
@ -515,7 +515,7 @@ class ADODB_Session {
*/
function open($save_path, $session_name, $persist = null)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if ($conn) {
return true;
@ -539,7 +539,7 @@ class ADODB_Session {
# assert('$driver');
# assert('$host');
$conn =& ADONewConnection($driver);
$conn = ADONewConnection($driver);
if ($debug) {
$conn->debug = true;
@ -557,7 +557,7 @@ class ADODB_Session {
$ok = $conn->Connect($host, $user, $password, $database);
}
if ($ok) $GLOBALS['ADODB_SESS_CONN'] =& $conn;
if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
else
ADOConnection::outp('<p>Session: connection failed</p>', false);
@ -571,7 +571,7 @@ class ADODB_Session {
function close()
{
/*
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if ($conn) $conn->Close();
*/
return true;
@ -582,7 +582,7 @@ class ADODB_Session {
*/
function read($key)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$data = ADODB_Session::dataFieldName();
$filter = ADODB_Session::filter();
$table = ADODB_Session::table();
@ -601,10 +601,10 @@ class ADODB_Session {
developer has commited elsewhere... :(
*/
#if (ADODB_Session::Lock())
# $rs =& $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), $data);
# $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), $data);
#else
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
//ADODB_Session::_dumprs($rs);
if ($rs) {
if ($rs->EOF) {
@ -641,7 +641,7 @@ class ADODB_Session {
if (!empty($ADODB_SESSION_READONLY)) return;
$clob = ADODB_Session::clob();
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$crc = ADODB_Session::_crc();
$data = ADODB_Session::dataFieldName();
$debug = ADODB_Session::debug();
@ -680,7 +680,7 @@ class ADODB_Session {
$sql = "UPDATE $table SET expiry = ".$conn->Param('0').",expireref=".$conn->Param('1')." WHERE $binary sesskey = ".$conn->Param('2')." AND expiry >= ".$conn->Param('3');
$rs =& $conn->Execute($sql,array($expiry,$expirevar,$key,time()));
$rs = $conn->Execute($sql,array($expiry,$expirevar,$key,time()));
return true;
}
$val = rawurlencode($val);
@ -723,7 +723,7 @@ class ADODB_Session {
$conn->StartTrans();
$expiryref = $conn->qstr($arr['expireref']);
// do we insert or update? => as for sesskey
$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = $qkey");
$rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = $qkey");
if ($rs && reset($rs->fields) > 0) {
$sql = "UPDATE $table SET expiry = $expiry, $data = $lob_value, expireref=$expiryref WHERE sesskey = $qkey";
} else {
@ -733,10 +733,10 @@ class ADODB_Session {
$err = '';
$rs1 =& $conn->Execute($sql);
$rs1 = $conn->Execute($sql);
if (!$rs1) $err = $conn->ErrorMsg()."\n";
$rs2 =& $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
$rs2 = $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
if (!$rs2) $err .= $conn->ErrorMsg()."\n";
$rs = ($rs && $rs2) ? true : false;
@ -751,7 +751,7 @@ class ADODB_Session {
// properly unless select statement executed in Win2000
if ($conn->databaseType == 'access') {
$sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
if ($rs) {
$rs->Close();
@ -767,7 +767,7 @@ class ADODB_Session {
/*!
*/
function destroy($key) {
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$table = ADODB_Session::table();
$expire_notify = ADODB_Session::expireNotify();
@ -785,7 +785,7 @@ class ADODB_Session {
$fn = next($expire_notify);
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
$sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
$conn->SetFetchMode($savem);
if (!$rs) {
@ -802,7 +802,7 @@ class ADODB_Session {
}
$sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
return $rs ? true : false;
@ -812,7 +812,7 @@ class ADODB_Session {
*/
function gc($maxlifetime)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$debug = ADODB_Session::debug();
$expire_notify = ADODB_Session::expireNotify();
$optimize = ADODB_Session::optimize();
@ -832,7 +832,7 @@ class ADODB_Session {
$fn = next($expire_notify);
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
$sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
$conn->SetFetchMode($savem);
if ($rs) {
@ -853,14 +853,14 @@ class ADODB_Session {
if (1) {
$sql = "SELECT sesskey FROM $table WHERE expiry < $time";
$arr =& $conn->GetAll($sql);
$arr = $conn->GetAll($sql);
foreach ($arr as $row) {
$sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
$conn->Execute($sql2,array($row[0]));
}
} else {
$sql = "DELETE FROM $table WHERE expiry < $time";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
if ($rs) $rs->Close();
}
@ -893,7 +893,7 @@ class ADODB_Session {
}
$sql .= " FROM $table";
$rs =& $conn->SelectLimit($sql, 1);
$rs = $conn->SelectLimit($sql, 1);
if ($rs && !$rs->EOF) {
$dbts = reset($rs->fields);
$rs->Close();

View File

@ -2,7 +2,7 @@
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.02 24 Sept 2007 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
Contributed by Ross Smith (adodb@netebb.com).
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@ -89,7 +89,7 @@ function adodb_unserialize( $serialized_string )
*/
function adodb_session_regenerate_id()
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if (!$conn) return false;
$old_id = session_id();
@ -102,7 +102,7 @@ function adodb_session_regenerate_id()
//@session_start();
}
$new_id = session_id();
$ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
$ok = $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
/* it is possible that the update statement fails due to a collision */
if (!$ok) {
@ -125,7 +125,7 @@ function adodb_session_create_table($schemaFile=null,$conn = null)
{
// set default values
if ($schemaFile===null) $schemaFile = ADODB_SESSION . '/session_schema2.xml';
if ($conn===null) $conn =& ADODB_Session::_conn();
if ($conn===null) $conn = ADODB_Session::_conn();
if (!$conn) return 0;
@ -154,7 +154,7 @@ class ADODB_Session {
*/
/*!
*/
function driver($driver = null)
static function driver($driver = null)
{
static $_driver = 'mysql';
static $set = false;
@ -174,7 +174,7 @@ class ADODB_Session {
/*!
*/
function host($host = null) {
static function host($host = null) {
static $_host = 'localhost';
static $set = false;
@ -193,7 +193,7 @@ class ADODB_Session {
/*!
*/
function user($user = null)
static function user($user = null)
{
static $_user = 'root';
static $set = false;
@ -213,7 +213,7 @@ class ADODB_Session {
/*!
*/
function password($password = null)
static function password($password = null)
{
static $_password = '';
static $set = false;
@ -233,7 +233,7 @@ class ADODB_Session {
/*!
*/
function database($database = null)
static function database($database = null)
{
static $_database = '';
static $set = false;
@ -252,7 +252,7 @@ class ADODB_Session {
/*!
*/
function persist($persist = null)
static function persist($persist = null)
{
static $_persist = true;
@ -265,7 +265,7 @@ class ADODB_Session {
/*!
*/
function lifetime($lifetime = null)
static function lifetime($lifetime = null)
{
static $_lifetime;
static $set = false;
@ -293,7 +293,7 @@ class ADODB_Session {
/*!
*/
function debug($debug = null)
static function debug($debug = null)
{
static $_debug = false;
static $set = false;
@ -303,7 +303,7 @@ class ADODB_Session {
$conn = ADODB_Session::_conn();
if ($conn) {
$conn->debug = $_debug;
#$conn->debug = $_debug;
}
$set = true;
} elseif (!$set) {
@ -318,7 +318,7 @@ class ADODB_Session {
/*!
*/
function expireNotify($expire_notify = null)
static function expireNotify($expire_notify = null)
{
static $_expire_notify;
static $set = false;
@ -338,7 +338,7 @@ class ADODB_Session {
/*!
*/
function table($table = null)
static function table($table = null)
{
static $_table = 'sessions2';
static $set = false;
@ -358,7 +358,7 @@ class ADODB_Session {
/*!
*/
function optimize($optimize = null)
static function optimize($optimize = null)
{
static $_optimize = false;
static $set = false;
@ -378,7 +378,7 @@ class ADODB_Session {
/*!
*/
function syncSeconds($sync_seconds = null) {
static function syncSeconds($sync_seconds = null) {
//echo ("<p>WARNING: ADODB_SESSION::syncSeconds is longer used, please remove this function for your code</p>");
return 0;
@ -386,7 +386,7 @@ class ADODB_Session {
/*!
*/
function clob($clob = null) {
static function clob($clob = null) {
static $_clob = false;
static $set = false;
@ -405,14 +405,14 @@ class ADODB_Session {
/*!
*/
function dataFieldName($data_field_name = null) {
static function dataFieldName($data_field_name = null) {
//echo ("<p>WARNING: ADODB_SESSION::dataFieldName() is longer used, please remove this function for your code</p>");
return '';
}
/*!
*/
function filter($filter = null) {
static function filter($filter = null) {
static $_filter = array();
if (!is_null($filter)) {
@ -427,7 +427,7 @@ class ADODB_Session {
/*!
*/
function encryptionKey($encryption_key = null) {
static function encryptionKey($encryption_key = null) {
static $_encryption_key = 'CRYPTED ADODB SESSIONS ROCK!';
if (!is_null($encryption_key)) {
@ -443,19 +443,13 @@ class ADODB_Session {
/*!
*/
function &_conn($conn=null)
{
if (isset($GLOBALS['ADODB_SESS_CONN'])) {
$conn =& $GLOBALS['ADODB_SESS_CONN'];
return $conn;
}
$false = false;
return $false;
static function _conn($conn=null) {
return @$GLOBALS['ADODB_SESS_CONN'];
}
/*!
*/
function _crc($crc = null) {
static function _crc($crc = null) {
static $_crc = false;
if (!is_null($crc)) {
@ -467,7 +461,7 @@ class ADODB_Session {
/*!
*/
function _init() {
static function _init() {
session_module_name('user');
session_set_save_handler(
array('ADODB_Session', 'open'),
@ -482,7 +476,7 @@ class ADODB_Session {
/*!
*/
function _sessionKey() {
static function _sessionKey() {
// use this function to create the encryption key for crypted sessions
// crypt the used key, ADODB_Session::encryptionKey() as key and session_id() as salt
return crypt(ADODB_Session::encryptionKey(), session_id());
@ -490,8 +484,8 @@ class ADODB_Session {
/*!
*/
function _dumprs($rs) {
$conn =& ADODB_Session::_conn();
static function _dumprs($rs) {
$conn = ADODB_Session::_conn();
$debug = ADODB_Session::debug();
if (!$conn) {
@ -521,7 +515,7 @@ class ADODB_Session {
// public methods
/////////////////////
function config($driver, $host, $user, $password, $database=false,$options=false)
static function config($driver, $host, $user, $password, $database=false,$options=false)
{
ADODB_Session::driver($driver);
ADODB_Session::host($host);
@ -541,9 +535,9 @@ class ADODB_Session {
If $conn already exists, reuse that connection
*/
function open($save_path, $session_name, $persist = null)
static function open($save_path, $session_name, $persist = null)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if ($conn) {
return true;
@ -567,7 +561,7 @@ class ADODB_Session {
# assert('$driver');
# assert('$host');
$conn =& ADONewConnection($driver);
$conn = ADONewConnection($driver);
if ($debug) {
$conn->debug = true;
@ -585,7 +579,7 @@ class ADODB_Session {
$ok = $conn->Connect($host, $user, $password, $database);
}
if ($ok) $GLOBALS['ADODB_SESS_CONN'] =& $conn;
if ($ok) $GLOBALS['ADODB_SESS_CONN'] = $conn;
else
ADOConnection::outp('<p>Session: connection failed</p>', false);
@ -596,10 +590,10 @@ class ADODB_Session {
/*!
Close the connection
*/
function close()
static function close()
{
/*
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if ($conn) $conn->Close();
*/
return true;
@ -608,9 +602,9 @@ class ADODB_Session {
/*
Slurp in the session variables and return the serialized string
*/
function read($key)
static function read($key)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$filter = ADODB_Session::filter();
$table = ADODB_Session::table();
@ -628,10 +622,10 @@ class ADODB_Session {
developer has commited elsewhere... :(
*/
#if (ADODB_Session::Lock())
# $rs =& $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), sessdata);
# $rs = $conn->RowLock($table, "$binary sesskey = $qkey AND expiry >= " . time(), sessdata);
#else
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
//ADODB_Session::_dumprs($rs);
if ($rs) {
if ($rs->EOF) {
@ -661,14 +655,14 @@ class ADODB_Session {
If the data has not been modified since the last read(), we do not write.
*/
function write($key, $val)
static function write($key, $oval)
{
global $ADODB_SESSION_READONLY;
if (!empty($ADODB_SESSION_READONLY)) return;
$clob = ADODB_Session::clob();
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$crc = ADODB_Session::_crc();
$debug = ADODB_Session::debug();
$driver = ADODB_Session::driver();
@ -680,7 +674,7 @@ class ADODB_Session {
if (!$conn) {
return false;
}
if ($debug) $conn->debug = 1;
$sysTimeStamp = $conn->sysTimeStamp;
//assert('$table');
@ -691,7 +685,7 @@ class ADODB_Session {
// crc32 optimization since adodb 2.1
// now we only update expiry date, thx to sebastian thom in adodb 2.32
if ($crc !== false && $crc == (strlen($val) . crc32($val))) {
if ($crc !== false && $crc == (strlen($oval) . crc32($oval))) {
if ($debug) {
echo '<p>Session: Only updating date - crc32 not changed</p>';
}
@ -707,10 +701,10 @@ class ADODB_Session {
$sql = "UPDATE $table SET expiry = $expiry ,expireref=".$conn->Param('0').", modified = $sysTimeStamp WHERE $binary sesskey = ".$conn->Param('1')." AND expiry >= $sysTimeStamp";
$rs =& $conn->Execute($sql,array($expirevar,$key));
$rs = $conn->Execute($sql,array($expirevar,$key));
return true;
}
$val = rawurlencode($val);
$val = rawurlencode($oval);
foreach ($filter as $f) {
if (is_object($f)) {
$val = $f->write($val, ADODB_Session::_sessionKey());
@ -727,7 +721,7 @@ class ADODB_Session {
}
if (!$clob) { // no lobs, simply use replace()
$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
$rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
if ($rs) $rs->Close();
if ($rs && reset($rs->fields) > 0) {
@ -739,7 +733,7 @@ class ADODB_Session {
}
$rs =& $conn->Execute($sql,array($val,$expireref,$key));
$rs = $conn->Execute($sql,array($val,$expireref,$key));
} else {
// what value shall we insert/update for lob row?
@ -760,7 +754,7 @@ class ADODB_Session {
$conn->StartTrans();
$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
$rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = ".$conn->Param(0),array($key));
if ($rs) $rs->Close();
if ($rs && reset($rs->fields) > 0) {
@ -771,10 +765,11 @@ class ADODB_Session {
VALUES ($expiry,$lob_value, ". $conn->Param('0').", ".$conn->Param('1').", $sysTimeStamp, $sysTimeStamp)";
}
$rs =& $conn->Execute($sql,array($expireref,$key));
$rs = $conn->Execute($sql,array($expireref,$key));
$qkey = $conn->qstr($key);
$rs2 = $conn->UpdateBlob($table, 'sessdata', $val, " sesskey=$qkey", strtoupper($clob));
if ($debug) echo "<hr>",htmlspecialchars($oval), "<hr>";
$rs = @$conn->CompleteTrans();
@ -788,7 +783,7 @@ class ADODB_Session {
// properly unless select statement executed in Win2000
if ($conn->databaseType == 'access') {
$sql = "SELECT sesskey FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
if ($rs) {
$rs->Close();
@ -803,15 +798,16 @@ class ADODB_Session {
/*!
*/
function destroy($key) {
$conn =& ADODB_Session::_conn();
static function destroy($key) {
$conn = ADODB_Session::_conn();
$table = ADODB_Session::table();
$expire_notify = ADODB_Session::expireNotify();
if (!$conn) {
return false;
}
$debug = ADODB_Session::debug();
if ($debug) $conn->debug = 1;
//assert('$table');
$qkey = $conn->quote($key);
@ -822,7 +818,7 @@ class ADODB_Session {
$fn = next($expire_notify);
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
$sql = "SELECT expireref, sesskey FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
$conn->SetFetchMode($savem);
if (!$rs) {
@ -839,7 +835,7 @@ class ADODB_Session {
}
$sql = "DELETE FROM $table WHERE $binary sesskey = $qkey";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
if ($rs) {
$rs->Close();
@ -850,9 +846,9 @@ class ADODB_Session {
/*!
*/
function gc($maxlifetime)
static function gc($maxlifetime)
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
$debug = ADODB_Session::debug();
$expire_notify = ADODB_Session::expireNotify();
$optimize = ADODB_Session::optimize();
@ -862,6 +858,10 @@ class ADODB_Session {
return false;
}
$debug = ADODB_Session::debug();
if ($debug) $conn->debug = 1;
//assert('$table');
$time = $conn->sysTimeStamp;
@ -872,7 +872,7 @@ class ADODB_Session {
$fn = next($expire_notify);
$savem = $conn->SetFetchMode(ADODB_FETCH_NUM);
$sql = "SELECT expireref, sesskey FROM $table WHERE expiry < $time";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
$conn->SetFetchMode($savem);
if ($rs) {
@ -893,14 +893,14 @@ class ADODB_Session {
if (0) {
$sql = "SELECT sesskey FROM $table WHERE expiry < $time";
$arr =& $conn->GetAll($sql);
$arr = $conn->GetAll($sql);
foreach ($arr as $row) {
$sql2 = "DELETE FROM $table WHERE sesskey=".$conn->Param('0');
$conn->Execute($sql2,array($row[0]));
}
} else {
$sql = "DELETE FROM $table WHERE expiry < $time";
$rs =& $conn->Execute($sql);
$rs = $conn->Execute($sql);
ADODB_Session::_dumprs($rs);
if ($rs) $rs->Close();
}

View File

@ -1,6 +1,6 @@
<?php
/*
V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
V5.04a 25 Mar 2008 (c) 2000-2008 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.
@ -281,7 +281,7 @@ function adodb_sess_gc($maxlifetime) {
if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
$rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);
$rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
if ($rs && !$rs->EOF) {
$dbts = reset($rs->fields);

View File

@ -405,7 +405,7 @@ function adodb_sess_gc($maxlifetime)
if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
$rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);
$rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
if ($rs && !$rs->EOF) {
$dbts = reset($rs->fields);

View File

@ -112,7 +112,7 @@ if (!defined('ADODB_SESSION')) {
*/
function adodb_session_regenerate_id()
{
$conn =& ADODB_Session::_conn();
$conn = ADODB_Session::_conn();
if (!$conn) return false;
$old_id = session_id();
@ -125,7 +125,7 @@ function adodb_session_regenerate_id()
//@session_start();
}
$new_id = session_id();
$ok =& $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
$ok = $conn->Execute('UPDATE '. ADODB_Session::table(). ' SET sesskey='. $conn->qstr($new_id). ' WHERE sesskey='.$conn->qstr($old_id));
/* it is possible that the update statement fails due to a collision */
if (!$ok) {
@ -350,7 +350,7 @@ function adodb_sess_gc($maxlifetime)
$fn = next($ADODB_SESSION_EXPIRE_NOTIFY);
$savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);
$t = time();
$rs =& $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < $t");
$rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < $t");
$ADODB_SESS_CONN->SetFetchMode($savem);
if ($rs) {
$ADODB_SESS_CONN->BeginTrans();
@ -394,7 +394,7 @@ function adodb_sess_gc($maxlifetime)
if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;
else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;
$rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);
$rs = $ADODB_SESS_CONN->SelectLimit($sql,1);
if ($rs && !$rs->EOF) {
$dbts = reset($rs->fields);

Some files were not shown because too many files have changed in this diff Show More