logo       

mantisbt/core/adodb adodb-csvlib.inc.php,1.3,1.4 adodb-datadict.inc.php,1.3: msg#00047

Subject: mantisbt/core/adodb adodb-csvlib.inc.php,1.3,1.4 adodb-datadict.inc.php,1.3,1.4 adodb-error.inc.php,1.3,1.4 adodb-errorhandler.inc.php,1.3,1.4 adodb-errorpear.inc.php,1.3,1.4 adodb-exceptions.inc.php,1.1,1.2 adodb-iterator.inc.php,1.1,1.2 adodb-lib.inc.php,1.3,1.4 adodb-pager.inc.php,1.3,1.4 adodb-pear.inc.php,1.3,1.4 adodb-perf.inc.php,1.1,1.2 adodb-php4.inc.php,1.1,1.2 adodb-time.inc.php,1.4,1.5 adodb-xmlschema.inc.php,1.4,1.5 adodb.inc.php,1.3,1.4 license.txt,1.3,1.4 pivottable.inc.php,1.3,1.4 readme.txt,1.3,1.4 rsfilter.inc.php,1.3,1.4 server.php,1.3,1.4 toexport.inc.php,1.3,1.4 tohtml.inc.php,1.3,1.4 xmlschema.dtd,1.1,1.2 adodb-perf.inc.php.#.LENS-03-09-05,1.1,NONE
Update of /cvsroot/mantisbt/mantisbt/core/adodb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23600

Modified Files:
        adodb-csvlib.inc.php adodb-datadict.inc.php 
        adodb-error.inc.php adodb-errorhandler.inc.php 
        adodb-errorpear.inc.php adodb-exceptions.inc.php 
        adodb-iterator.inc.php adodb-lib.inc.php adodb-pager.inc.php 
        adodb-pear.inc.php adodb-perf.inc.php adodb-php4.inc.php 
        adodb-time.inc.php adodb-xmlschema.inc.php adodb.inc.php 
        license.txt pivottable.inc.php readme.txt rsfilter.inc.php 
        server.php toexport.inc.php tohtml.inc.php xmlschema.dtd 
Removed Files:
        adodb-perf.inc.php.#.LENS-03-09-05 
Log Message:
updating adodb to v4.60 (#5171)


Index: adodb-pear.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-pear.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-pear.inc.php  29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-pear.inc.php  27 Jan 2005 14:43:39 -0000      1.4
@@ -1,369 +1,374 @@
-<?php
-/** 
- * @version V4.54 5 Nov 2004 (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
- * 
- * PEAR DB Emulation Layer for ADODB.
- *
- * The following code is modelled on PEAR DB code by Stig Bakken 
<ssb-8gWjf/rZqUg@xxxxxxxxxxxxxxxx>                                              
                 |
- * and Tomas V.V.Cox <cox-6/zrcuMSWPdBDgjK7y7TUQ@xxxxxxxxxxxxxxxx>.    
Portions (c)1997-2002 The PHP Group.
- */
-
- /*
- We support:
- 
- DB_Common
- ---------
-       query - returns PEAR_Error on error
-       limitQuery - return PEAR_Error on error
-       prepare - does not return PEAR_Error on error
-       execute - does not return PEAR_Error on error
-       setFetchMode - supports ASSOC and ORDERED
-       errorNative
-       quote
-       nextID
-       disconnect
-       
-       getOne
-       getAssoc
-       getRow
-       getCol
-       getAll
-       
- DB_Result
- ---------
-       numRows - returns -1 if not supported
-       numCols
-       fetchInto - does not support passing of fetchmode
-       fetchRows - does not support passing of fetchmode
-       free
- */
- 
-define('ADODB_PEAR',dirname(__FILE__));
-include_once "PEAR.php";
-include_once ADODB_PEAR."/adodb-errorpear.inc.php";
-include_once ADODB_PEAR."/adodb.inc.php";
-
-if (!defined('DB_OK')) {
-define("DB_OK",        1);
-define("DB_ERROR",-1);
-/**
- * This is a special constant that tells DB the user hasn't specified
- * any particular get mode, so the default should be used.
- */
-
-define('DB_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-
-define('DB_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-
-define('DB_FETCHMODE_ASSOC', 2);
-
-/* for compatibility */
-
-define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
-define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
-
-/**
- * these are constants for the tableInfo-function
- * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust DB_TABLEINFO_FULL accordingly
- */
-
-define('DB_TABLEINFO_ORDER', 1);
-define('DB_TABLEINFO_ORDERTABLE', 2);
-define('DB_TABLEINFO_FULL', 3);
-}
-
-/**
- * The main "DB" class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- */
-
-class DB
-{
-       /**
-        * Create a new DB object for the specified database type
-        *
-        * @param $type string database type, for example "mysql"
-        *
-        * @return object a newly created DB object, or a DB error code on
-        * error
-        */
-
-       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);
-               return $obj;
-       }
-
-       /**
-        * Create a new DB object and connect to the specified database
-        *
-        * @param $dsn mixed "data source name", see the DB::parseDSN
-        * method for a description of the dsn format.  Can also be
-        * specified as an array of the format returned by DB::parseDSN.
-        *
-        * @param $options mixed if boolean (or scalar), tells whether
-        * this connection should be persistent (for backends that support
-        * this).  This parameter can also be an array of options, see
-        * DB_common::setOption for more information on connection
-        * options.
-        *
-        * @return object a newly created DB connection object, or a DB
-        * error object on error
-        *
-        * @see DB::parseDSN
-        * @see DB::isError
-        */
-       function &connect($dsn, $options = false)
-       {
-               if (is_array($dsn)) {
-                       $dsninfo = $dsn;
-               } else {
-                       $dsninfo = DB::parseDSN($dsn);
-               }
-               switch ($dsninfo["phptype"]) {
-                       case 'pgsql':   $type = 'postgres7'; break;
-                       case 'ifx':             $type = 'informix9'; break;
-                       default:                $type = $dsninfo["phptype"]; 
break;
-               }
-
-               if (is_array($options) && isset($options["debug"]) &&
-                       $options["debug"] >= 2) {
-                       // expose php errors with sufficient debug level
-                        @include_once("adodb-$type.inc.php");
-               } else {
-                        @include_once("adodb-$type.inc.php");
-               }
-
-               @$obj =& NewADOConnection($type);
-               if (!is_object($obj)) {
-                       $obj =& new PEAR_Error('Unknown Database Driver: 
'.$dsninfo['phptype'],-1);
-                       return $obj;
-               }
-               if (is_array($options)) {
-                       foreach($options as $k => $v) {
-                               switch(strtolower($k)) {
-                               case 'persist':
-                               case 'persistent':      $persist = $v; break;
-                               #ibase
-                               case 'dialect':         $obj->dialect = $v; 
break;
-                               case 'charset':         $obj->charset = $v; 
break;
-                               case 'buffers':         $obj->buffers = $v; 
break;
-                               #ado
-                               case 'charpage':        $obj->charPage = $v; 
break;
-                               #mysql
-                               case 'clientflags': $obj->clientFlags = $v; 
break;
-                               }
-                       }
-               } else {
-                       $persist = false;
-               }
-
-               if (isset($dsninfo['socket'])) $dsninfo['hostspec'] .= 
':'.$dsninfo['socket'];
-               else if (isset($dsninfo['port'])) $dsninfo['hostspec'] .= 
':'.$dsninfo['port'];
-               
-               if($persist) $ok = $obj->PConnect($dsninfo['hostspec'], 
$dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
-               else  $ok = $obj->Connect($dsninfo['hostspec'], 
$dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
-               
-               if (!$ok) $obj = ADODB_PEAR_Error();
-               return $obj;
-       }
-
-       /**
-        * Return the DB API version
-        *
-        * @return int the DB API version number
-        */
-       function apiVersion()
-       {
-               return 2;
-       }
-
-       /**
-        * Tell whether a result code from a DB method is an error
-        *
-        * @param $value int result code
-        *
-        * @return bool whether $value is an error
-        */
-       function isError($value)
-       {
-               if (!is_object($value)) return false;
-               $class = get_class($value);
-               return $class == 'pear_error' || is_subclass_of($value, 
'pear_error') || 
-                               $class == 'db_error' || is_subclass_of($value, 
'db_error');
-       }
-
-
-       /**
-        * Tell whether a result code from a DB method is a warning.
-        * Warnings differ from errors in that they are generated by DB,
-        * and are not fatal.
-        *
-        * @param $value mixed result value
-        *
-        * @return bool whether $value is a warning
-        */
-       function isWarning($value)
-       {
-               return false;
-               /*
-               return is_object($value) &&
-                       (get_class( $value ) == "db_warning" ||
-                        is_subclass_of($value, "db_warning"));*/
-       }
-
-       /**
-        * Parse a data source name
-        *
-        * @param $dsn string Data Source Name to be parsed
-        *
-        * @return array an associative array with the following keys:
-        *
-        *  phptype: Database backend used in PHP (mysql, odbc etc.)
-        *  dbsyntax: Database used with regards to SQL syntax etc.
-        *  protocol: Communication protocol to use (tcp, unix etc.)
-        *  hostspec: Host specification (hostname[:port])
-        *  database: Database to use on the DBMS server
-        *  username: User name for login
-        *  password: Password for login
-        *
-        * The format of the supplied DSN is in its fullest form:
-        *
-        *  phptype(dbsyntax)://username:password@protocol+hostspec/database
-        *
-        * Most variations are allowed:
-        *
-        *  phptype://username:password@protocol+hostspec:110//usr/db_file.db
-        *  phptype://username:password@hostspec/database_name
-        *  phptype://username:password@hostspec
-        *  phptype://username@hostspec
-        *  phptype://hostspec/database
-        *  phptype://hostspec
-        *  phptype(dbsyntax)
-        *  phptype
-        *
-        * @author Tomas V.V.Cox <cox-6/zrcuMSWPdBDgjK7y7TUQ@xxxxxxxxxxxxxxxx>
-        */
-       function parseDSN($dsn)
-       {
-               if (is_array($dsn)) {
-                       return $dsn;
-               }
-
-               $parsed = array(
-                       'phptype'  => false,
-                       'dbsyntax' => false,
-                       'protocol' => false,
-                       'hostspec' => false,
-                       'database' => false,
-                       'username' => false,
-                       'password' => false
-               );
-
-               // Find phptype and dbsyntax
-               if (($pos = strpos($dsn, '://')) !== false) {
-                       $str = substr($dsn, 0, $pos);
-                       $dsn = substr($dsn, $pos + 3);
-               } else {
-                       $str = $dsn;
-                       $dsn = NULL;
-               }
-
-               // Get phptype and dbsyntax
-               // $str => phptype(dbsyntax)
-               if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
-                       $parsed['phptype'] = $arr[1];
-                       $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : 
$arr[2];
-               } else {
-                       $parsed['phptype'] = $str;
-                       $parsed['dbsyntax'] = $str;
-               }
-
-               if (empty($dsn)) {
-                       return $parsed;
-               }
-
-               // Get (if found): username and password
-               // $dsn => username:password@protocol+hostspec/database
-               if (($at = strpos($dsn,'@')) !== false) {
-                       $str = substr($dsn, 0, $at);
-                       $dsn = substr($dsn, $at + 1);
-                       if (($pos = strpos($str, ':')) !== false) {
-                               $parsed['username'] = urldecode(substr($str, 0, 
$pos));
-                               $parsed['password'] = urldecode(substr($str, 
$pos + 1));
-                       } else {
-                               $parsed['username'] = urldecode($str);
-                       }
-               }
-
-               // Find protocol and hostspec
-               // $dsn => protocol+hostspec/database
-               if (($pos=strpos($dsn, '/')) !== false) {
-                       $str = substr($dsn, 0, $pos);
-                       $dsn = substr($dsn, $pos + 1);
-               } else {
-                       $str = $dsn;
-                       $dsn = NULL;
-               }
-
-               // Get protocol + hostspec
-               // $str => protocol+hostspec
-               if (($pos=strpos($str, '+')) !== false) {
-                       $parsed['protocol'] = substr($str, 0, $pos);
-                       $parsed['hostspec'] = urldecode(substr($str, $pos + 1));
-               } else {
-                       $parsed['hostspec'] = urldecode($str);
-               }
-
-               // Get dabase if any
-               // $dsn => database
-               if (!empty($dsn)) {
-                       $parsed['database'] = $dsn;
-               }
-
-               return $parsed;
-       }
-
-       /**
-        * Load a PHP database extension if it is not loaded already.
-        *
-        * @access public
-        *
-        * @param $name the base name of the extension (without the .so or
-        * .dll suffix)
-        *
-        * @return bool true if the extension was already or successfully
-        * loaded, false if it could not be loaded
-        */
-       function assertExtension($name)
-       {
-               if (!extension_loaded($name)) {
-                       $dlext = (strncmp(PHP_OS,'WIN',3) === 0) ? '.dll' : 
'.so';
-                       @dl($name . $dlext);
-               }
-               if (!extension_loaded($name)) {
-                       return false;
-               }
-               return true;
-       }
-}
-
+<?php
+/** 
+ * @version V4.60 24 Jan 2005 (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
+ * 
+ * PEAR DB Emulation Layer for ADODB.
+ *
+ * The following code is modelled on PEAR DB code by Stig Bakken 
<ssb-8gWjf/rZqUg@xxxxxxxxxxxxxxxx>                                              
                 |
+ * and Tomas V.V.Cox <cox-6/zrcuMSWPdBDgjK7y7TUQ@xxxxxxxxxxxxxxxx>.    
Portions (c)1997-2002 The PHP Group.
+ */
+
+ /*
+ We support:
+ 
+ DB_Common
+ ---------
+       query - returns PEAR_Error on error
+       limitQuery - return PEAR_Error on error
+       prepare - does not return PEAR_Error on error
+       execute - does not return PEAR_Error on error
+       setFetchMode - supports ASSOC and ORDERED
+       errorNative
+       quote
+       nextID
+       disconnect
+       
+       getOne
+       getAssoc
+       getRow
+       getCol
+       getAll
+       
+ DB_Result
+ ---------
+       numRows - returns -1 if not supported
+       numCols
+       fetchInto - does not support passing of fetchmode
+       fetchRows - does not support passing of fetchmode
+       free
+ */
+ 
+define('ADODB_PEAR',dirname(__FILE__));
+include_once "PEAR.php";
+include_once ADODB_PEAR."/adodb-errorpear.inc.php";
+include_once ADODB_PEAR."/adodb.inc.php";
+
+if (!defined('DB_OK')) {
+define("DB_OK",        1);
+define("DB_ERROR",-1);
+
+// autoExecute constants
+define('DB_AUTOQUERY_INSERT', 1);
+define('DB_AUTOQUERY_UPDATE', 2);
+
+/**
+ * This is a special constant that tells DB the user hasn't specified
+ * any particular get mode, so the default should be used.
+ */
+
+define('DB_FETCHMODE_DEFAULT', 0);
+
+/**
+ * Column data indexed by numbers, ordered from 0 and up
+ */
+
+define('DB_FETCHMODE_ORDERED', 1);
+
+/**
+ * Column data indexed by column names
+ */
+
+define('DB_FETCHMODE_ASSOC', 2);
+
+/* for compatibility */
+
+define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
+define('DB_GETMODE_ASSOC',   DB_FETCHMODE_ASSOC);
+
+/**
+ * these are constants for the tableInfo-function
+ * they are bitwised or'ed. so if there are more constants to be defined
+ * in the future, adjust DB_TABLEINFO_FULL accordingly
+ */
+
+define('DB_TABLEINFO_ORDER', 1);
+define('DB_TABLEINFO_ORDERTABLE', 2);
+define('DB_TABLEINFO_FULL', 3);
+}
+
+/**
+ * The main "DB" class is simply a container class with some static
+ * methods for creating DB objects as well as some utility functions
+ * common to all parts of DB.
+ *
+ */
+
+class DB
+{
+       /**
+        * Create a new DB object for the specified database type
+        *
+        * @param $type string database type, for example "mysql"
+        *
+        * @return object a newly created DB object, or a DB error code on
+        * error
+        */
+
+       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);
+               return $obj;
+       }
+
+       /**
+        * Create a new DB object and connect to the specified database
+        *
+        * @param $dsn mixed "data source name", see the DB::parseDSN
+        * method for a description of the dsn format.  Can also be
+        * specified as an array of the format returned by DB::parseDSN.
+        *
+        * @param $options mixed if boolean (or scalar), tells whether
+        * this connection should be persistent (for backends that support
+        * this).  This parameter can also be an array of options, see
+        * DB_common::setOption for more information on connection
+        * options.
+        *
+        * @return object a newly created DB connection object, or a DB
+        * error object on error
+        *
+        * @see DB::parseDSN
+        * @see DB::isError
+        */
+       function &connect($dsn, $options = false)
+       {
+               if (is_array($dsn)) {
+                       $dsninfo = $dsn;
+               } else {
+                       $dsninfo = DB::parseDSN($dsn);
+               }
+               switch ($dsninfo["phptype"]) {
+                       case 'pgsql':   $type = 'postgres7'; break;
+                       case 'ifx':             $type = 'informix9'; break;
+                       default:                $type = $dsninfo["phptype"]; 
break;
+               }
+
+               if (is_array($options) && isset($options["debug"]) &&
+                       $options["debug"] >= 2) {
+                       // expose php errors with sufficient debug level
+                        @include_once("adodb-$type.inc.php");
+               } else {
+                        @include_once("adodb-$type.inc.php");
+               }
+
+               @$obj =& NewADOConnection($type);
+               if (!is_object($obj)) {
+                       $obj =& new PEAR_Error('Unknown Database Driver: 
'.$dsninfo['phptype'],-1);
+                       return $obj;
+               }
+               if (is_array($options)) {
+                       foreach($options as $k => $v) {
+                               switch(strtolower($k)) {
+                               case 'persist':
+                               case 'persistent':      $persist = $v; break;
+                               #ibase
+                               case 'dialect':         $obj->dialect = $v; 
break;
+                               case 'charset':         $obj->charset = $v; 
break;
+                               case 'buffers':         $obj->buffers = $v; 
break;
+                               #ado
+                               case 'charpage':        $obj->charPage = $v; 
break;
+                               #mysql
+                               case 'clientflags': $obj->clientFlags = $v; 
break;
+                               }
+                       }
+               } else {
+                       $persist = false;
+               }
+
+               if (isset($dsninfo['socket'])) $dsninfo['hostspec'] .= 
':'.$dsninfo['socket'];
+               else if (isset($dsninfo['port'])) $dsninfo['hostspec'] .= 
':'.$dsninfo['port'];
+               
+               if($persist) $ok = $obj->PConnect($dsninfo['hostspec'], 
$dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
+               else  $ok = $obj->Connect($dsninfo['hostspec'], 
$dsninfo['username'],$dsninfo['password'],$dsninfo['database']);
+               
+               if (!$ok) $obj = ADODB_PEAR_Error();
+               return $obj;
+       }
+
+       /**
+        * Return the DB API version
+        *
+        * @return int the DB API version number
+        */
+       function apiVersion()
+       {
+               return 2;
+       }
+
+       /**
+        * Tell whether a result code from a DB method is an error
+        *
+        * @param $value int result code
+        *
+        * @return bool whether $value is an error
+        */
+       function isError($value)
+       {
+               if (!is_object($value)) return false;
+               $class = get_class($value);
+               return $class == 'pear_error' || is_subclass_of($value, 
'pear_error') || 
+                               $class == 'db_error' || is_subclass_of($value, 
'db_error');
+       }
+
+
+       /**
+        * Tell whether a result code from a DB method is a warning.
+        * Warnings differ from errors in that they are generated by DB,
+        * and are not fatal.
+        *
+        * @param $value mixed result value
+        *
+        * @return bool whether $value is a warning
+        */
+       function isWarning($value)
+       {
+               return false;
+               /*
+               return is_object($value) &&
+                       (get_class( $value ) == "db_warning" ||
+                        is_subclass_of($value, "db_warning"));*/
+       }
+
+       /**
+        * Parse a data source name
+        *
+        * @param $dsn string Data Source Name to be parsed
+        *
+        * @return array an associative array with the following keys:
+        *
+        *  phptype: Database backend used in PHP (mysql, odbc etc.)
+        *  dbsyntax: Database used with regards to SQL syntax etc.
+        *  protocol: Communication protocol to use (tcp, unix etc.)
+        *  hostspec: Host specification (hostname[:port])
+        *  database: Database to use on the DBMS server
+        *  username: User name for login
+        *  password: Password for login
+        *
+        * The format of the supplied DSN is in its fullest form:
+        *
+        *  phptype(dbsyntax)://username:password@protocol+hostspec/database
+        *
+        * Most variations are allowed:
+        *
+        *  phptype://username:password@protocol+hostspec:110//usr/db_file.db
+        *  phptype://username:password@hostspec/database_name
+        *  phptype://username:password@hostspec
+        *  phptype://username@hostspec
+        *  phptype://hostspec/database
+        *  phptype://hostspec
+        *  phptype(dbsyntax)
+        *  phptype
+        *
+        * @author Tomas V.V.Cox <cox-6/zrcuMSWPdBDgjK7y7TUQ@xxxxxxxxxxxxxxxx>
+        */
+       function parseDSN($dsn)
+       {
+               if (is_array($dsn)) {
+                       return $dsn;
+               }
+
+               $parsed = array(
+                       'phptype'  => false,
+                       'dbsyntax' => false,
+                       'protocol' => false,
+                       'hostspec' => false,
+                       'database' => false,
+                       'username' => false,
+                       'password' => false
+               );
+
+               // Find phptype and dbsyntax
+               if (($pos = strpos($dsn, '://')) !== false) {
+                       $str = substr($dsn, 0, $pos);
+                       $dsn = substr($dsn, $pos + 3);
+               } else {
+                       $str = $dsn;
+                       $dsn = NULL;
+               }
+
+               // Get phptype and dbsyntax
+               // $str => phptype(dbsyntax)
+               if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
+                       $parsed['phptype'] = $arr[1];
+                       $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : 
$arr[2];
+               } else {
+                       $parsed['phptype'] = $str;
+                       $parsed['dbsyntax'] = $str;
+               }
+
+               if (empty($dsn)) {
+                       return $parsed;
+               }
+
+               // Get (if found): username and password
+               // $dsn => username:password@protocol+hostspec/database
+               if (($at = strpos($dsn,'@')) !== false) {
+                       $str = substr($dsn, 0, $at);
+                       $dsn = substr($dsn, $at + 1);
+                       if (($pos = strpos($str, ':')) !== false) {
+                               $parsed['username'] = urldecode(substr($str, 0, 
$pos));
+                               $parsed['password'] = urldecode(substr($str, 
$pos + 1));
+                       } else {
+                               $parsed['username'] = urldecode($str);
+                       }
+               }
+
+               // Find protocol and hostspec
+               // $dsn => protocol+hostspec/database
+               if (($pos=strpos($dsn, '/')) !== false) {
+                       $str = substr($dsn, 0, $pos);
+                       $dsn = substr($dsn, $pos + 1);
+               } else {
+                       $str = $dsn;
+                       $dsn = NULL;
+               }
+
+               // Get protocol + hostspec
+               // $str => protocol+hostspec
+               if (($pos=strpos($str, '+')) !== false) {
+                       $parsed['protocol'] = substr($str, 0, $pos);
+                       $parsed['hostspec'] = urldecode(substr($str, $pos + 1));
+               } else {
+                       $parsed['hostspec'] = urldecode($str);
+               }
+
+               // Get dabase if any
+               // $dsn => database
+               if (!empty($dsn)) {
+                       $parsed['database'] = $dsn;
+               }
+
+               return $parsed;
+       }
+
+       /**
+        * Load a PHP database extension if it is not loaded already.
+        *
+        * @access public
+        *
+        * @param $name the base name of the extension (without the .so or
+        * .dll suffix)
+        *
+        * @return bool true if the extension was already or successfully
+        * loaded, false if it could not be loaded
+        */
+       function assertExtension($name)
+       {
+               if (!extension_loaded($name)) {
+                       $dlext = (strncmp(PHP_OS,'WIN',3) === 0) ? '.dll' : 
'.so';
+                       @dl($name . $dlext);
+               }
+               if (!extension_loaded($name)) {
+                       return false;
+               }
+               return true;
+       }
+}
+
 ?>
\ No newline at end of file

--- adodb-perf.inc.php.#.LENS-03-09-05 DELETED ---

Index: adodb-errorpear.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-errorpear.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-errorpear.inc.php     29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-errorpear.inc.php     27 Jan 2005 14:43:39 -0000      1.4
@@ -1,88 +1,88 @@
-<?php
-/** 
- * @version V4.50 6 July 2004 (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
- * 
- * Latest version is available at http://php.weblogs.com
- * 
-*/
-include_once('PEAR.php');
-
-if (!defined('ADODB_ERROR_HANDLER')) 
define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
-
-/*
-* Enabled the following if you want to terminate scripts when an error occurs
-*/
-//PEAR::setErrorHandling (PEAR_ERROR_DIE);
-
-/*
-* Name of the PEAR_Error derived class to call.
-*/
-if (!defined('ADODB_PEAR_ERROR_CLASS')) 
define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
-
-/*
-* Store the last PEAR_Error object here
-*/
-global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
-
-  /**
-* Error Handler with PEAR support. This will be called with the following 
params
-*
-* @param $dbms         the RDBMS you are connecting to
-* @param $fn           the name of the calling function (in uppercase)
-* @param $errno                the native error number from the database 
-* @param $errmsg       the native error msg from the database
-* @param $p1           $fn specific parameter - see below
-* @param $P2           $fn specific parameter - see below
-       */
-function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
-{
-global $ADODB_Last_PEAR_Error;
-       
-       if (error_reporting() == 0) return; // obey @ protocol
-       switch($fn) {
-       case 'EXECUTE':
-               $sql = $p1;
-               $inputparams = $p2;
-               
-               $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
-               break;
-               
-       case 'PCONNECT':
-       case 'CONNECT':
-               $host = $p1;
-               $database = $p2;
-               
-               $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, 
'$database')";
-               break;
-               
-       default:
-               $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
-               break;
-       }
-       
-       $class = ADODB_PEAR_ERROR_CLASS;
-       $ADODB_Last_PEAR_Error = new $class($s, $errno,
-               $GLOBALS['_PEAR_default_error_mode'],
-               $GLOBALS['_PEAR_default_error_options'], 
-               $errmsg);
-               
-       //print "<p>!$s</p>";
-}
-
-/**
-* Returns last PEAR_Error object. This error might be for an error that
-* occured several sql statements ago.
-*/
-function &ADODB_PEAR_Error()
-{
-global $ADODB_Last_PEAR_Error;
-
-       return $ADODB_Last_PEAR_Error;
-}
-               
+<?php
+/** 
+ * @version V4.50 6 July 2004 (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
+ * 
+ * Latest version is available at http://php.weblogs.com
+ * 
+*/
+include_once('PEAR.php');
+
+if (!defined('ADODB_ERROR_HANDLER')) 
define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
+
+/*
+* Enabled the following if you want to terminate scripts when an error occurs
+*/
+//PEAR::setErrorHandling (PEAR_ERROR_DIE);
+
+/*
+* Name of the PEAR_Error derived class to call.
+*/
+if (!defined('ADODB_PEAR_ERROR_CLASS')) 
define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
+
+/*
+* Store the last PEAR_Error object here
+*/
+global $ADODB_Last_PEAR_Error; $ADODB_Last_PEAR_Error = false;
+
+  /**
+* Error Handler with PEAR support. This will be called with the following 
params
+*
+* @param $dbms         the RDBMS you are connecting to
+* @param $fn           the name of the calling function (in uppercase)
+* @param $errno                the native error number from the database 
+* @param $errmsg       the native error msg from the database
+* @param $p1           $fn specific parameter - see below
+* @param $P2           $fn specific parameter - see below
+       */
+function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
+{
+global $ADODB_Last_PEAR_Error;
+       
+       if (error_reporting() == 0) return; // obey @ protocol
+       switch($fn) {
+       case 'EXECUTE':
+               $sql = $p1;
+               $inputparams = $p2;
+               
+               $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
+               break;
+               
+       case 'PCONNECT':
+       case 'CONNECT':
+               $host = $p1;
+               $database = $p2;
+               
+               $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, 
'$database')";
+               break;
+               
+       default:
+               $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
+               break;
+       }
+       
+       $class = ADODB_PEAR_ERROR_CLASS;
+       $ADODB_Last_PEAR_Error = new $class($s, $errno,
+               $GLOBALS['_PEAR_default_error_mode'],
+               $GLOBALS['_PEAR_default_error_options'], 
+               $errmsg);
+               
+       //print "<p>!$s</p>";
+}
+
+/**
+* Returns last PEAR_Error object. This error might be for an error that
+* occured several sql statements ago.
+*/
+function &ADODB_PEAR_Error()
+{
+global $ADODB_Last_PEAR_Error;
+
+       return $ADODB_Last_PEAR_Error;
+}
+               
 ?>
\ No newline at end of file

Index: adodb-lib.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-lib.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-lib.inc.php   29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-lib.inc.php   27 Jan 2005 14:43:39 -0000      1.4
@@ -1,892 +1,897 @@
-<?php
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-global $ADODB_INCLUDED_LIB;
-$ADODB_INCLUDED_LIB = 1;
-
-/* 
- @version V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim\@natsoft.com.my). All 
rights reserved.
-  Released under both BSD license and Lesser GPL library license. 
[...1758 lines suppressed...]
+                               $str = 
htmlspecialchars(substr($v,0,$MAXSTRLEN));
+                               if (strlen($v) > $MAXSTRLEN) $str .= '...';
+                               $args[] = $str;
+                       }
+               }
+               $s .= $arr['function'].'('.implode(', ',$args).')';
+               
+               
+               $s .= @sprintf($fmt, 
$arr['line'],$arr['file'],basename($arr['file']));
+                       
+               $s .= "\n";
+       }       
+       if ($html) $s .= '</pre>';
+       if ($printOrArr) print $s;
+       
+       return $s;
+}
+
 ?>
\ No newline at end of file

Index: adodb-csvlib.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-csvlib.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-csvlib.inc.php        29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-csvlib.inc.php        27 Jan 2005 14:43:39 -0000      1.4
@@ -1,307 +1,311 @@
-<?php
-
-// security - hide paths
-if (!defined('ADODB_DIR')) die();
-
-global $ADODB_INCLUDED_CSV;
-$ADODB_INCLUDED_CSV = 1;
-
-/* 
-
-  V4.54 5 Nov 2004  (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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. 
-  Set tabs to 4 for best viewing.
-  
-  Latest version is available at http://adodb.sourceforge.net
-  
-  Library for CSV serialization. This is used by the csv/proxy driver and is 
the 
-  CacheExecute() serialization format. 
-  
-  ==== NOTE ====
-  Format documented at http://php.weblogs.com/ADODB_CSV
-  ==============
-*/
-
-       /**
-        * convert a recordset into special format
-        *
-        * @param rs    the recordset
-        *
-        * @return      the CSV formated data
-        */
-       function _rs2serialize(&$rs,$conn=false,$sql='')
-       {
-               $max = ($rs) ? $rs->FieldCount() : 0;
-               
-               if ($sql) $sql = urlencode($sql);
-               // metadata setup
-               
-               if ($max <= 0 || $rs->dataProvider == 'empty') { // is 
insert/update/delete
-                       if (is_object($conn)) {
-                               $sql .= ','.$conn->Affected_Rows();
-                               $sql .= ','.$conn->Insert_ID();
-                       } else
-                               $sql .= ',,';
-                       
-                       $text = "====-1,0,$sql\n";
-                       return $text;
-               }
-               $tt = ($rs->timeCreated) ? $rs->timeCreated : time();
-               
-               ## changed format from ====0 to ====1
-               $line = "====1,$tt,$sql\n";
-               
-               if ($rs->databaseType == 'array') {
-                       $rows =& $rs->_array;
-               } else {
-                       $rows = array();
-                       while (!$rs->EOF) {     
-                               $rows[] = $rs->fields;
-                               $rs->MoveNext();
-                       } 
-               }
-               
-               for($i=0; $i < $max; $i++) {
-                       $o =& $rs->FetchField($i);
-                       $flds[] = $o;
-               }
-       
-               $savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : 
$rs->fetchMode;
-               $rs =& new ADORecordSet_array();
-               $rs->InitArrayFields($rows,$flds);
-               $rs->fetchMode = $savefetch;
-               return $line.serialize($rs);
-       }
-
-       
-/**
-* Open CSV file and convert it into Data. 
-*
-* @param url           file/ftp/http url
-* @param err           returns the error message
-* @param timeout       dispose if recordset has been alive for $timeout secs
-*
-* @return              recordset, or false if error occured. If no
-*                      error occurred in sql INSERT/UPDATE/DELETE, 
-*                      empty recordset is returned
-*/
-       function &csv2rs($url,&$err,$timeout=0)
-       {
-               $err = false;
-               $fp = @fopen($url,'rb');
-               if (!$fp) {
-                       $err = $url.' file/URL not found';
-                       return false;
-               }
-               flock($fp, LOCK_SH);
-               $arr = array();
-               $ttl = 0;
-               
-               if ($meta = fgetcsv($fp, 32000, ",")) {
-                       // check if error message
-                       if (strncmp($meta[0],'****',4) === 0) {
-                               $err = trim(substr($meta[0],4,1024));
-                               fclose($fp);
-                               return false;
-                       }
-                       // check for meta data
-                       // $meta[0] is -1 means return an empty recordset
-                       // $meta[1] contains a time 
-       
-                       if (strncmp($meta[0], '====',4) === 0) {
-                       
-                               if ($meta[0] == "====-1") {
-                                       if (sizeof($meta) < 5) {
-                                               $err = "Corrupt first line for 
format -1";
-                                               fclose($fp);
-                                               return false;
-                                       }
-                                       fclose($fp);
-                                       
-                                       if ($timeout > 0) {
-                                               $err = " Illegal Timeout 
$timeout ";
-                                               return false;
-                                       }
-                                       $rs->fields = array();
-                                       $rs->timeCreated = $meta[1];
-                                       $rs =& new ADORecordSet($val=true);
-                                       $rs->EOF = true;
-                                       $rs->_numOfFields=0;
-                                       $rs->sql = urldecode($meta[2]);
-                                       $rs->affectedrows = (integer)$meta[3];
-                                       $rs->insertid = $meta[4];       
-                                       return $rs;
-                               } 
-                       # Under high volume loads, we want only 1 
thread/process to _write_file
-                       # so that we don't have 50 processes queueing to write 
the same data.
-                       # We use probabilistic timeout, ahead of time.
-                       #
-                       # -4 sec before timeout, give processes 1/32 chance of 
timing out
-                       # -2 sec before timeout, give processes 1/16 chance of 
timing out
-                       # -1 sec after timeout give processes 1/4 chance of 
timing out
-                       # +0 sec after timeout, give processes 100% chance of 
timing out
-                               if (sizeof($meta) > 1) {
-                                       if($timeout >0){ 
-                                               $tdiff = (integer)( 
$meta[1]+$timeout - time());
-                                               if ($tdiff <= 2) {
-                                                       switch($tdiff) {
-                                                       case 4:
-                                                       case 3:
-                                                               if ((rand() & 
31) == 0) {
-                                                                       
fclose($fp);
-                                                                       $err = 
"Timeout 3";
-                                                                       return 
false;
-                                                               }
-                                                               break;
-                                                       case 2: 
-                                                               if ((rand() & 
15) == 0) {
-                                                                       
fclose($fp);
-                                                                       $err = 
"Timeout 2";
-                                                                       return 
false;
-                                                               }
-                                                               break;
-                                                       case 1:
-                                                               if ((rand() & 
3) == 0) {
-                                                                       
fclose($fp);
-                                                                       $err = 
"Timeout 1";
-                                                                       return 
false;
-                                                               }
-                                                               break;
-                                                       default: 
-                                                               fclose($fp);
-                                                               $err = "Timeout 
0";
-                                                               return false;
-                                                       } // switch
-                                                       
-                                               } // if check flush cache
-                                       }// (timeout>0)
-                                       $ttl = $meta[1];
-                               }
-                               
//================================================
-                               // new cache format - use serialize 
extensively...
-                               if ($meta[0] === '====1') {
-                                       // slurp in the data
-                                       $MAXSIZE = 128000;
-                                       
-                                       $text = fread($fp,$MAXSIZE);
-                                       if (strlen($text)) {
-                                               while ($txt = 
fread($fp,$MAXSIZE)) {
-                                                       $text .= $txt;
-                                               }
-                                       }
-                                       fclose($fp);
-                                       $rs = unserialize($text);
-                                       if (is_object($rs)) $rs->timeCreated = 
$ttl;
-                                       else {
-                                               $err = "Unable to unserialize 
recordset";
-                                               //echo 
htmlspecialchars($text),' !--END--!<p>';
-                                       }
-                                       return $rs;
-                               }
-                               
-                               $meta = false;
-                               $meta = fgetcsv($fp, 32000, ",");
-                               if (!$meta) {
-                                       fclose($fp);
-                                       $err = "Unexpected EOF 1";
-                                       return false;
-                               }
-                       }
-
-                       // Get Column definitions
-                       $flds = array();
-                       foreach($meta as $o) {
-                               $o2 = explode(':',$o);
-                               if (sizeof($o2)!=3) {
-                                       $arr[] = $meta;
-                                       $flds = false;
-                                       break;
-                               }
-                               $fld =& new ADOFieldObject();
-                               $fld->name = urldecode($o2[0]);
-                               $fld->type = $o2[1];
-                               $fld->max_length = $o2[2];
-                               $flds[] = $fld;
-                       }
-               } else {
-                       fclose($fp);
-                       $err = "Recordset had unexpected EOF 2";
-                       return false;
-               }
-               
-               // slurp in the data
-               $MAXSIZE = 128000;
-               
-               $text = '';
-               while ($txt = fread($fp,$MAXSIZE)) {
-                       $text .= $txt;
-               }
-                       
-               fclose($fp);
-               @$arr = unserialize($text);
-               //var_dump($arr);
-               if (!is_array($arr)) {
-                       $err = "Recordset had unexpected EOF (in serialized 
recordset)";
-                       if (get_magic_quotes_runtime()) $err .= ". Magic Quotes 
Runtime should be disabled!";
-                       return false;
-               }
-               $rs =& new ADORecordSet_array();
-               $rs->timeCreated = $ttl;
-               $rs->InitArrayFields($arr,$flds);
-               return $rs;
-       }
-       
-
-       /**
-       * Save a file $filename and its $contents (normally for caching) with 
file locking
-       */
-       function adodb_write_file($filename, $contents,$debug=false)
-       { 
-       # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows
-       # So to simulate locking, we assume that rename is an atomic operation.
-       # First we delete $filename, then we create a $tempfile write to it and 
-       # rename to the desired $filename. If the rename works, then we 
successfully 
-       # modified the file exclusively.
-       # What a stupid need - having to simulate locking.
-       # Risks:
-       # 1. $tempfile name is not unique -- very very low
-       # 2. unlink($filename) fails -- ok, rename will fail
-       # 3. adodb reads stale file because unlink fails -- ok, $rs timeout 
occurs
-       # 4. another process creates $filename between unlink() and rename() -- 
ok, rename() fails and  cache updated
-               if (strncmp(PHP_OS,'WIN',3) === 0) {
-                       // skip the decimal place
-                       $mtime = substr(str_replace(' ','_',microtime()),2); 
-                       // getmypid() actually returns 0 on Win98 - never mind!
-                       $tmpname = $filename.uniqid($mtime).getmypid();
-                       if (!($fd = fopen($tmpname,'a'))) return false;
-                       $ok = ftruncate($fd,0);                 
-                       if (!fwrite($fd,$contents)) $ok = false;
-                       fclose($fd);
-                       chmod($tmpname,0644);
-                       // the tricky moment
-                       @unlink($filename);
-                       if (!@rename($tmpname,$filename)) {
-                               unlink($tmpname);
-                               $ok = false;
-                       }
-                       if (!$ok) {
-                               if ($debug) ADOConnection::outp( " Rename 
$tmpname ".($ok? 'ok' : 'failed'));
-                       }
-                       return $ok;
-               }
-               if (!($fd = fopen($filename, 'a'))) return false;
-               if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) {
-                       $ok = fwrite( $fd, $contents );
-                       fclose($fd);
-                       chmod($filename,0644);
-               }else {
-                       fclose($fd);
-                       if ($debug)ADOConnection::outp( " Failed acquiring lock 
for $filename<br>\n");
-                       $ok = false;
-               }
-       
-               return $ok;
-       }
+<?php
+
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
+global $ADODB_INCLUDED_CSV;
+$ADODB_INCLUDED_CSV = 1;
+
+/* 
+
+  V4.60 24 Jan 2005  (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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. 
+  Set tabs to 4 for best viewing.
+  
+  Latest version is available at http://adodb.sourceforge.net
+  
+  Library for CSV serialization. This is used by the csv/proxy driver and is 
the 
+  CacheExecute() serialization format. 
+  
+  ==== NOTE ====
+  Format documented at http://php.weblogs.com/ADODB_CSV
+  ==============
+*/
+
+       /**
+        * convert a recordset into special format
+        *
+        * @param rs    the recordset
+        *
+        * @return      the CSV formated data
+        */
+       function _rs2serialize(&$rs,$conn=false,$sql='')
+       {
+               $max = ($rs) ? $rs->FieldCount() : 0;
+               
+               if ($sql) $sql = urlencode($sql);
+               // metadata setup
+               
+               if ($max <= 0 || $rs->dataProvider == 'empty') { // is 
insert/update/delete
+                       if (is_object($conn)) {
+                               $sql .= ','.$conn->Affected_Rows();
+                               $sql .= ','.$conn->Insert_ID();
+                       } else
+                               $sql .= ',,';
+                       
+                       $text = "====-1,0,$sql\n";
+                       return $text;
+               }
+               $tt = ($rs->timeCreated) ? $rs->timeCreated : time();
+               
+               ## changed format from ====0 to ====1
+               $line = "====1,$tt,$sql\n";
+               
+               if ($rs->databaseType == 'array') {
+                       $rows =& $rs->_array;
+               } else {
+                       $rows = array();
+                       while (!$rs->EOF) {     
+                               $rows[] = $rs->fields;
+                               $rs->MoveNext();
+                       } 
+               }
+               
+               for($i=0; $i < $max; $i++) {
+                       $o =& $rs->FetchField($i);
+                       $flds[] = $o;
+               }
+       
+               $savefetch = isset($rs->adodbFetchMode) ? $rs->adodbFetchMode : 
$rs->fetchMode;
+               $class = $rs->connection->arrayClass;
+               $rs2 =& new $class();
+               $rs2->sql = $rs->sql;
+               $rs2->oldProvider = $rs->dataProvider; 
+               $rs2->InitArrayFields($rows,$flds);
+               $rs2->fetchMode = $savefetch;
+               return $line.serialize($rs2);
+       }
+
+       
+/**
+* Open CSV file and convert it into Data. 
+*
+* @param url           file/ftp/http url
+* @param err           returns the error message
+* @param timeout       dispose if recordset has been alive for $timeout secs
+*
+* @return              recordset, or false if error occured. If no
+*                      error occurred in sql INSERT/UPDATE/DELETE, 
+*                      empty recordset is returned
+*/
+       function &csv2rs($url,&$err,$timeout=0, $rsclass='ADORecordSet_array')
+       {
+               $err = false;
+               $fp = @fopen($url,'rb');
+               if (!$fp) {
+                       $err = $url.' file/URL not found';
+                       return false;
+               }
+               flock($fp, LOCK_SH);
+               $arr = array();
+               $ttl = 0;
+               
+               if ($meta = fgetcsv($fp, 32000, ",")) {
+                       // check if error message
+                       if (strncmp($meta[0],'****',4) === 0) {
+                               $err = trim(substr($meta[0],4,1024));
+                               fclose($fp);
+                               return false;
+                       }
+                       // check for meta data
+                       // $meta[0] is -1 means return an empty recordset
+                       // $meta[1] contains a time 
+       
+                       if (strncmp($meta[0], '====',4) === 0) {
+                       
+                               if ($meta[0] == "====-1") {
+                                       if (sizeof($meta) < 5) {
+                                               $err = "Corrupt first line for 
format -1";
+                                               fclose($fp);
+                                               return false;
+                                       }
+                                       fclose($fp);
+                                       
+                                       if ($timeout > 0) {
+                                               $err = " Illegal Timeout 
$timeout ";
+                                               return false;
+                                       }
+                                       
+                                       $rs =& new $rsclass($val=true);
+                                       $rs->fields = array();
+                                       $rs->timeCreated = $meta[1];
+                                       $rs->EOF = true;
+                                       $rs->_numOfFields = 0;
+                                       $rs->sql = urldecode($meta[2]);
+                                       $rs->affectedrows = (integer)$meta[3];
+                                       $rs->insertid = $meta[4];       
+                                       return $rs;
+                               } 
+                       # Under high volume loads, we want only 1 
thread/process to _write_file
+                       # so that we don't have 50 processes queueing to write 
the same data.
+                       # We use probabilistic timeout, ahead of time.
+                       #
+                       # -4 sec before timeout, give processes 1/32 chance of 
timing out
+                       # -2 sec before timeout, give processes 1/16 chance of 
timing out
+                       # -1 sec after timeout give processes 1/4 chance of 
timing out
+                       # +0 sec after timeout, give processes 100% chance of 
timing out
+                               if (sizeof($meta) > 1) {
+                                       if($timeout >0){ 
+                                               $tdiff = (integer)( 
$meta[1]+$timeout - time());
+                                               if ($tdiff <= 2) {
+                                                       switch($tdiff) {
+                                                       case 4:
+                                                       case 3:
+                                                               if ((rand() & 
31) == 0) {
+                                                                       
fclose($fp);
+                                                                       $err = 
"Timeout 3";
+                                                                       return 
false;
+                                                               }
+                                                               break;
+                                                       case 2: 
+                                                               if ((rand() & 
15) == 0) {
+                                                                       
fclose($fp);
+                                                                       $err = 
"Timeout 2";
+                                                                       return 
false;
+                                                               }
+                                                               break;
+                                                       case 1:
+                                                               if ((rand() & 
3) == 0) {
+                                                                       
fclose($fp);
+                                                                       $err = 
"Timeout 1";
+                                                                       return 
false;
+                                                               }
+                                                               break;
+                                                       default: 
+                                                               fclose($fp);
+                                                               $err = "Timeout 
0";
+                                                               return false;
+                                                       } // switch
+                                                       
+                                               } // if check flush cache
+                                       }// (timeout>0)
+                                       $ttl = $meta[1];
+                               }
+                               
//================================================
+                               // new cache format - use serialize 
extensively...
+                               if ($meta[0] === '====1') {
+                                       // slurp in the data
+                                       $MAXSIZE = 128000;
+                                       
+                                       $text = fread($fp,$MAXSIZE);
+                                       if (strlen($text)) {
+                                               while ($txt = 
fread($fp,$MAXSIZE)) {
+                                                       $text .= $txt;
+                                               }
+                                       }
+                                       fclose($fp);
+                                       $rs = unserialize($text);
+                                       if (is_object($rs)) $rs->timeCreated = 
$ttl;
+                                       else {
+                                               $err = "Unable to unserialize 
recordset";
+                                               //echo 
htmlspecialchars($text),' !--END--!<p>';
+                                       }
+                                       return $rs;
+                               }
+                               
+                               $meta = false;
+                               $meta = fgetcsv($fp, 32000, ",");
+                               if (!$meta) {
+                                       fclose($fp);
+                                       $err = "Unexpected EOF 1";
+                                       return false;
+                               }
+                       }
+
+                       // Get Column definitions
+                       $flds = array();
+                       foreach($meta as $o) {
+                               $o2 = explode(':',$o);
+                               if (sizeof($o2)!=3) {
+                                       $arr[] = $meta;
+                                       $flds = false;
+                                       break;
+                               }
+                               $fld =& new ADOFieldObject();
+                               $fld->name = urldecode($o2[0]);
+                               $fld->type = $o2[1];
+                               $fld->max_length = $o2[2];
+                               $flds[] = $fld;
+                       }
+               } else {
+                       fclose($fp);
+                       $err = "Recordset had unexpected EOF 2";
+                       return false;
+               }
+               
+               // slurp in the data
+               $MAXSIZE = 128000;
+               
+               $text = '';
+               while ($txt = fread($fp,$MAXSIZE)) {
+                       $text .= $txt;
+               }
+                       
+               fclose($fp);
+               @$arr = unserialize($text);
+               //var_dump($arr);
+               if (!is_array($arr)) {
+                       $err = "Recordset had unexpected EOF (in serialized 
recordset)";
+                       if (get_magic_quotes_runtime()) $err .= ". Magic Quotes 
Runtime should be disabled!";
+                       return false;
+               }
+               $rs =& new $rsclass();
+               $rs->timeCreated = $ttl;
+               $rs->InitArrayFields($arr,$flds);
+               return $rs;
+       }
+       
+
+       /**
+       * Save a file $filename and its $contents (normally for caching) with 
file locking
+       */
+       function adodb_write_file($filename, $contents,$debug=false)
+       { 
+       # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows
+       # So to simulate locking, we assume that rename is an atomic operation.
+       # First we delete $filename, then we create a $tempfile write to it and 
+       # rename to the desired $filename. If the rename works, then we 
successfully 
+       # modified the file exclusively.
+       # What a stupid need - having to simulate locking.
+       # Risks:
+       # 1. $tempfile name is not unique -- very very low
+       # 2. unlink($filename) fails -- ok, rename will fail
+       # 3. adodb reads stale file because unlink fails -- ok, $rs timeout 
occurs
+       # 4. another process creates $filename between unlink() and rename() -- 
ok, rename() fails and  cache updated
+               if (strncmp(PHP_OS,'WIN',3) === 0) {
+                       // skip the decimal place
+                       $mtime = substr(str_replace(' ','_',microtime()),2); 
+                       // getmypid() actually returns 0 on Win98 - never mind!
+                       $tmpname = $filename.uniqid($mtime).getmypid();
+                       if (!($fd = fopen($tmpname,'a'))) return false;
+                       $ok = ftruncate($fd,0);                 
+                       if (!fwrite($fd,$contents)) $ok = false;
+                       fclose($fd);
+                       chmod($tmpname,0644);
+                       // the tricky moment
+                       @unlink($filename);
+                       if (!@rename($tmpname,$filename)) {
+                               unlink($tmpname);
+                               $ok = false;
+                       }
+                       if (!$ok) {
+                               if ($debug) ADOConnection::outp( " Rename 
$tmpname ".($ok? 'ok' : 'failed'));
+                       }
+                       return $ok;
+               }
+               if (!($fd = fopen($filename, 'a'))) return false;
+               if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) {
+                       $ok = fwrite( $fd, $contents );
+                       fclose($fd);
+                       chmod($filename,0644);
+               }else {
+                       fclose($fd);
+                       if ($debug)ADOConnection::outp( " Failed acquiring lock 
for $filename<br>\n");
+                       $ok = false;
+               }
+       
+               return $ok;
+       }
 ?>
\ No newline at end of file

Index: adodb-datadict.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-datadict.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-datadict.inc.php      29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-datadict.inc.php      27 Jan 2005 14:43:39 -0000      1.4
@@ -1,735 +1,771 @@
-<?php
-
-/**
-  V4.54 5 Nov 2004  (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
- 
-       DOCUMENTATION:
[...1475 lines suppressed...]
+
+               foreach ( $lines as $id => $v ) {
+                       if ( isset($cols[$id]) && is_object($cols[$id]) ) {
+                       
+                               $flds = Lens_ParseArgs($v,',');
+                               
+                               //  We are trying to change the size of the 
field, if not allowed, simply ignore the request.
+                               if ($flds && 
in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)) 
continue;         
+                       
+                               $sql[] = $alter . $this->alterCol . ' ' . $v;
+                       } else {
+                               $sql[] = $alter . $this->addCol . ' ' . $v;
+                       }
+               }
+               
+               return $sql;
+       }
+} // class
 ?>
\ No newline at end of file

Index: toexport.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/toexport.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- toexport.inc.php    29 Nov 2004 22:54:45 -0000      1.3
+++ toexport.inc.php    27 Jan 2005 14:43:40 -0000      1.4
@@ -1,133 +1,133 @@
-<?php
-
-/** 
- * @version V4.54 5 Nov 2004 (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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. 
- *
- * Code to export recordsets in several formats:
- *
- * AS VARIABLE
- * $s = rs2csv($rs); # comma-separated values
- * $s = rs2tab($rs); # tab delimited
- * 
- * TO A FILE
- * $f = fopen($path,'w');
- * rs2csvfile($rs,$f);
- * fclose($f);
- *
- * TO STDOUT
- * rs2csvout($rs);
- */
- 
-// returns a recordset as a csv string
-function rs2csv(&$rs,$addtitles=true)
-{
-       return _adodb_export($rs,',',',',false,$addtitles);
-}
-
-// writes recordset to csv file 
-function rs2csvfile(&$rs,$fp,$addtitles=true)
-{
-       _adodb_export($rs,',',',',$fp,$addtitles);
-}
-
-// write recordset as csv string to stdout
-function rs2csvout(&$rs,$addtitles=true)
-{
-       $fp = fopen('php://stdout','wb');
-       _adodb_export($rs,',',',',true,$addtitles);
-       fclose($fp);
-}
-
-function rs2tab(&$rs,$addtitles=true)
-{
-       return _adodb_export($rs,"\t",',',false,$addtitles);
-}
-
-// to file pointer
-function rs2tabfile(&$rs,$fp,$addtitles=true)
-{
-       _adodb_export($rs,"\t",',',$fp,$addtitles);
-}
-
-// to stdout
-function rs2tabout(&$rs,$addtitles=true)
-{
-       $fp = fopen('php://stdout','wb');
-       _adodb_export($rs,"\t",' ',true,$addtitles);
-       if ($fp) fclose($fp);
-}
-
-function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote 
= '"',$escquote = '"',$replaceNewLine = ' ')
-{
-       if (!$rs) return '';
-       //----------
-       // CONSTANTS
-       $NEWLINE = "\r\n";
-       $BUFLINES = 100;
-       $escquotequote = $escquote.$quote;
-       $s = '';
-       
-       if ($addtitles) {
-               $fieldTypes = $rs->FieldTypesArray();
-               reset($fieldTypes);
-               while(list(,$o) = each($fieldTypes)) {
-                       
-                       $v = $o->name;
-                       if ($escquote) $v = 
str_replace($quote,$escquotequote,$v);
-                       $v = 
strip_tags(str_replace("\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)));
-                       $elements[] = $v;
-                       
-               }
-               $s .= implode($sep, $elements).$NEWLINE;
-       }
-       $hasNumIndex = isset($rs->fields[0]);
-       
-       $line = 0;
-       $max = $rs->FieldCount();
-       
-       while (!$rs->EOF) {
-               $elements = array();
-               $i = 0;
-               
-               if ($hasNumIndex) {
-                       for ($j=0; $j < $max; $j++) {
-                               $v = $rs->fields[$j];
-                               if (!is_object($v)) $v = trim($v);
-                               else $v = 'Object';
-                               if ($escquote) $v = 
str_replace($quote,$escquotequote,$v);
-                               $v = 
strip_tags(str_replace("\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)));
-                               
-                               if (strpos($v,$sep) !== false || 
strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
-                               else $elements[] = $v;
-                       }
-               } else { // ASSOCIATIVE ARRAY
-                       foreach($rs->fields as $v) {
-                               if ($escquote) $v = 
str_replace($quote,$escquotequote,trim($v));
-                               $v = 
strip_tags(str_replace("\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)));
-                               
-                               if (strpos($v,$sep) !== false || 
strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
-                               else $elements[] = $v;
-                       }
-               }
-               $s .= implode($sep, $elements).$NEWLINE;
-               $rs->MoveNext();
-               $line += 1;
-               if ($fp && ($line % $BUFLINES) == 0) {
-                       if ($fp === true) echo $s;
-                       else fwrite($fp,$s);
-                       $s = '';
-               }
-       }
-       
-       if ($fp) {
-               if ($fp === true) echo $s;
-               else fwrite($fp,$s);
-               $s = '';
-       }
-       
-       return $s;
-}
+<?php
+
+/** 
+ * @version V4.60 24 Jan 2005 (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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. 
+ *
+ * Code to export recordsets in several formats:
+ *
+ * AS VARIABLE
+ * $s = rs2csv($rs); # comma-separated values
+ * $s = rs2tab($rs); # tab delimited
+ * 
+ * TO A FILE
+ * $f = fopen($path,'w');
+ * rs2csvfile($rs,$f);
+ * fclose($f);
+ *
+ * TO STDOUT
+ * rs2csvout($rs);
+ */
+ 
+// returns a recordset as a csv string
+function rs2csv(&$rs,$addtitles=true)
+{
+       return _adodb_export($rs,',',',',false,$addtitles);
+}
+
+// writes recordset to csv file 
+function rs2csvfile(&$rs,$fp,$addtitles=true)
+{
+       _adodb_export($rs,',',',',$fp,$addtitles);
+}
+
+// write recordset as csv string to stdout
+function rs2csvout(&$rs,$addtitles=true)
+{
+       $fp = fopen('php://stdout','wb');
+       _adodb_export($rs,',',',',true,$addtitles);
+       fclose($fp);
+}
+
+function rs2tab(&$rs,$addtitles=true)
+{
+       return _adodb_export($rs,"\t",',',false,$addtitles);
+}
+
+// to file pointer
+function rs2tabfile(&$rs,$fp,$addtitles=true)
+{
+       _adodb_export($rs,"\t",',',$fp,$addtitles);
+}
+
+// to stdout
+function rs2tabout(&$rs,$addtitles=true)
+{
+       $fp = fopen('php://stdout','wb');
+       _adodb_export($rs,"\t",' ',true,$addtitles);
+       if ($fp) fclose($fp);
+}
+
+function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote 
= '"',$escquote = '"',$replaceNewLine = ' ')
+{
+       if (!$rs) return '';
+       //----------
+       // CONSTANTS
+       $NEWLINE = "\r\n";
+       $BUFLINES = 100;
+       $escquotequote = $escquote.$quote;
+       $s = '';
+       
+       if ($addtitles) {
+               $fieldTypes = $rs->FieldTypesArray();
+               reset($fieldTypes);
+               while(list(,$o) = each($fieldTypes)) {
+                       
+                       $v = $o->name;
+                       if ($escquote) $v = 
str_replace($quote,$escquotequote,$v);
+                       $v = strip_tags(str_replace("\n", $replaceNewLine, 
str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
+                       $elements[] = $v;
+                       
+               }
+               $s .= implode($sep, $elements).$NEWLINE;
+       }
+       $hasNumIndex = isset($rs->fields[0]);
+       
+       $line = 0;
+       $max = $rs->FieldCount();
+       
+       while (!$rs->EOF) {
+               $elements = array();
+               $i = 0;
+               
+               if ($hasNumIndex) {
+                       for ($j=0; $j < $max; $j++) {
+                               $v = $rs->fields[$j];
+                               if (!is_object($v)) $v = trim($v);
+                               else $v = 'Object';
+                               if ($escquote) $v = 
str_replace($quote,$escquotequote,$v);
+                               $v = strip_tags(str_replace("\n", 
$replaceNewLine, 
str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
+                               
+                               if (strpos($v,$sep) !== false || 
strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
+                               else $elements[] = $v;
+                       }
+               } else { // ASSOCIATIVE ARRAY
+                       foreach($rs->fields as $v) {
+                               if ($escquote) $v = 
str_replace($quote,$escquotequote,trim($v));
+                               $v = strip_tags(str_replace("\n", 
$replaceNewLine, 
str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
+                               
+                               if (strpos($v,$sep) !== false || 
strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
+                               else $elements[] = $v;
+                       }
+               }
+               $s .= implode($sep, $elements).$NEWLINE;
+               $rs->MoveNext();
+               $line += 1;
+               if ($fp && ($line % $BUFLINES) == 0) {
+                       if ($fp === true) echo $s;
+                       else fwrite($fp,$s);
+                       $s = '';
+               }
+       }
+       
+       if ($fp) {
+               if ($fp === true) echo $s;
+               else fwrite($fp,$s);
+               $s = '';
+       }
+       
+       return $s;
+}
 ?>
\ No newline at end of file

Index: adodb-error.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-error.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-error.inc.php 29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-error.inc.php 27 Jan 2005 14:43:39 -0000      1.4
@@ -1,257 +1,257 @@
-<?php
-/** 
- * @version V4.54 5 Nov 2004 (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
- * 
- * The following code is adapted from the PEAR DB error handling code.
- * Portions (c)1997-2002 The PHP Group.
- */
-
-
-if (!defined("DB_ERROR")) define("DB_ERROR",-1);
-
-if (!defined("DB_ERROR_SYNTAX")) {
-       define("DB_ERROR_SYNTAX",              -2);
-       define("DB_ERROR_CONSTRAINT",          -3);
-       define("DB_ERROR_NOT_FOUND",           -4);
-       define("DB_ERROR_ALREADY_EXISTS",      -5);
-       define("DB_ERROR_UNSUPPORTED",         -6);
-       define("DB_ERROR_MISMATCH",            -7);
-       define("DB_ERROR_INVALID",             -8);
-       define("DB_ERROR_NOT_CAPABLE",         -9);
-       define("DB_ERROR_TRUNCATED",          -10);
-       define("DB_ERROR_INVALID_NUMBER",     -11);
-       define("DB_ERROR_INVALID_DATE",       -12);
-       define("DB_ERROR_DIVZERO",            -13);
-       define("DB_ERROR_NODBSELECTED",       -14);
-       define("DB_ERROR_CANNOT_CREATE",      -15);
-       define("DB_ERROR_CANNOT_DELETE",      -16);
-       define("DB_ERROR_CANNOT_DROP",        -17);
-       define("DB_ERROR_NOSUCHTABLE",        -18);
-       define("DB_ERROR_NOSUCHFIELD",        -19);
-       define("DB_ERROR_NEED_MORE_DATA",     -20);
-       define("DB_ERROR_NOT_LOCKED",         -21);
-       define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
-       define("DB_ERROR_INVALID_DSN",        -23);
-       define("DB_ERROR_CONNECT_FAILED",     -24);
-       define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
-       define("DB_ERROR_NOSUCHDB",           -25);
-       define("DB_ERROR_ACCESS_VIOLATION",   -26);
-}
-
-function adodb_errormsg($value)
-{
-global $ADODB_LANG,$ADODB_LANG_ARRAY;
-
-       if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
-       if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == 
$ADODB_LANG) ;
-       else {
-               include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
-    }
-       return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : 
$ADODB_LANG_ARRAY[DB_ERROR];
-}
-
-function adodb_error($provider,$dbType,$errno)
-{
-       //var_dump($errno);
-       if (is_numeric($errno) && $errno == 0) return 0;
-       switch($provider) { 
-       case 'mysql': $map = adodb_error_mysql(); break;
-       
-       case 'oracle':
-       case 'oci8': $map = adodb_error_oci8(); break;
-       
-       case 'ibase': $map = adodb_error_ibase(); break;
-       
-       case 'odbc': $map = adodb_error_odbc(); break;
-       
-       case 'mssql':
-       case 'sybase': $map = adodb_error_mssql(); break;
-       
-       case 'informix': $map = adodb_error_ifx(); break;
-       
-       case 'postgres': return adodb_error_pg($errno); break;
-       
-       case 'sqlite': return $map = adodb_error_sqlite(); break;
-       default:
-               return DB_ERROR;
-       }       
-       //print_r($map);
-       //var_dump($errno);
-       if (isset($map[$errno])) return $map[$errno];
-       return DB_ERROR;
-}
-
-//**************************************************************************************
-
-function adodb_error_pg($errormsg)
-{
-       if (is_numeric($errormsg)) return (integer) $errormsg;
-    static $error_regexps = array(
-            '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not 
exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE,
-            '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate 
key into (a )?unique index.*/'      => DB_ERROR_ALREADY_EXISTS,
-            '/divide by zero$/'                     => DB_ERROR_DIVZERO,
-            '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER,
-            '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does 
not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
-            '/parser: parse error at or near \"/'   => DB_ERROR_SYNTAX,
-            '/referential integrity violation/'     => DB_ERROR_CONSTRAINT,
-                       '/Relation [\"\'].*[\"\'] already exists|Cannot insert 
a duplicate key into (a )?unique index.*|duplicate key violates unique 
constraint/'     
-                                => DB_ERROR_ALREADY_EXISTS
-        );
-       reset($error_regexps);
-    while (list($regexp,$code) = each($error_regexps)) {
-        if (preg_match($regexp, $errormsg)) {
-            return $code;
-        }
-    }
-    // Fall back to DB_ERROR if there was no mapping.
-    return DB_ERROR;
-}
-       
-function adodb_error_odbc()
-{
-static $MAP = array(
-            '01004' => DB_ERROR_TRUNCATED,
-            '07001' => DB_ERROR_MISMATCH,
-            '21S01' => DB_ERROR_MISMATCH,
-            '21S02' => DB_ERROR_MISMATCH,
-            '22003' => DB_ERROR_INVALID_NUMBER,
-            '22008' => DB_ERROR_INVALID_DATE,
-            '22012' => DB_ERROR_DIVZERO,
-            '23000' => DB_ERROR_CONSTRAINT,
-            '24000' => DB_ERROR_INVALID,
-            '34000' => DB_ERROR_INVALID,
-            '37000' => DB_ERROR_SYNTAX,
-            '42000' => DB_ERROR_SYNTAX,
-            'IM001' => DB_ERROR_UNSUPPORTED,
-            'S0000' => DB_ERROR_NOSUCHTABLE,
-            'S0001' => DB_ERROR_NOT_FOUND,
-            'S0002' => DB_ERROR_NOSUCHTABLE,
-            'S0011' => DB_ERROR_ALREADY_EXISTS,
-            'S0012' => DB_ERROR_NOT_FOUND,
-            'S0021' => DB_ERROR_ALREADY_EXISTS,
-            'S0022' => DB_ERROR_NOT_FOUND,
-                       'S1000' => DB_ERROR_NOSUCHTABLE,
-            'S1009' => DB_ERROR_INVALID,
-            'S1090' => DB_ERROR_INVALID,
-            'S1C00' => DB_ERROR_NOT_CAPABLE
-        );
-               return $MAP;
-}
-
-function adodb_error_ibase()
-{
-static $MAP = array(
-            -104 => DB_ERROR_SYNTAX,
-            -150 => DB_ERROR_ACCESS_VIOLATION,
-            -151 => DB_ERROR_ACCESS_VIOLATION,
-            -155 => DB_ERROR_NOSUCHTABLE,
-            -157 => DB_ERROR_NOSUCHFIELD,
-            -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
-            -170 => DB_ERROR_MISMATCH,
-            -171 => DB_ERROR_MISMATCH,
-            -172 => DB_ERROR_INVALID,
-            -204 => DB_ERROR_INVALID,
-            -205 => DB_ERROR_NOSUCHFIELD,
-            -206 => DB_ERROR_NOSUCHFIELD,
-            -208 => DB_ERROR_INVALID,
-            -219 => DB_ERROR_NOSUCHTABLE,
-            -297 => DB_ERROR_CONSTRAINT,
-            -530 => DB_ERROR_CONSTRAINT,
-            -803 => DB_ERROR_CONSTRAINT,
-            -551 => DB_ERROR_ACCESS_VIOLATION,
-            -552 => DB_ERROR_ACCESS_VIOLATION,
-            -922 => DB_ERROR_NOSUCHDB,
-            -923 => DB_ERROR_CONNECT_FAILED,
-            -924 => DB_ERROR_CONNECT_FAILED
-        );
-               
-               return $MAP;
-}
-
-function adodb_error_ifx()
-{
-static $MAP = array(
-            '-201'    => DB_ERROR_SYNTAX,
-            '-206'    => DB_ERROR_NOSUCHTABLE,
-            '-217'    => DB_ERROR_NOSUCHFIELD,
-            '-329'    => DB_ERROR_NODBSELECTED,
-            '-1204'   => DB_ERROR_INVALID_DATE,
-            '-1205'   => DB_ERROR_INVALID_DATE,
-            '-1206'   => DB_ERROR_INVALID_DATE,
-            '-1209'   => DB_ERROR_INVALID_DATE,
-            '-1210'   => DB_ERROR_INVALID_DATE,
-            '-1212'   => DB_ERROR_INVALID_DATE
-       );
-          
-          return $MAP;
-}
-
-function adodb_error_oci8()
-{
-static $MAP = array(
-                        1 => DB_ERROR_ALREADY_EXISTS,
-            900 => DB_ERROR_SYNTAX,
-            904 => DB_ERROR_NOSUCHFIELD,
-            923 => DB_ERROR_SYNTAX,
-            942 => DB_ERROR_NOSUCHTABLE,
-            955 => DB_ERROR_ALREADY_EXISTS,
-            1476 => DB_ERROR_DIVZERO,
-            1722 => DB_ERROR_INVALID_NUMBER,
-            2289 => DB_ERROR_NOSUCHTABLE,
-            2291 => DB_ERROR_CONSTRAINT,
-            2449 => DB_ERROR_CONSTRAINT
-        );
-          
-       return $MAP;
-}
-
-function adodb_error_mssql()
-{
-static $MAP = array(
-                 208 => DB_ERROR_NOSUCHTABLE,
-          2601 => DB_ERROR_ALREADY_EXISTS
-       );
-          
-       return $MAP;
-}
-
-function adodb_error_sqlite()
-{
-static $MAP = array(
-                 1 => DB_ERROR_SYNTAX
-       );
-          
-       return $MAP;
-}
-
-function adodb_error_mysql()
-{
-static $MAP = array(
-           1004 => DB_ERROR_CANNOT_CREATE,
-           1005 => DB_ERROR_CANNOT_CREATE,
-           1006 => DB_ERROR_CANNOT_CREATE,
-           1007 => DB_ERROR_ALREADY_EXISTS,
-           1008 => DB_ERROR_CANNOT_DROP,
-                  1045 => DB_ERROR_ACCESS_VIOLATION,
-           1046 => DB_ERROR_NODBSELECTED,
-                  1049 => DB_ERROR_NOSUCHDB,
-           1050 => DB_ERROR_ALREADY_EXISTS,
-           1051 => DB_ERROR_NOSUCHTABLE,
-           1054 => DB_ERROR_NOSUCHFIELD,
-           1062 => DB_ERROR_ALREADY_EXISTS,
-           1064 => DB_ERROR_SYNTAX,
-           1100 => DB_ERROR_NOT_LOCKED,
-           1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
-           1146 => DB_ERROR_NOSUCHTABLE,
-           1048 => DB_ERROR_CONSTRAINT,
-                   2002 => DB_ERROR_CONNECT_FAILED
-       );
-          
-       return $MAP;
-}
+<?php
+/** 
+ * @version V4.60 24 Jan 2005 (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
+ * 
+ * The following code is adapted from the PEAR DB error handling code.
+ * Portions (c)1997-2002 The PHP Group.
+ */
+
+
+if (!defined("DB_ERROR")) define("DB_ERROR",-1);
+
+if (!defined("DB_ERROR_SYNTAX")) {
+       define("DB_ERROR_SYNTAX",              -2);
+       define("DB_ERROR_CONSTRAINT",          -3);
+       define("DB_ERROR_NOT_FOUND",           -4);
+       define("DB_ERROR_ALREADY_EXISTS",      -5);
+       define("DB_ERROR_UNSUPPORTED",         -6);
+       define("DB_ERROR_MISMATCH",            -7);
+       define("DB_ERROR_INVALID",             -8);
+       define("DB_ERROR_NOT_CAPABLE",         -9);
+       define("DB_ERROR_TRUNCATED",          -10);
+       define("DB_ERROR_INVALID_NUMBER",     -11);
+       define("DB_ERROR_INVALID_DATE",       -12);
+       define("DB_ERROR_DIVZERO",            -13);
+       define("DB_ERROR_NODBSELECTED",       -14);
+       define("DB_ERROR_CANNOT_CREATE",      -15);
+       define("DB_ERROR_CANNOT_DELETE",      -16);
+       define("DB_ERROR_CANNOT_DROP",        -17);
+       define("DB_ERROR_NOSUCHTABLE",        -18);
+       define("DB_ERROR_NOSUCHFIELD",        -19);
+       define("DB_ERROR_NEED_MORE_DATA",     -20);
+       define("DB_ERROR_NOT_LOCKED",         -21);
+       define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
+       define("DB_ERROR_INVALID_DSN",        -23);
+       define("DB_ERROR_CONNECT_FAILED",     -24);
+       define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
+       define("DB_ERROR_NOSUCHDB",           -25);
+       define("DB_ERROR_ACCESS_VIOLATION",   -26);
+}
+
+function adodb_errormsg($value)
+{
+global $ADODB_LANG,$ADODB_LANG_ARRAY;
+
+       if (empty($ADODB_LANG)) $ADODB_LANG = 'en';
+       if (isset($ADODB_LANG_ARRAY['LANG']) && $ADODB_LANG_ARRAY['LANG'] == 
$ADODB_LANG) ;
+       else {
+               include_once(ADODB_DIR."/lang/adodb-$ADODB_LANG.inc.php");
+    }
+       return isset($ADODB_LANG_ARRAY[$value]) ? $ADODB_LANG_ARRAY[$value] : 
$ADODB_LANG_ARRAY[DB_ERROR];
+}
+
+function adodb_error($provider,$dbType,$errno)
+{
+       //var_dump($errno);
+       if (is_numeric($errno) && $errno == 0) return 0;
+       switch($provider) { 
+       case 'mysql': $map = adodb_error_mysql(); break;
+       
+       case 'oracle':
+       case 'oci8': $map = adodb_error_oci8(); break;
+       
+       case 'ibase': $map = adodb_error_ibase(); break;
+       
+       case 'odbc': $map = adodb_error_odbc(); break;
+       
+       case 'mssql':
+       case 'sybase': $map = adodb_error_mssql(); break;
+       
+       case 'informix': $map = adodb_error_ifx(); break;
+       
+       case 'postgres': return adodb_error_pg($errno); break;
+       
+       case 'sqlite': return $map = adodb_error_sqlite(); break;
+       default:
+               return DB_ERROR;
+       }       
+       //print_r($map);
+       //var_dump($errno);
+       if (isset($map[$errno])) return $map[$errno];
+       return DB_ERROR;
+}
+
+//**************************************************************************************
+
+function adodb_error_pg($errormsg)
+{
+       if (is_numeric($errormsg)) return (integer) $errormsg;
+    static $error_regexps = array(
+            '/(Table does not exist\.|Relation [\"\'].*[\"\'] does not 
exist|sequence does not exist|class ".+" not found)$/' => DB_ERROR_NOSUCHTABLE,
+            '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate 
key into (a )?unique index.*/'      => DB_ERROR_ALREADY_EXISTS,
+            '/divide by zero$/'                     => DB_ERROR_DIVZERO,
+            '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER,
+            '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does 
not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD,
+            '/parser: parse error at or near \"/'   => DB_ERROR_SYNTAX,
+            '/referential integrity violation/'     => DB_ERROR_CONSTRAINT,
+                       '/Relation [\"\'].*[\"\'] already exists|Cannot insert 
a duplicate key into (a )?unique index.*|duplicate key violates unique 
constraint/'     
+                                => DB_ERROR_ALREADY_EXISTS
+        );
+       reset($error_regexps);
+    while (list($regexp,$code) = each($error_regexps)) {
+        if (preg_match($regexp, $errormsg)) {
+            return $code;
+        }
+    }
+    // Fall back to DB_ERROR if there was no mapping.
+    return DB_ERROR;
+}
+       
+function adodb_error_odbc()
+{
+static $MAP = array(
+            '01004' => DB_ERROR_TRUNCATED,
+            '07001' => DB_ERROR_MISMATCH,
+            '21S01' => DB_ERROR_MISMATCH,
+            '21S02' => DB_ERROR_MISMATCH,
+            '22003' => DB_ERROR_INVALID_NUMBER,
+            '22008' => DB_ERROR_INVALID_DATE,
+            '22012' => DB_ERROR_DIVZERO,
+            '23000' => DB_ERROR_CONSTRAINT,
+            '24000' => DB_ERROR_INVALID,
+            '34000' => DB_ERROR_INVALID,
+            '37000' => DB_ERROR_SYNTAX,
+            '42000' => DB_ERROR_SYNTAX,
+            'IM001' => DB_ERROR_UNSUPPORTED,
+            'S0000' => DB_ERROR_NOSUCHTABLE,
+            'S0001' => DB_ERROR_NOT_FOUND,
+            'S0002' => DB_ERROR_NOSUCHTABLE,
+            'S0011' => DB_ERROR_ALREADY_EXISTS,
+            'S0012' => DB_ERROR_NOT_FOUND,
+            'S0021' => DB_ERROR_ALREADY_EXISTS,
+            'S0022' => DB_ERROR_NOT_FOUND,
+                       'S1000' => DB_ERROR_NOSUCHTABLE,
+            'S1009' => DB_ERROR_INVALID,
+            'S1090' => DB_ERROR_INVALID,
+            'S1C00' => DB_ERROR_NOT_CAPABLE
+        );
+               return $MAP;
+}
+
+function adodb_error_ibase()
+{
+static $MAP = array(
+            -104 => DB_ERROR_SYNTAX,
+            -150 => DB_ERROR_ACCESS_VIOLATION,
+            -151 => DB_ERROR_ACCESS_VIOLATION,
+            -155 => DB_ERROR_NOSUCHTABLE,
+            -157 => DB_ERROR_NOSUCHFIELD,
+            -158 => DB_ERROR_VALUE_COUNT_ON_ROW,
+            -170 => DB_ERROR_MISMATCH,
+            -171 => DB_ERROR_MISMATCH,
+            -172 => DB_ERROR_INVALID,
+            -204 => DB_ERROR_INVALID,
+            -205 => DB_ERROR_NOSUCHFIELD,
+            -206 => DB_ERROR_NOSUCHFIELD,
+            -208 => DB_ERROR_INVALID,
+            -219 => DB_ERROR_NOSUCHTABLE,
+            -297 => DB_ERROR_CONSTRAINT,
+            -530 => DB_ERROR_CONSTRAINT,
+            -803 => DB_ERROR_CONSTRAINT,
+            -551 => DB_ERROR_ACCESS_VIOLATION,
+            -552 => DB_ERROR_ACCESS_VIOLATION,
+            -922 => DB_ERROR_NOSUCHDB,
+            -923 => DB_ERROR_CONNECT_FAILED,
+            -924 => DB_ERROR_CONNECT_FAILED
+        );
+               
+               return $MAP;
+}
+
+function adodb_error_ifx()
+{
+static $MAP = array(
+            '-201'    => DB_ERROR_SYNTAX,
+            '-206'    => DB_ERROR_NOSUCHTABLE,
+            '-217'    => DB_ERROR_NOSUCHFIELD,
+            '-329'    => DB_ERROR_NODBSELECTED,
+            '-1204'   => DB_ERROR_INVALID_DATE,
+            '-1205'   => DB_ERROR_INVALID_DATE,
+            '-1206'   => DB_ERROR_INVALID_DATE,
+            '-1209'   => DB_ERROR_INVALID_DATE,
+            '-1210'   => DB_ERROR_INVALID_DATE,
+            '-1212'   => DB_ERROR_INVALID_DATE
+       );
+          
+          return $MAP;
+}
+
+function adodb_error_oci8()
+{
+static $MAP = array(
+                        1 => DB_ERROR_ALREADY_EXISTS,
+            900 => DB_ERROR_SYNTAX,
+            904 => DB_ERROR_NOSUCHFIELD,
+            923 => DB_ERROR_SYNTAX,
+            942 => DB_ERROR_NOSUCHTABLE,
+            955 => DB_ERROR_ALREADY_EXISTS,
+            1476 => DB_ERROR_DIVZERO,
+            1722 => DB_ERROR_INVALID_NUMBER,
+            2289 => DB_ERROR_NOSUCHTABLE,
+            2291 => DB_ERROR_CONSTRAINT,
+            2449 => DB_ERROR_CONSTRAINT
+        );
+          
+       return $MAP;
+}
+
+function adodb_error_mssql()
+{
+static $MAP = array(
+                 208 => DB_ERROR_NOSUCHTABLE,
+          2601 => DB_ERROR_ALREADY_EXISTS
+       );
+          
+       return $MAP;
+}
+
+function adodb_error_sqlite()
+{
+static $MAP = array(
+                 1 => DB_ERROR_SYNTAX
+       );
+          
+       return $MAP;
+}
+
+function adodb_error_mysql()
+{
+static $MAP = array(
+           1004 => DB_ERROR_CANNOT_CREATE,
+           1005 => DB_ERROR_CANNOT_CREATE,
+           1006 => DB_ERROR_CANNOT_CREATE,
+           1007 => DB_ERROR_ALREADY_EXISTS,
+           1008 => DB_ERROR_CANNOT_DROP,
+                  1045 => DB_ERROR_ACCESS_VIOLATION,
+           1046 => DB_ERROR_NODBSELECTED,
+                  1049 => DB_ERROR_NOSUCHDB,
+           1050 => DB_ERROR_ALREADY_EXISTS,
+           1051 => DB_ERROR_NOSUCHTABLE,
+           1054 => DB_ERROR_NOSUCHFIELD,
+           1062 => DB_ERROR_ALREADY_EXISTS,
+           1064 => DB_ERROR_SYNTAX,
+           1100 => DB_ERROR_NOT_LOCKED,
+           1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
+           1146 => DB_ERROR_NOSUCHTABLE,
+           1048 => DB_ERROR_CONSTRAINT,
+                   2002 => DB_ERROR_CONNECT_FAILED
+       );
+          
+       return $MAP;
+}
 ?>
\ No newline at end of file

Index: adodb-pager.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/adodb-pager.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- adodb-pager.inc.php 29 Nov 2004 22:54:45 -0000      1.3
+++ adodb-pager.inc.php 27 Jan 2005 14:43:39 -0000      1.4
@@ -1,287 +1,289 @@
-<?php
-
-/*
-       V4.54 5 Nov 2004  (c) 2000-2004 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
-
-       This class provides recordset pagination with 
-       First/Prev/Next/Last links. 
-       
-       Feel free to modify this class for your own use as
-       it is very basic. To learn how to use it, see the 
-       example in adodb/tests/testpaging.php.
-       
-       "Pablo Costa" <pablo-HBc+hihnbxgIdKJ7tpkyPg@xxxxxxxxxxxxxxxx> 
implemented Render_PageLinks().
-       
-       Please note, this class is entirely unsupported, 
-       and no free support requests except for bug reports
-       will be entertained by the author.
-
-*/
-class ADODB_Pager {
-       var $id;        // unique id for pager (defaults to 'adodb')
-       var $db;        // ADODB connection object
-       var $sql;       // sql used
-       var $rs;        // recordset generated
-       var $curr_page; // current page number before Render() called, 
calculated in constructor
-       var $rows;              // number of rows per page
-    var $linksPerPage=10; // number of links per page in navigation bar
-    var $showPageLinks; 
-
-       var $gridAttributes = 'width=100% border=1 bgcolor=white';
-       
-       // Localize text strings here
-       var $first = '<code>|&lt;</code>';
-       var $prev = '<code>&lt;&lt;</code>';
-       var $next = '<code>>></code>';
-       var $last = '<code>>|</code>';
-       var $moreLinks = '...';
-       var $startLinks = '...';
-       var $gridHeader = false;
-       var $htmlSpecialChars = true;
-       var $page = 'Page';
-       var $linkSelectedColor = 'red';
-       var $cache = 0;  #secs to cache with CachePageExecute()
-       
-       //----------------------------------------------
-       // constructor
-       //
-       // $db  adodb connection object
-       // $sql sql statement
-       // $id  optional id to identify which pager, 
-       //              if you have multiple on 1 page. 
-       //              $id should be only be [a-z0-9]*
-       //
-       function ADODB_Pager(&$db,$sql,$id = 'adodb', $showPageLinks = false)
-       {
-       global $HTTP_SERVER_VARS,$PHP_SELF,$HTTP_SESSION_VARS,$HTTP_GET_VARS;
-       
-               $curr_page = $id.'_curr_page';
-               if (empty($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
-               
-               $this->sql = $sql;
-               $this->id = $id;
-               $this->db = $db;
-               $this->showPageLinks = $showPageLinks;
-               
-               $next_page = $id.'_next_page';  
-               
-               if (isset($HTTP_GET_VARS[$next_page])) {
-                       $HTTP_SESSION_VARS[$curr_page] = 
$HTTP_GET_VARS[$next_page];
-               }
-               if (empty($HTTP_SESSION_VARS[$curr_page])) 
$HTTP_SESSION_VARS[$curr_page] = 1; ## at first page
-               
-               $this->curr_page = $HTTP_SESSION_VARS[$curr_page];
-               
-       }
-       
-       //---------------------------
-       // Display link to first page
-       function Render_First($anchor=true)
-       {
-       global $PHP_SELF;
-               if ($anchor) {
-       ?>
-               <a href="<?php echo 
$PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a> &nbsp; 
-       <?php
-               } else {
-                       print "$this->first &nbsp; ";
-               }
-       }
-       
-       //--------------------------
-       // Display link to next page
-       function render_next($anchor=true)
-       {
-       global $PHP_SELF;
-       
-               if ($anchor) {
-               ?>
-               <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php 
echo $this->next;?></a> &nbsp; 
-               <?php
-               } else {
-                       print "$this->next &nbsp; ";
-               }
-       }
-       
-       //------------------
-       // Link to last page
-       // 
-       // for better performance with large recordsets, you can set
-       // $this->db->pageExecuteCountRows = false, which disables
-       // last page counting.
-       function render_last($anchor=true)
-       {
-       global $PHP_SELF;
-       
-               if (!$this->db->pageExecuteCountRows) return;
-               
-               if ($anchor) {
-               ?>
-                       <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo 
$this->last;?></a> &nbsp; 
-               <?php
-               } else {
-                       print "$this->last &nbsp; ";
-               }
-       }
-       
-       //---------------------------------------------------
-       // original code by "Pablo Costa" 
<pablo-HBc+hihnbxgIdKJ7tpkyPg@xxxxxxxxxxxxxxxx> 
-        function render_pagelinks()
-        {
-        global $PHP_SELF;
-            $pages        = $this->rs->LastPageNo();
-            $linksperpage = $this->linksPerPage ? $this->linksPerPage : $pages;
-            for($i=1; $i <= $pages; $i+=$linksperpage)
-            {
-                if($this->rs->AbsolutePage() >= $i)
-                {
-                    $start = $i;
-                }
-            }
-                       $numbers = '';
-            $end = $start+$linksperpage-1;
-                       $link = $this->id . "_next_page";
-            if($end > $pages) $end = $pages;
-                       
-                       
-                       if ($this->startLinks && $start > 1) {
-                               $pos = $start - 1;
-                               $numbers .= "<a 
href=$PHP_SELF?$link=$pos>$this->startLinks</a>  ";
-            } 
-                       
-                       for($i=$start; $i <= $end; $i++) {
-                if ($this->rs->AbsolutePage() == $i)
-                    $numbers .= "<font 
color=$this->linkSelectedColor><b>$i</b></font>  ";
-                else 
-                     $numbers .= "<a href=$PHP_SELF?$link=$i>$i</a>  ";
-            
-            }
-                       if ($this->moreLinks && $end < $pages) 
-                               $numbers .= "<a 
href=$PHP_SELF?$link=$i>$this->moreLinks</a>  ";
-            print $numbers . ' &nbsp; ';
-        }
-       // Link to previous page
-       function render_prev($anchor=true)
-       {
-       global $PHP_SELF;
-               if ($anchor) {
-       ?>
-               <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php 
echo $this->prev;?></a> &nbsp; 
-       <?php 
-               } else {
-                       print "$this->prev &nbsp; ";
-               }
-       }
-       
-       //--------------------------------------------------------
-       // Simply rendering of grid. You should override this for
-       // better control over the format of the grid
-       //
-       // We use output buffering to keep code clean and readable.
-       function RenderGrid()
-       {
-       global $gSQLBlockRows; // used by rs2html to indicate how many rows to 
display
-               include_once(ADODB_DIR.'/tohtml.inc.php');
-               ob_start();
-               $gSQLBlockRows = $this->rows;
-               
rs2html($this->rs,$this->gridAttributes,$this->gridHeader,$this->htmlSpecialChars);
-               $s = ob_get_contents();
-               ob_end_clean();
-               return $s;
-       }
-       
-       //-------------------------------------------------------
-       // Navigation bar
-       //
-       // we use output buffering to keep the code easy to read.
-       function RenderNav()
-       {
-               ob_start();
-               if (!$this->rs->AtFirstPage()) {
-                       $this->Render_First();
-                       $this->Render_Prev();
-               } else {
-                       $this->Render_First(false);
-                       $this->Render_Prev(false);
-               }
-        if ($this->showPageLinks){
-            $this->Render_PageLinks();
-        }
-               if (!$this->rs->AtLastPage()) {
-                       $this->Render_Next();
-                       $this->Render_Last();
-               } else {
-                       $this->Render_Next(false);
-                       $this->Render_Last(false);
-               }
-               $s = ob_get_contents();
-               ob_end_clean();
-               return $s;
-       }
-       
-       //-------------------
-       // This is the footer
-       function RenderPageCount()
-       {
-               if (!$this->db->pageExecuteCountRows) return '';
-               $lastPage = $this->rs->LastPageNo();
-               if ($lastPage == -1) $lastPage = 1; // check for empty rs.
-               if ($this->curr_page > $lastPage) $this->curr_page = 1;
-               return "<font size=-1>$this->page 
".$this->curr_page."/".$lastPage."</font>";
-       }
-       
-       //-----------------------------------
-       // Call this class to draw everything.
-       function Render($rows=10)
-       {
-       global $ADODB_COUNTRECS;
-       
-               $this->rows = $rows;
-               
-               $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);
-               else
-                       $rs = 
&$this->db->PageExecute($this->sql,$rows,$this->curr_page);
-               $ADODB_COUNTRECS = $savec;
-               
-               $this->rs = &$rs;
-               if (!$rs) {
-                       print "<h3>Query failed: $this->sql</h3>";
-                       return;
-               }
-               
-               if (!$rs->EOF && (!$rs->AtFirstPage() || !$rs->AtLastPage())) 
-                       $header = $this->RenderNav();
-               else
-                       $header = "&nbsp;";
-               
-               $grid = $this->RenderGrid();
-               $footer = $this->RenderPageCount();
-               $rs->Close();
-               $this->rs = false;
-               
-               $this->RenderLayout($header,$grid,$footer);
-       }
-       
-       //------------------------------------------------------
-       // override this to control overall layout and formating
-       function RenderLayout($header,$grid,$footer,$attributes='border=1 
bgcolor=beige')
-       {
-               echo "<table ".$attributes."><tr><td>",
-                               $header,
-                       "</td></tr><tr><td>",
-                               $grid,
-                       "</td></tr><tr><td>",
-                               $footer,
-                       "</td></tr></table>";
-       }
-}
-
-
+<?php
+
+/*
+       V4.60 24 Jan 2005  (c) 2000-2005 John Lim 
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). 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 4 for best viewing.
+
+       This class provides recordset pagination with 
+       First/Prev/Next/Last links. 
+       
+       Feel free to modify this class for your own use as
+       it is very basic. To learn how to use it, see the 
+       example in adodb/tests/testpaging.php.
+       
+       "Pablo Costa" <pablo-HBc+hihnbxgIdKJ7tpkyPg@xxxxxxxxxxxxxxxx> 
implemented Render_PageLinks().
+       
+       Please note, this class is entirely unsupported, 
+       and no free support requests except for bug reports
+       will be entertained by the author.
+
+*/
+class ADODB_Pager {
+       var $id;        // unique id for pager (defaults to 'adodb')
+       var $db;        // ADODB connection object
+       var $sql;       // sql used
+       var $rs;        // recordset generated
+       var $curr_page; // current page number before Render() called, 
calculated in constructor
+       var $rows;              // number of rows per page
+    var $linksPerPage=10; // number of links per page in navigation bar
+    var $showPageLinks; 
+
+       var $gridAttributes = 'width=100% border=1 bgcolor=white';
+       
+       // Localize text strings here
+       var $first = '<code>|&lt;</code>';
+       var $prev = '<code>&lt;&lt;</code>';
+       var $next = '<code>>></code>';
+       var $last = '<code>>|</code>';
+       var $moreLinks = '...';
+       var $startLinks = '...';
+       var $gridHeader = false;
+       var $htmlSpecialChars = true;
+       var $page = 'Page';
+       var $linkSelectedColor = 'red';
+       var $cache = 0;  #secs to cache with CachePageExecute()
+       
+       //----------------------------------------------
+       // constructor
+       //
+       // $db  adodb connection object
+       // $sql sql statement
+       // $id  optional id to identify which pager, 
+       //              if you have multiple on 1 page. 
+       //              $id should be only be [a-z0-9]*
+       //
+       function ADODB_Pager(&$db,$sql,$id = 'adodb', $showPageLinks = false)
+       {
+       global $HTTP_SERVER_VARS,$PHP_SELF,$HTTP_SESSION_VARS,$HTTP_GET_VARS;
+       
+               $curr_page = $id.'_curr_page';
+               if (empty($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
+               
+               $this->sql = $sql;
+               $this->id = $id;
+               $this->db = $db;
+               $this->showPageLinks = $showPageLinks;
+               
+               $next_page = $id.'_next_page';  
+               
+               if (isset($HTTP_GET_VARS[$next_page])) {
+                       $HTTP_SESSION_VARS[$curr_page] = 
$HTTP_GET_VARS[$next_page];
+               }
+               if (empty($HTTP_SESSION_VARS[$curr_page])) 
$HTTP_SESSION_VARS[$curr_page] = 1; ## at first page
+               
+               $this->curr_page = $HTTP_SESSION_VARS[$curr_page];
+               
+       }
+       
+       //---------------------------
+       // Display link to first page
+       function Render_First($anchor=true)
+       {
+       global $PHP_SELF;
+               if ($anchor) {
+       ?>
+               <a href="<?php echo 
$PHP_SELF,'?',$this->id;?>_next_page=1"><?php echo $this->first;?></a> &nbsp; 
+       <?php
+               } else {
+                       print "$this->first &nbsp; ";
+               }
+       }
+       
+       //--------------------------
+       // Display link to next page
+       function render_next($anchor=true)
+       {
+       global $PHP_SELF;
+       
+               if ($anchor) {
+               ?>
+               <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() + 1 ?>"><?php 
echo $this->next;?></a> &nbsp; 
+               <?php
+               } else {
+                       print "$this->next &nbsp; ";
+               }
+       }
+       
+       //------------------
+       // Link to last page
+       // 
+       // for better performance with large recordsets, you can set
+       // $this->db->pageExecuteCountRows = false, which disables
+       // last page counting.
+       function render_last($anchor=true)
+       {
+       global $PHP_SELF;
+       
+               if (!$this->db->pageExecuteCountRows) return;
+               
+               if ($anchor) {
+               ?>
+                       <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->LastPageNo() ?>"><?php echo 
$this->last;?></a> &nbsp; 
+               <?php
+               } else {
+                       print "$this->last &nbsp; ";
+               }
+       }
+       
+       //---------------------------------------------------
+       // original code by "Pablo Costa" 
<pablo-HBc+hihnbxgIdKJ7tpkyPg@xxxxxxxxxxxxxxxx> 
+        function render_pagelinks()
+        {
+        global $PHP_SELF;
+            $pages        = $this->rs->LastPageNo();
+            $linksperpage = $this->linksPerPage ? $this->linksPerPage : $pages;
+            for($i=1; $i <= $pages; $i+=$linksperpage)
+            {
+                if($this->rs->AbsolutePage() >= $i)
+                {
+                    $start = $i;
+                }
+            }
+                       $numbers = '';
+            $end = $start+$linksperpage-1;
+                       $link = $this->id . "_next_page";
+            if($end > $pages) $end = $pages;
+                       
+                       
+                       if ($this->startLinks && $start > 1) {
+                               $pos = $start - 1;
+                               $numbers .= "<a 
href=$PHP_SELF?$link=$pos>$this->startLinks</a>  ";
+            } 
+                       
+                       for($i=$start; $i <= $end; $i++) {
+                if ($this->rs->AbsolutePage() == $i)
+                    $numbers .= "<font 
color=$this->linkSelectedColor><b>$i</b></font>  ";
+                else 
+                     $numbers .= "<a href=$PHP_SELF?$link=$i>$i</a>  ";
+            
+            }
+                       if ($this->moreLinks && $end < $pages) 
+                               $numbers .= "<a 
href=$PHP_SELF?$link=$i>$this->moreLinks</a>  ";
+            print $numbers . ' &nbsp; ';
+        }
+       // Link to previous page
+       function render_prev($anchor=true)
+       {
+       global $PHP_SELF;
+               if ($anchor) {
+       ?>
+               <a href="<?php echo 
$PHP_SELF,'?',$this->id,'_next_page=',$this->rs->AbsolutePage() - 1 ?>"><?php 
echo $this->prev;?></a> &nbsp; 
+       <?php 
+               } else {
+                       print "$this->prev &nbsp; ";
+               }
+       }
+       
+       //--------------------------------------------------------
+       // Simply rendering of grid. You should override this for
+       // better control over the format of the grid
+       //
+       // We use output buffering to keep code clean and readable.
+       function RenderGrid()
+       {
+       global $gSQLBlockRows; // used by rs2html to indicate how many rows to 
display
+               include_once(ADODB_DIR.'/tohtml.inc.php');
+               ob_start();
+               $gSQLBlockRows = $this->rows;
+               
rs2html($this->rs,$this->gridAttributes,$this->gridHeader,$this->htmlSpecialChars);
+               $s = ob_get_contents();
+               ob_end_clean();
+               return $s;
+       }
+       
+       //-------------------------------------------------------
+       // Navigation bar
+       //
+       // we use output buffering to keep the code easy to read.
+       function RenderNav()
+       {
+               ob_start();
+               if (!$this->rs->AtFirstPage()) {
+                       $this->Render_First();
+                       $this->Render_Prev();
+               } else {
+                       $this->Render_First(false);
+                       $this->Render_Prev(false);
+               }
+        if ($this->showPageLinks){
+            $this->Render_PageLinks();
+        }
+               if (!$this->rs->AtLastPage()) {
+                       $this->Render_Next();
+                       $this->Render_Last();
+               } else {
+                       $this->Render_Next(false);
+                       $this->Render_Last(false);
+               }
+               $s = ob_get_contents();
+               ob_end_clean();
+               return $s;
+       }
+       
+       //-------------------
+       // This is the footer
+       function RenderPageCount()
+       {
+               if (!$this->db->pageExecuteCountRows) return '';
+               $lastPage = $this->rs->LastPageNo();
+               if ($lastPage == -1) $lastPage = 1; // check for empty rs.
+               if ($this->curr_page > $lastPage) $this->curr_page = 1;
+               return "<font size=-1>$this->page 
".$this->curr_page."/".$lastPage."</font>";
+       }
+       
+       //-----------------------------------
+       // Call this class to draw everything.
+       function Render($rows=10)
+       {
+       global $ADODB_COUNTRECS;
+       
+               $this->rows = $rows;
+               
+               if ($this->db->dataProvider == 'informix') 
$this->db->cursorType = IFX_SCROLL;
+               
+               $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);
+               else
+                       $rs = 
&$this->db->PageExecute($this->sql,$rows,$this->curr_page);
+               $ADODB_COUNTRECS = $savec;
+               
+               $this->rs = &$rs;
+               if (!$rs) {
+                       print "<h3>Query failed: $this->sql</h3>";
+                       return;
+               }
+               
+               if (!$rs->EOF && (!$rs->AtFirstPage() || !$rs->AtLastPage())) 
+                       $header = $this->RenderNav();
+               else
+                       $header = "&nbsp;";
+               
+               $grid = $this->RenderGrid();
+               $footer = $this->RenderPageCount();
+