Update ADOdb library to the current stable one
authorioguix <ioguix@free.fr>
Tue, 14 Sep 2010 22:23:10 +0000 (00:23 +0200)
committerioguix <ioguix@free.fr>
Tue, 14 Sep 2010 22:23:10 +0000 (00:23 +0200)
13 files changed:
libraries/adodb/adodb-csvlib.inc.php
libraries/adodb/adodb-datadict.inc.php
libraries/adodb/adodb-error.inc.php
libraries/adodb/adodb-iterator.inc.php
libraries/adodb/adodb-lib.inc.php
libraries/adodb/adodb-time.inc.php
libraries/adodb/adodb.inc.php
libraries/adodb/drivers/adodb-postgres.inc.php
libraries/adodb/drivers/adodb-postgres64.inc.php
libraries/adodb/drivers/adodb-postgres7.inc.php
libraries/adodb/drivers/adodb-postgres8.inc.php
libraries/adodb/toexport.inc.php
libraries/adodb/tohtml.inc.php

index 7b1c9e11977959d786c42c71027e925f05423652..1c0d08180468dfdb507b98b69ec3bf3dfc7f8993 100644 (file)
@@ -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. 
index 19500ca90841f3e24ddf19e68bfefa2ec4863f3f..69060c5cef6b794ea91263206f8c92dfb26539f5 100644 (file)
@@ -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 {
index ae0b9e3543da50d0f082d02bd0b15848362c3f34..6ec614d2c19ae9ab88987587da6d93b67703b9e9 100755 (executable)
@@ -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);
index 0ecea26f0032c4151f27b441c7e9497d6e4d5649..e8b5e57bfbd3826917b71e9ffd867f299797f152 100755 (executable)
@@ -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.
index 9b46dedc8f1a886654fc11127cbbb7495e9ab9f6..6b2e891091c23e10186fa4a59011bd1ddd52dbce 100644 (file)
@@ -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) { 
index 076389507d2f5f717683a330f2267e6ec5893024..d62f67843701e4c3bac390cb37d2851b6623811e 100644 (file)
@@ -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();
index 9752d106f7c55a2d6ef71ca6716b24ece7a8a071..0187f55c80161e5ff2eea2659e79b406c8f56643 100755 (executable)
@@ -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.
                /**
                 * 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. 
        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
         //
        {
        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];
        }
        
        /**
        {
                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();
                
                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'";
        *  @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;
        }
                        
                        $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
+?>
index b4e69b685da1f0137eba027596434aa591dab2d7..6f580ff635c3dca7086dc1c91dfa6955afe4cdc3 100644 (file)
@@ -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.
index 1343bc35b7f13d58873b72e9ab8a41266bd9d8df..5597d515402894fd1d59bb381f5418234a0a6f88 100644 (file)
@@ -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 {
index 57fb9a632dabf927f97b9c5be5e0c5729a0e04fe..eecfdc37bd41b41383fa0e727df6e8bd27d2dcf8 100644 (file)
@@ -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.
index f4bbe36bf878b424306e13cc2b21e65bd3deaccc..3134e3c30729d30fd17a8959268c111e29f73f34 100644 (file)
@@ -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.
index 57b8bd1eb8e549af4d7d298175de65462b95ceea..6975b51a446d567bcf6466eec924fcc65b371309 100644 (file)
@@ -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. 
index 6a4e3ba471ca4af061290c88321d7c9ea4697264..76245661861fbb0bad250482499a4d8febfabb0a 100755 (executable)
@@ -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.