summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorioguix2010-09-14 22:23:10 +0000
committerioguix2010-09-14 22:23:10 +0000
commit165f2a7028f0b29015211991e19ddcbaf9bd5f66 (patch)
tree36c17a8bea4a6c91869aeb0a10d816e3796840f9
parent4ff9e89db844fcd056bca1fe5c8cfa1f72260487 (diff)
Update ADOdb library to the current stable one
-rw-r--r--libraries/adodb/adodb-csvlib.inc.php2
-rw-r--r--libraries/adodb/adodb-datadict.inc.php28
-rwxr-xr-xlibraries/adodb/adodb-error.inc.php4
-rwxr-xr-xlibraries/adodb/adodb-iterator.inc.php2
-rw-r--r--libraries/adodb/adodb-lib.inc.php12
-rw-r--r--libraries/adodb/adodb-time.inc.php3
-rwxr-xr-xlibraries/adodb/adodb.inc.php41
-rw-r--r--libraries/adodb/drivers/adodb-postgres.inc.php2
-rw-r--r--libraries/adodb/drivers/adodb-postgres64.inc.php8
-rw-r--r--libraries/adodb/drivers/adodb-postgres7.inc.php2
-rw-r--r--libraries/adodb/drivers/adodb-postgres8.inc.php2
-rw-r--r--libraries/adodb/toexport.inc.php2
-rwxr-xr-xlibraries/adodb/tohtml.inc.php2
13 files changed, 79 insertions, 31 deletions
diff --git a/libraries/adodb/adodb-csvlib.inc.php b/libraries/adodb/adodb-csvlib.inc.php
index 7b1c9e11..1c0d0818 100644
--- a/libraries/adodb/adodb-csvlib.inc.php
+++ b/libraries/adodb/adodb-csvlib.inc.php
@@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1;
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/adodb-datadict.inc.php b/libraries/adodb/adodb-datadict.inc.php
index 19500ca9..69060c5c 100644
--- a/libraries/adodb/adodb-datadict.inc.php
+++ b/libraries/adodb/adodb-datadict.inc.php
@@ -1,7 +1,7 @@
<?php
/**
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
@@ -589,6 +589,8 @@ class ADODB_DataDict {
return $sql;
}
+
+
function _GenFields($flds,$widespacing=false)
{
@@ -913,6 +915,21 @@ class ADODB_DataDict {
return $newopts;
}
+
+ function _getSizePrec($size)
+ {
+ $fsize = false;
+ $fprec = false;
+ $dotat = strpos($size,'.');
+ if ($dotat === false) $dotat = strpos($size,',');
+ if ($dotat === false) $fsize = $size;
+ else {
+ $fsize = substr($size,0,$dotat);
+ $fprec = substr($size,$dotat+1);
+ }
+ return array($fsize, $fprec);
+ }
+
/**
"Florian Buzin [ easywe ]" <florian.buzin#easywe.de>
@@ -958,9 +975,16 @@ class ADODB_DataDict {
$c = $cols[$k];
$ml = $c->max_length;
$mt = $this->MetaType($c->type,$ml);
+
+ if (isset($c->scale)) $sc = $c->scale;
+ else $sc = 99; // always force change if scale not known.
+
+ if ($sc == -1) $sc = false;
+ list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']);
+
if ($ml == -1) $ml = '';
if ($mt == 'X') $ml = $v['SIZE'];
- if (($mt != $v['TYPE']) || $ml != $v['SIZE'] || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
+ if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
$holdflds[$k] = $v;
}
} else {
diff --git a/libraries/adodb/adodb-error.inc.php b/libraries/adodb/adodb-error.inc.php
index ae0b9e35..6ec614d2 100755
--- a/libraries/adodb/adodb-error.inc.php
+++ b/libraries/adodb/adodb-error.inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.06 16 Oct 2008 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
@@ -99,7 +99,7 @@ function adodb_error_pg($errormsg)
'/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/i' => DB_ERROR_NOSUCHFIELD,
'/parser: parse error at or near \"/i' => DB_ERROR_SYNTAX,
'/referential integrity violation/i' => DB_ERROR_CONSTRAINT,
- '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i'
+ '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key.*violates unique constraint/i'
=> DB_ERROR_ALREADY_EXISTS
);
reset($error_regexps);
diff --git a/libraries/adodb/adodb-iterator.inc.php b/libraries/adodb/adodb-iterator.inc.php
index 0ecea26f..e8b5e57b 100755
--- a/libraries/adodb/adodb-iterator.inc.php
+++ b/libraries/adodb/adodb-iterator.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/adodb-lib.inc.php b/libraries/adodb/adodb-lib.inc.php
index 9b46dedc..6b2e8910 100644
--- a/libraries/adodb/adodb-lib.inc.php
+++ b/libraries/adodb/adodb-lib.inc.php
@@ -10,7 +10,7 @@ global $ADODB_INCLUDED_LIB;
$ADODB_INCLUDED_LIB = 1;
/*
- @version V5.06 16 Oct 2008 (c) 2000-2009 John Lim (jlim\@natsoft.com.my). All rights reserved.
+ @version V5.06 16 Oct 2008 (c) 2000-2010 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.
@@ -455,9 +455,13 @@ 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);
- if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
-
+ if ($secs2cache) {
+ $rstest = $zthis->CacheExecute($secs2cache,$rewritesql,$inputarr);
+ if (!$rstest) $rstest = $zthis->CacheExecute($secs2cache,$sql,$inputarr);
+ } else {
+ $rstest = $zthis->Execute($rewritesql,$inputarr);
+ if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
+ }
if ($rstest) {
$qryRecs = $rstest->RecordCount();
if ($qryRecs == -1) {
diff --git a/libraries/adodb/adodb-time.inc.php b/libraries/adodb/adodb-time.inc.php
index 07638950..d62f6784 100644
--- a/libraries/adodb/adodb-time.inc.php
+++ b/libraries/adodb/adodb-time.inc.php
@@ -1074,6 +1074,9 @@ global $ADODB_DATETIME_CLASS;
*/
for ($i=0; $i < $max; $i++) {
switch($fmt[$i]) {
+ case 'e':
+ $dates .= date('e');
+ break;
case 'T':
if ($ADODB_DATETIME_CLASS) {
$dt = new DateTime();
diff --git a/libraries/adodb/adodb.inc.php b/libraries/adodb/adodb.inc.php
index 9752d106..0187f55c 100755
--- a/libraries/adodb/adodb.inc.php
+++ b/libraries/adodb/adodb.inc.php
@@ -14,7 +14,7 @@
/**
\mainpage
- @version V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license. You can choose which license
you prefer.
@@ -177,7 +177,7 @@
/**
* ADODB version as a string.
*/
- $ADODB_vers = 'V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
+ $ADODB_vers = 'V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
/**
* Determines whether recordset->RecordCount() is used.
@@ -403,6 +403,7 @@
var $fetchMode=false;
var $null2null = 'null'; // in autoexecute/getinsertsql/getupdatesql, this value will be converted to a null
+ var $bulkBind = false; // enable 2D Execute array
//
// PRIVATE VARS
//
@@ -435,7 +436,9 @@
{
global $ADODB_vers;
- return (float) substr($ADODB_vers,1);
+ $ok = preg_match( '/^[Vv]([0-9\.]+)/', $ADODB_vers, $matches );
+ if (!$ok) return (float) substr($ADODB_vers,1);
+ else return $matches[1];
}
/**
@@ -511,15 +514,15 @@
{
if ($argHostname != "") $this->host = $argHostname;
if ($argUsername != "") $this->user = $argUsername;
- if ($argPassword != "") $this->password = $argPassword; // not stored for security reasons
+ if ($argPassword != "") $this->password = 'not stored'; // not stored for security reasons
if ($argDatabaseName != "") $this->database = $argDatabaseName;
$this->_isPersistentConnection = false;
if ($forceNew) {
- if ($rez=$this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez=$this->_nconnect($this->host, $this->user, $argPassword, $this->database)) return true;
} else {
- if ($rez=$this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez=$this->_connect($this->host, $this->user, $argPassword, $this->database)) return true;
}
if (isset($rez)) {
$err = $this->ErrorMsg();
@@ -577,12 +580,12 @@
if ($argHostname != "") $this->host = $argHostname;
if ($argUsername != "") $this->user = $argUsername;
- if ($argPassword != "") $this->password = $argPassword;
+ if ($argPassword != "") $this->password = 'not stored';
if ($argDatabaseName != "") $this->database = $argDatabaseName;
$this->_isPersistentConnection = true;
- if ($rez = $this->_pconnect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez = $this->_pconnect($this->host, $this->user, $argPassword, $this->database)) return true;
if (isset($rez)) {
$err = $this->ErrorMsg();
if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
@@ -716,7 +719,7 @@
* @param $table name of table to lock
* @param $where where clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock
*/
- function RowLock($table,$where,$col='1 as ignore')
+ function RowLock($table,$where,$col='1 as adodbignore')
{
return false;
}
@@ -950,7 +953,7 @@
$element0 = reset($inputarr);
# is_object check because oci8 descriptors can be passed in
- $array_2d = is_array($element0) && !is_object(reset($element0));
+ $array_2d = $this->bulkBind && is_array($element0) && !is_object(reset($element0));
//remove extra memory copy of input -mikefedyk
unset($element0);
@@ -4149,11 +4152,25 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
// special handling of oracle, which might not have host
$fakedsn = str_replace('@/','@adodb-fakehost/',$fakedsn);
}
+
+ if ((strpos($origdsn, 'sqlite')) !== FALSE) {
+ // special handling for SQLite, it only might have the path to the database file.
+ // If you try to connect to a SQLite database using a dsn like 'sqlite:///path/to/database', the 'parse_url' php function
+ // will throw you an exception with a message such as "unable to parse url"
+ list($scheme, $path) = explode('://', $origdsn);
+ $dsna['scheme'] = $scheme;
+ if ($qmark = strpos($path,'?')) {
+ $dsn['query'] = substr($path,$qmark+1);
+ $path = substr($path,0,$qmark);
+ }
+ $dsna['path'] = '/' . urlencode($path);
+ } else
$dsna = @parse_url($fakedsn);
+
if (!$dsna) {
return $false;
}
- $dsna['scheme'] = substr($origdsn,0,$at);
+ $dsna['scheme'] = substr($origdsn,0,$at);
if ($at2 !== FALSE) {
$dsna['host'] = '';
}
@@ -4396,4 +4413,4 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
}
-?> \ No newline at end of file
+?>
diff --git a/libraries/adodb/drivers/adodb-postgres.inc.php b/libraries/adodb/drivers/adodb-postgres.inc.php
index b4e69b68..6f580ff6 100644
--- a/libraries/adodb/drivers/adodb-postgres.inc.php
+++ b/libraries/adodb/drivers/adodb-postgres.inc.php
@@ -1,6 +1,6 @@
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/drivers/adodb-postgres64.inc.php b/libraries/adodb/drivers/adodb-postgres64.inc.php
index 1343bc35..5597d515 100644
--- a/libraries/adodb/drivers/adodb-postgres64.inc.php
+++ b/libraries/adodb/drivers/adodb-postgres64.inc.php
@@ -1,6 +1,6 @@
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
@@ -178,7 +178,7 @@ a different OID if a database must be reloaded. */
return @pg_Exec($this->_connectionID, "begin ".$this->_transmode);
}
- function RowLock($tables,$where,$col='1 as ignore')
+ function RowLock($tables,$where,$col='1 as adodbignore')
{
if (!$this->transCnt) $this->BeginTrans();
return $this->GetOne("select $col from $tables where $where for update");
@@ -584,7 +584,7 @@ select viewname,'V' from pg_views where viewname like $mask";
}
- function MetaIndexes ($table, $primary = FALSE)
+ function MetaIndexes ($table, $primary = FALSE, $owner = false)
{
global $ADODB_FETCH_MODE;
@@ -677,7 +677,7 @@ WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\'))';
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
-
+
if ($ctype === 1) { // persistent
$this->_connectionID = pg_pconnect($str);
} else {
diff --git a/libraries/adodb/drivers/adodb-postgres7.inc.php b/libraries/adodb/drivers/adodb-postgres7.inc.php
index 57fb9a63..eecfdc37 100644
--- a/libraries/adodb/drivers/adodb-postgres7.inc.php
+++ b/libraries/adodb/drivers/adodb-postgres7.inc.php
@@ -1,6 +1,6 @@
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/drivers/adodb-postgres8.inc.php b/libraries/adodb/drivers/adodb-postgres8.inc.php
index f4bbe36b..3134e3c3 100644
--- a/libraries/adodb/drivers/adodb-postgres8.inc.php
+++ b/libraries/adodb/drivers/adodb-postgres8.inc.php
@@ -1,6 +1,6 @@
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/toexport.inc.php b/libraries/adodb/toexport.inc.php
index 57b8bd1e..6975b51a 100644
--- a/libraries/adodb/toexport.inc.php
+++ b/libraries/adodb/toexport.inc.php
@@ -1,7 +1,7 @@
<?php
/**
- * @version V4.93 10 Oct 2006 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V4.93 10 Oct 2006 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
diff --git a/libraries/adodb/tohtml.inc.php b/libraries/adodb/tohtml.inc.php
index 6a4e3ba4..76245661 100755
--- a/libraries/adodb/tohtml.inc.php
+++ b/libraries/adodb/tohtml.inc.php
@@ -1,6 +1,6 @@
<?php
/*
- V4.93 10 Oct 2006 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V4.93 10 Oct 2006 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.