[Vtigercrm-commits] [vtiger-commits] r7186 - in /vtigercrm/trunk/adodb: ./ datadict/ drivers/ perf/ session/ session/old/ tests/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Jun 16 09:06:48 EDT 2006


Author: jeffk
Date: Fri Jun 16 07:06:09 2006
New Revision: 7186

Log:
closes #1302. update adodb-4.81 to adodb-4.90

Modified:
    vtigercrm/trunk/adodb/adodb-active-record.inc.php
    vtigercrm/trunk/adodb/adodb-csvlib.inc.php
    vtigercrm/trunk/adodb/adodb-datadict.inc.php
    vtigercrm/trunk/adodb/adodb-error.inc.php
    vtigercrm/trunk/adodb/adodb-errorhandler.inc.php
    vtigercrm/trunk/adodb/adodb-errorpear.inc.php
    vtigercrm/trunk/adodb/adodb-exceptions.inc.php
    vtigercrm/trunk/adodb/adodb-iterator.inc.php
    vtigercrm/trunk/adodb/adodb-lib.inc.php
    vtigercrm/trunk/adodb/adodb-pager.inc.php
    vtigercrm/trunk/adodb/adodb-pear.inc.php
    vtigercrm/trunk/adodb/adodb-perf.inc.php
    vtigercrm/trunk/adodb/adodb-php4.inc.php
    vtigercrm/trunk/adodb/adodb.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-access.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-db2.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-firebird.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-generic.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-ibase.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-informix.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-mssql.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-mysql.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-oci8.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-postgres.inc.php
    vtigercrm/trunk/adodb/datadict/datadict-sybase.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-access.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ado.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ado5.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ado_access.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ado_mssql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-borland_ibase.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-csv.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-db2.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-fbsql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-firebird.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ibase.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-informix.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-informix72.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-ldap.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-mssql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-mssqlpo.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-mysql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-mysqli.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-mysqlt.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-netezza.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-oci8.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-oci805.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-oci8po.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbc.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbc_db2.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbc_mssql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbc_oracle.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbtp.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-odbtp_unicode.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-oracle.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-pdo.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-pdo_mssql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-pdo_mysql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-pdo_oci.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-pdo_pgsql.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-postgres.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-postgres64.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-postgres7.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-postgres8.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-proxy.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sapdb.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sqlanywhere.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sqlite.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sqlitepo.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sybase.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-sybase_ase.inc.php
    vtigercrm/trunk/adodb/drivers/adodb-vfp.inc.php
    vtigercrm/trunk/adodb/perf/perf-db2.inc.php
    vtigercrm/trunk/adodb/perf/perf-informix.inc.php
    vtigercrm/trunk/adodb/perf/perf-mssql.inc.php
    vtigercrm/trunk/adodb/perf/perf-mysql.inc.php
    vtigercrm/trunk/adodb/perf/perf-oci8.inc.php
    vtigercrm/trunk/adodb/perf/perf-postgres.inc.php
    vtigercrm/trunk/adodb/pivottable.inc.php
    vtigercrm/trunk/adodb/rsfilter.inc.php
    vtigercrm/trunk/adodb/server.php
    vtigercrm/trunk/adodb/session/adodb-compress-bzip2.php
    vtigercrm/trunk/adodb/session/adodb-compress-gzip.php
    vtigercrm/trunk/adodb/session/adodb-cryptsession.php
    vtigercrm/trunk/adodb/session/adodb-encrypt-mcrypt.php
    vtigercrm/trunk/adodb/session/adodb-encrypt-md5.php
    vtigercrm/trunk/adodb/session/adodb-encrypt-secret.php
    vtigercrm/trunk/adodb/session/adodb-session-clob.php
    vtigercrm/trunk/adodb/session/adodb-session.php
    vtigercrm/trunk/adodb/session/old/adodb-cryptsession.php
    vtigercrm/trunk/adodb/session/old/adodb-session-clob.php
    vtigercrm/trunk/adodb/session/old/adodb-session.php
    vtigercrm/trunk/adodb/tests/test-active-recs2.php
    vtigercrm/trunk/adodb/tests/test.php
    vtigercrm/trunk/adodb/tests/testdatabases.inc.php
    vtigercrm/trunk/adodb/toexport.inc.php
    vtigercrm/trunk/adodb/tohtml.inc.php

Modified: vtigercrm/trunk/adodb/adodb-active-record.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-active-record.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-active-record.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 /*
 
- at version V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ at version V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Latest version is available at http://adodb.sourceforge.net
  
   Released under both BSD license and Lesser GPL library license. 
@@ -10,7 +10,7 @@
   
   Active Record implementation. Superset of Zend Framework's.
   
-  Version 0.03
+  Version 0.04
   
   See http://www-128.ibm.com/developerworks/java/library/j-cb03076/?ca=dgr-lnxw01ActiveRecord 
   	for info on Ruby on Rails Active Record implementation
@@ -56,7 +56,7 @@
 
 class ADODB_Active_Record {
 	var $_dbat; // associative index pointing to ADODB_Active_DB eg. $ADODB_Active_DBS[_dbat]
-	var $_table; // tablename
+	var $_table; // tablename, if set in class definition then use it as table name
 	var $_tableat; // associative index pointing to ADODB_Active_Table, eg $ADODB_Active_DBS[_dbat]->tables[$this->_tableat]
 	var $_where; // where clause set in Load()
 	var $_saved = false; // indicates whether data is already inserted.
@@ -85,8 +85,10 @@
 			$pkeyarr = false;
 		}
 		
-		if (!$table) $table = $this->_pluralize(get_class($this));
-		
+		if (!$table) { 
+			if (!empty($this->_table)) $table = $this->_table;
+			else $table = $this->_pluralize(get_class($this));
+		}
 		if ($db) {
 			$this->_dbat = ADODB_Active_Record::SetDatabaseAdapter($db);
 		} else
@@ -455,6 +457,13 @@
 		$db->Execute($sql);
 	}
 	
+	// returns an array of active record objects
+	function &Find($whereOrderBy,$bindarr=false,$pkeysArr=false)
+	{
+		$db =& $this->DB(); if (!$db || empty($this->_table)) return false;
+		$arr =& $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr);
+		return $arr;
+	}
 	
 	// returns 0 on error, 1 on update, 2 on insert
 	function Replace()

Modified: vtigercrm/trunk/adodb/adodb-csvlib.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-csvlib.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-csvlib.inc.php Fri Jun 16 07:06:09 2006
@@ -8,7 +8,7 @@
 
 /* 
 
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/adodb-datadict.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-datadict.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-datadict.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/adodb-error.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-error.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-error.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/adodb-errorhandler.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-errorhandler.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-errorhandler.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license.
  * Whenever there is any discrepancy between the two licenses,
  * the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/adodb-errorpear.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-errorpear.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-errorpear.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/adodb-exceptions.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-exceptions.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-exceptions.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * @version V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license.
  * Whenever there is any discrepancy between the two licenses,
  * the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/adodb-iterator.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-iterator.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-iterator.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/adodb-lib.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-lib.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-lib.inc.php Fri Jun 16 07:06:09 2006
@@ -7,7 +7,7 @@
 $ADODB_INCLUDED_LIB = 1;
 
 /* 
- @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim\@natsoft.com.my). All rights reserved.
+ @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim\@natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 
@@ -325,6 +325,8 @@
 		$rewritesql = preg_replace(
 					'/^\s*SELECT\s.*\s+FROM\s/Uis','SELECT COUNT(*) FROM ',$sql);
 
+		
+		
 		// fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails 
 		// with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
 		// also see http://phplens.com/lens/lensforum/msgs.php?id=12752
@@ -332,10 +334,13 @@
 			$rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$rewritesql);
 		else
 			$rewritesql = preg_replace('/(\sORDER\s+BY\s[^)]*)/is','',$rewritesql);
+	}
+	
+	
+	
+	if (isset($rewritesql) && $rewritesql != $sql) {
+		if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[1];
 		 
-	}
-	
-	if (isset($rewritesql) && $rewritesql != $sql) {
 		if ($secs2cache) {
 			// we only use half the time of secs2cache because the count can quickly
 			// become inaccurate if new records are added
@@ -354,6 +359,8 @@
 	if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql;
 	else $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); 
 	
+	if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
+		
 	$rstest = &$zthis->Execute($rewritesql,$inputarr);
 	if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
 	
@@ -1017,5 +1024,47 @@
 	
 	return $s;
 }
+/*
+function _adodb_find_from($sql) 
+{
+
+	$sql = str_replace(array("\n","\r"), ' ', $sql);
+	$charCount = strlen($sql);
+	
+	$inString = false;
+	$quote = '';
+	$parentheseCount = 0;
+	$prevChars = '';
+	$nextChars = '';
+	
+
+	for($i = 0; $i < $charCount; $i++) {
+
+    	$char = substr($sql,$i,1);
+	    $prevChars = substr($sql,0,$i);
+    	$nextChars = substr($sql,$i+1);
+
+		if((($char == "'" || $char == '"' || $char == '`') && substr($prevChars,-1,1) != '\\') && $inString === false) {
+			$quote = $char;
+			$inString = true;
+		}
+
+		elseif((($char == "'" || $char == '"' || $char == '`') && substr($prevChars,-1,1) != '\\') && $inString === true && $quote == $char) {
+			$quote = "";
+			$inString = false;
+		}
+
+		elseif($char == "(" && $inString === false)
+			$parentheseCount++;
+
+		elseif($char == ")" && $inString === false && $parentheseCount > 0)
+			$parentheseCount--;
+
+		elseif($parentheseCount <= 0 && $inString === false && $char == " " && strtoupper(substr($prevChars,-5,5)) == " FROM")
+			return $i;
+
+	}
+}
+*/
 
 ?>

Modified: vtigercrm/trunk/adodb/adodb-pager.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-pager.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-pager.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-	V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+	V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 	  Released under both BSD license and Lesser GPL library license. 
 	  Whenever there is any discrepancy between the two licenses, 
 	  the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/adodb-pear.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-pear.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-pear.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/adodb-perf.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-perf.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-perf.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/adodb-php4.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb-php4.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb-php4.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/adodb.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/adodb.inc.php (original)
+++ vtigercrm/trunk/adodb/adodb.inc.php Fri Jun 16 07:06:09 2006
@@ -14,7 +14,7 @@
 /**
 	\mainpage 	
 	
-	 @version V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+	 @version V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 
 	Released under both BSD license and Lesser GPL library license. You can choose which license
 	you prefer.
@@ -171,7 +171,7 @@
 		/**
 		 * ADODB version as a string.
 		 */
-		$ADODB_vers = 'V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
+		$ADODB_vers = 'V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
 	
 		/**
 		 * Determines whether recordset->RecordCount() is used. 
@@ -314,6 +314,7 @@
 	var $_evalAll = false;
 	var $_affected = false;
 	var $_logsql = false;
+	var $_transmode = ''; // transaction mode
 	
 	/**
 	 * Constructor
@@ -823,7 +824,10 @@
 							$sql .= str_replace(',','.',$v); // locales fix so 1.1 does not get converted to 1,1
 						else if ($typ == 'boolean')
 							$sql .= $v ? $this->true : $this->false;
-						else if ($v === null)
+						else if ($typ == 'object') {
+							if (method_exists($v, '__toString')) $sql .= $this->qstr($v->__toString());
+							else $sql .= $this->qstr((string) $v);
+						} else if ($v === null)
 							$sql .= 'NULL';
 						else
 							$sql .= $v;
@@ -1732,15 +1736,16 @@
 	 */
 	function& AutoExecute($table, $fields_values, $mode = 'INSERT', $where = FALSE, $forceUpdate=true, $magicq=false) 
 	{
+		$false = false;
 		$sql = 'SELECT * FROM '.$table;  
 		if ($where!==FALSE) $sql .= ' WHERE '.$where;
 		else if ($mode == 'UPDATE' || $mode == 2 /* DB_AUTOQUERY_UPDATE */) {
 			ADOConnection::outp('AutoExecute: Illegal mode=UPDATE with empty WHERE clause');
-			return false;
+			return $false;
 		}
 
 		$rs =& $this->SelectLimit($sql,1);
-		if (!$rs) return false; // table does not exist
+		if (!$rs) return $false; // table does not exist
 		$rs->tableName = $table;
 		
 		switch((string) $mode) {
@@ -1754,7 +1759,7 @@
 			break;
 		default:
 			ADOConnection::outp("AutoExecute: Unknown mode=$mode");
-			return false;
+			return $false;
 		}
 		$ret = false;
 		if ($sql) $ret = $this->Execute($sql);
@@ -2017,6 +2022,57 @@
 	 */
 	function BeginTrans() {return false;}
 	
+	/* set transaction mode */
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$transaction_mode = $this->MetaTransaction($transaction_mode, $this->dataProvider);
+		$this->_transmode  = $transaction_mode;
+	}
+/*
+http://msdn2.microsoft.com/en-US/ms173763.aspx
+http://dev.mysql.com/doc/refman/5.0/en/innodb-transaction-isolation.html
+http://www.postgresql.org/docs/8.1/interactive/sql-set-transaction.html
+http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_10005.htm
+*/
+	function MetaTransaction($mode,$db)
+	{
+		$mode = strtoupper($mode);
+		$mode = str_replace('ISOLATION LEVEL ','',$mode);
+		
+		switch($mode) {
+
+		case 'READ UNCOMMITTED':
+			switch($db) { 
+			case 'oci8':
+			case 'oracle':
+				return 'ISOLATION LEVEL READ COMMITTED';
+			default:
+				return 'ISOLATION LEVEL READ UNCOMMITTED';
+			}
+			break;
+					
+		case 'READ COMMITTED':
+				return 'ISOLATION LEVEL READ COMMITTED';
+			break;
+			
+		case 'REPEATABLE READ':
+			switch($db) {
+			case 'oci8':
+			case 'oracle':
+				return 'ISOLATION LEVEL SERIALIZABLE';
+			default:
+				return 'ISOLATION LEVEL REPEATABLE READ';
+			}
+			break;
+			
+		case 'SERIALIZABLE':
+				return 'ISOLATION LEVEL SERIALIZABLE';
+			break;
+			
+		default:
+			return $mode;
+		}
+	}
 	
 	/**
 	 * If database does not support transactions, always return true as data always commited
@@ -2208,7 +2264,7 @@
 	 *
 	 * @return  array of column names for current table.
 	 */ 
-	function &MetaColumnNames($table, $numIndexes=false) 
+	function &MetaColumnNames($table, $numIndexes=false,$useattnum=false /* only for postgres */) 
 	{
 		$objarr =& $this->MetaColumns($table);
 		if (!is_array($objarr)) {
@@ -2218,7 +2274,12 @@
 		$arr = array();
 		if ($numIndexes) {
 			$i = 0;
-			foreach($objarr as $v) $arr[$i++] = $v->name;
+			if ($useattnum) {
+				foreach($objarr as $v) 
+					$arr[$v->attnum] = $v->name;
+				
+			} else
+				foreach($objarr as $v) $arr[$i++] = $v->name;
 		} else
 			foreach($objarr as $v) $arr[strtoupper($v->name)] = $v->name;
 		
@@ -2260,6 +2321,22 @@
 		}
 
 		return adodb_date($this->fmtDate,$d);
+	}
+	
+	function BindDate($d)
+	{
+		$d = $this->DBDate($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
+	}
+	
+	function BindTimeStamp($d)
+	{
+		$d = $this->DBTimeStamp($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
 	}
 	
 	
@@ -3361,6 +3438,7 @@
 		'BPCHAR' => 'C',
 		'CHARACTER' => 'C',
 		'INTERVAL' => 'C',  # Postgres
+		'MACADDR' => 'C', # postgres
 		##
 		'LONGCHAR' => 'X',
 		'TEXT' => 'X',
@@ -3387,6 +3465,7 @@
 		'DATETIME' => 'T',
 		'TIMESTAMPTZ' => 'T',
 		'T' => 'T',
+		'TIMESTAMP WITHOUT TIME ZONE' => 'T', // postgresql
 		##
 		'BOOL' => 'L',
 		'BOOLEAN' => 'L', 

Modified: vtigercrm/trunk/adodb/datadict/datadict-access.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-access.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-access.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-db2.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-db2.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-db2.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-firebird.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-firebird.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-firebird.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-generic.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-generic.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-generic.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-ibase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-ibase.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-ibase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-informix.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-informix.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-informix.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-mysql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-mysql.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-mysql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-oci8.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-oci8.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-oci8.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-postgres.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-postgres.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-postgres.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/datadict/datadict-sybase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/datadict/datadict-sybase.inc.php (original)
+++ vtigercrm/trunk/adodb/datadict/datadict-sybase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-access.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-access.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-access.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-ado.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ado.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ado.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-ado5.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ado5.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ado5.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 
@@ -58,8 +58,22 @@
 	// you can also pass a connection string like this:
 	//
 	// $DB->Connect('USER ID=sa;PASSWORD=pwd;SERVER=mangrove;DATABASE=ai',false,false,'SQLOLEDB');
-	function _connect($argHostname, $argUsername, $argPassword, $argProvider= 'MSDASQL')
-	{
+	function _connect($argHostname, $argUsername, $argPassword,$argDBorProvider, $argProvider= '')
+	{
+	// two modes
+	//	-	if $argProvider is empty, we assume that $argDBorProvider holds provider -- this is for backward compat
+	//	- 	if $argProvider is not empty, then $argDBorProvider holds db
+	
+		
+		 if ($argProvider) {
+		 	$argDatabasename = $argDBorProvider;
+		 } else {
+		 	$argDatabasename = '';
+		 	if ($argDBorProvider) $argProvider = $argDBorProvider;
+			else $argProvider = 'MSDASQL';
+		}
+		
+		
 		try {
 		$u = 'UID';
 		$p = 'PWD';
@@ -86,7 +100,11 @@
 			$argProvider = "Microsoft.Jet.OLEDB.4.0"; // Microsoft Jet Provider
 		
 		if ($argProvider) $dbc->Provider = $argProvider;	
-		
+
+		if ($argProvider) $argHostname = "PROVIDER=$argProvider;DRIVER={SQL Server};SERVER=$argHostname";	
+		
+
+		if ($argDatabasename) $argHostname .= ";DATABASE=$argDatabasename";		
 		if ($argUsername) $argHostname .= ";$u=$argUsername";
 		if ($argPassword)$argHostname .= ";$p=$argPassword";
 		
@@ -205,9 +223,6 @@
 		return $arr;
 	}
 	
-
-
-	
 	/* returns queryID or false */
 	function &_query($sql,$inputarr=false) 
 	{
@@ -251,7 +266,8 @@
 		if ($rs->State == 0) {
 			$true = true;
 			return $true; // 0 = adStateClosed means no records returned
-		} return $rs;
+		}
+		return $rs;
 		
 		} catch (exception $e) {
 			
@@ -296,11 +312,17 @@
 	function ErrorMsg() 
 	{
 		if (!$this->_connectionID) return "No connection established";
-		$errc = $this->_connectionID->Errors;
-		if (!$errc) return "No Errors object found";
-		if ($errc->Count == 0) return '';
-		$err = $errc->Item($errc->Count-1);
-		return $err->Description;
+		$errmsg = '';
+		
+		try {
+			$errc = $this->_connectionID->Errors;
+			if (!$errc) return "No Errors object found";
+			if ($errc->Count == 0) return '';
+			$err = $errc->Item($errc->Count-1);
+			$errmsg = $err->Description;
+		}catch(exception $e) {
+		}
+		return $errmsg;
 	}
 	
 	function ErrorNo() 

Modified: vtigercrm/trunk/adodb/drivers/adodb-ado_access.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ado_access.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ado_access.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 Released under both BSD license and Lesser GPL library license. 
 Whenever there is any discrepancy between the two licenses, 
 the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-ado_mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ado_mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ado_mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 
@@ -11,8 +11,8 @@
   Microsoft SQL Server ADO data driver. Requires ADO and MSSQL client. 
   Works only on MS Windows.
   
-  It is normally better to use the mssql driver directly because it is much faster. 
-  This file is only a technology demonstration and for test purposes.
+  Warning: Some versions of PHP (esp PHP4) leak memory when ADO/COM is used. 
+  Please check http://bugs.php.net/ for more info.
 */
 
 // security - hide paths
@@ -53,6 +53,17 @@
 	        return $this->GetOne('select @@rowcount');
 	}
 	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET TRANSACTION ".$transaction_mode);
+	}
+	
 	function MetaColumns($table)
 	{
         $table = strtoupper($table);
@@ -84,6 +95,44 @@
 		return empty($arr) ? $false : $arr;
 	}
 	
+	function CreateSequence($seq='adodbseq',$start=1)
+	{
+		
+		$this->Execute('BEGIN TRANSACTION adodbseq');
+		$start -= 1;
+		$this->Execute("create table $seq (id float(53))");
+		$ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
+		if (!$ok) {
+				$this->Execute('ROLLBACK TRANSACTION adodbseq');
+				return false;
+		}
+		$this->Execute('COMMIT TRANSACTION adodbseq'); 
+		return true;
+	}
+
+	function GenID($seq='adodbseq',$start=1)
+	{
+		//$this->debug=1;
+		$this->Execute('BEGIN TRANSACTION adodbseq');
+		$ok = $this->Execute("update $seq with (tablock,holdlock) set id = id + 1");
+		if (!$ok) {
+			$this->Execute("create table $seq (id float(53))");
+			$ok = $this->Execute("insert into $seq with (tablock,holdlock) values($start)");
+			if (!$ok) {
+				$this->Execute('ROLLBACK TRANSACTION adodbseq');
+				return false;
+			}
+			$this->Execute('COMMIT TRANSACTION adodbseq'); 
+			return $start;
+		}
+		$num = $this->GetOne("select id from $seq");
+		$this->Execute('COMMIT TRANSACTION adodbseq'); 
+		return $num;
+		
+		// in old implementation, pre 1.90, we returned GUID...
+		//return $this->GetOne("SELECT CONVERT(varchar(255), NEWID()) AS 'Char'");
+	}
+	
 	} // end class 
 	
 	class  ADORecordSet_ado_mssql extends ADORecordSet_ado {        

Modified: vtigercrm/trunk/adodb/drivers/adodb-borland_ibase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-borland_ibase.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-borland_ibase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-csv.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-csv.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-csv.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-db2.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-db2.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-db2.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-  V4.81 3 May 2006  (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 
 This is a version of the ADODB driver for DB2.  It uses the 'ibm_db2' PECL extension for PHP
   (http://pecl.php.net/package/ibm_db2), which in turn requires DB2 V8.2.2.
@@ -25,7 +25,14 @@
 class ADODB_db2 extends ADOConnection {
 	var $databaseType = "db2";	
 	var $fmtDate = "'Y-m-d'";
-	var $fmtTimeStamp = "'Y-m-d, h:i:sA'";
+	var $concat_operator = '||';
+	
+	var $sysTime = 'CURRENT TIME';
+	var $sysDate = 'CURRENT DATE';
+	var $sysTimeStamp = 'CURRENT TIMESTAMP';
+	
+	var $fmtTimeStamp = "'Y-m-d-H.i.s'";
+	#var $fmtTimeStamp = "'Y-m-d, h:i:sA'";
 	var $replaceQuote = "''"; // string to use to replace quotes
 	var $dataProvider = "db2";
 	var $hasAffectedRows = true;
@@ -40,6 +47,12 @@
 	var $_haserrorfunctions = true;
 	var $_lastAffectedRows = 0;
 	var $uCaseTables = true; // for meta* functions, uppercase table names
+	var $hasInsertID = true;
+	
+    function _insertid()
+    {
+        return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()');
+    }
 	
 	function ADODB_db2() 
 	{ 	
@@ -103,6 +116,61 @@
 		return $this->_connectionID != false;
 	}
 
+	
+	// Format date column in sql string given an input format that understands Y M D
+	function SQLDate($fmt, $col=false)
+	{	
+	// use right() and replace() ?
+		if (!$col) $col = $this->sysDate;
+		$s = '';
+		
+		$len = strlen($fmt);
+		for ($i=0; $i < $len; $i++) {
+			if ($s) $s .= $this->concat_operator;
+			$ch = $fmt[$i];
+			switch($ch) {
+			case 'Y':
+			case 'y':
+				$s .= "char(year($col))";
+				break;
+			case 'M':
+				$s .= "substr(monthname($col),1,3)";
+				break;
+			case 'm':
+				$s .= "right(digits(month($col)),2)";
+				break;
+			case 'D':
+			case 'd':
+				$s .= "right(digits(day($col)),2)";
+				break;
+			case 'H':
+			case 'h':
+				if ($col != $this->sysDate) $s .= "right(digits(hour($col)),2)";	
+				else $s .= "''";
+				break;
+			case 'i':
+			case 'I':
+				if ($col != $this->sysDate)
+					$s .= "right(digits(minute($col)),2)";
+					else $s .= "''";
+				break;
+			case 'S':
+			case 's':
+				if ($col != $this->sysDate)
+					$s .= "right(digits(second($col)),2)";
+				else $s .= "''";
+				break;
+			default:
+				if ($ch == '\\') {
+					$i++;
+					$ch = substr($fmt,$i,1);
+				}
+				$s .= $this->qstr($ch);
+			}
+		}
+		return $s;
+	} 
+ 
 	
 	function ServerInfo()
 	{
@@ -575,15 +643,12 @@
 
 
 	// returns the field object
-	function &FetchField($fieldOffset = -1) 
-	{
-		
-		$off=$fieldOffset+1; // offsets begin at 1
-		
+	function &FetchField($offset = -1) 
+	{
 		$o= new ADOFieldObject();
-		$o->name = @db2_field_name($this->_queryID,$off);
-		$o->type = @db2_field_type($this->_queryID,$off);
-		$o->max_length = db2_field_width($this->_queryID,$off);
+		$o->name = @db2_field_name($this->_queryID,$offset);
+		$o->type = @db2_field_type($this->_queryID,$offset);
+		$o->max_length = db2_field_width($this->_queryID,$offset);
 		if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name);
 		else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name);
 		return $o;

Modified: vtigercrm/trunk/adodb/drivers/adodb-fbsql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-fbsql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-fbsql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
- @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-firebird.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-firebird.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-firebird.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-ibase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ibase.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ibase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.  
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.  
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-informix.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-informix.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-informix.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+* @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 * Released under both BSD license and Lesser GPL library license.
 * Whenever there is any discrepancy between the two licenses,
 * the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-informix72.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-informix72.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-informix72.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim. All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim. All rights reserved.
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-ldap.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-ldap.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-ldap.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
    Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 
@@ -296,6 +296,17 @@
 		return true;
 	}
 	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET TRANSACTION ".$transaction_mode);
+	}
+	
 	/*
 		Usage:
 		

Modified: vtigercrm/trunk/adodb/drivers/adodb-mssqlpo.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-mssqlpo.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-mssqlpo.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /**
-* @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+* @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
 * Released under both BSD license and Lesser GPL library license.
 * Whenever there is any discrepancy between the two licenses,
 * the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-mysql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-mysql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-mysql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -542,6 +542,9 @@
 	// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
 	function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE )
      {
+	 global $ADODB_FETCH_MODE;
+		if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC || $this->fetchMode == ADODB_FETCH_ASSOC) $associative = true;
+
          if ( !empty($owner) ) {
             $table = "$owner.$table";
          }

Modified: vtigercrm/trunk/adodb/drivers/adodb-mysqli.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-mysqli.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-mysqli.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -58,6 +58,16 @@
 	    
 	}
 	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET SESSION TRANSACTION ".$transaction_mode);
+	}
 
 	// returns true or false
 	// To add: parameter int $port,
@@ -445,6 +455,10 @@
 	// "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx>
 	function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE )
 	{
+	 global $ADODB_FETCH_MODE;
+		
+		if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC || $this->fetchMode == ADODB_FETCH_ASSOC) $associative = true;
+		
 	    if ( !empty($owner) ) {
 	       $table = "$owner.$table";
 	    }

Modified: vtigercrm/trunk/adodb/drivers/adodb-mysqlt.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-mysqlt.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-mysqlt.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -28,6 +28,23 @@
 	function ADODB_mysqlt() 
 	{			
 	global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
+	}
+	
+	/* set transaction mode
+	
+	SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL
+{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE }
+
+	*/
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET SESSION TRANSACTION ".$transaction_mode);
 	}
 	
 	function BeginTrans()

Modified: vtigercrm/trunk/adodb/drivers/adodb-netezza.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-netezza.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-netezza.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  
   First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com
  Based on the previous postgres drivers.

Modified: vtigercrm/trunk/adodb/drivers/adodb-oci8.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-oci8.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-oci8.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 /*
 
-  version V4.81 3 May 2006 (c) 2000-2006 John Lim. All rights reserved.
+  version V4.90 8 June 2006 (c) 2000-2006 John Lim. All rights reserved.
 
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
@@ -278,6 +278,21 @@
 		return "TO_DATE(".adodb_date($this->fmtDate,$d).",'".$this->NLS_DATE_FORMAT."')";
 	}
 
+	function BindDate($d)
+	{
+		$d = ADOConnection::DBDate($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
+	}
+	
+	function BindTimeStamp($d)
+	{
+		$d = ADOConnection::DBTimeStamp($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
+	}
 	
 	// format and return date string in database timestamp format
 	function DBTimeStamp($ts)
@@ -381,6 +396,8 @@
 		$this->transCnt += 1;
 		$this->autoCommit = false;
 		$this->_commit = OCI_DEFAULT;
+		
+		if ($this->_transmode) $this->Execute("SET TRANSACTION ".$this->_transmode);
 		return true;
 	}
 	

Modified: vtigercrm/trunk/adodb/drivers/adodb-oci805.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-oci805.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-oci805.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-oci8po.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-oci8po.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-oci8po.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim. All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim. All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbc.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbc.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbc.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbc_db2.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbc_db2.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbc_db2.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 
@@ -60,7 +60,7 @@
 ========================
 To set SQL_CUR_USE_ODBC for drivers that require it, do this:
 
-$db = NewADOConnection('db2');
+$db = NewADOConnection('odbc_db2');
 $db->curMode = SQL_CUR_USE_ODBC;
 $db->Connect($dsn, $userid, $pwd);
 
@@ -80,6 +80,10 @@
 > In case of DB2 I had to swap the first and last arguments in order to connect properly. 
 
 
+System Error 5
+==============
+IF you get a System Error 5 when trying to Connect/Load, it could be a permission problem. Give the user connecting
+to DB2 full rights to the DB2 SQLLIB directory, and place the user in the DBUSERS group.
 */
 
 // security - hide paths
@@ -88,13 +92,14 @@
 if (!defined('_ADODB_ODBC_LAYER')) {
 	include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
 }
-if (!defined('ADODB_DB2')){
-define('ADODB_DB2',1);
-
-class ADODB_DB2 extends ADODB_odbc {
+if (!defined('ADODB_ODBC_DB2')){
+define('ADODB_ODBC_DB2',1);
+
+class ADODB_ODBC_DB2 extends ADODB_odbc {
 	var $databaseType = "db2";	
 	var $concat_operator = '||';
-	var $sysDate = 'CURRENT_DATE';
+	var $sysTime = 'CURRENT TIME';
+	var $sysDate = 'CURRENT DATE';
 	var $sysTimeStamp = 'CURRENT TIMESTAMP';
 	// The complete string representation of a timestamp has the form 
 	// yyyy-mm-dd-hh.mm.ss.nnnnnn.
@@ -103,6 +108,7 @@
 	var $identitySQL = 'values IDENTITY_VAL_LOCAL()';
 	var $_bindInputArray = true;
 	 var $hasInsertID = true;
+	var $rsPrefix = 'ADORecordset_odbc_';
 	
 	function ADODB_DB2()
 	{
@@ -294,7 +300,7 @@
 };
  
 
-class  ADORecordSet_db2 extends ADORecordSet_odbc {	
+class  ADORecordSet_odbc_db2 extends ADORecordSet_odbc {	
 	
 	var $databaseType = "db2";		
 	

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbc_mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbc_mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbc_mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 
@@ -142,6 +142,17 @@
 		return ADODB_odbc::_query($sql,$inputarr);
 	}
 	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET TRANSACTION ".$transaction_mode);
+	}
+	
 	// "Stein-Aksel Basma" <basma at accelero.no>
 	// tested with MSSQL 2000
 	function &MetaPrimaryKeys($table)

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbc_oracle.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbc_oracle.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbc_oracle.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbtp.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbtp.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbtp.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence. See License.txt.

Modified: vtigercrm/trunk/adodb/drivers/adodb-odbtp_unicode.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-odbtp_unicode.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-odbtp_unicode.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-	V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+	V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence. See License.txt.

Modified: vtigercrm/trunk/adodb/drivers/adodb-oracle.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-oracle.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-oracle.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -45,6 +45,24 @@
 		if (is_string($ts)) $d = ADORecordSet::UnixTimeStamp($ts);
 		return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'RRRR-MM-DD, HH:MI:SS AM')";
 	}
+	
+	
+	function BindDate($d)
+	{
+		$d = ADOConnection::DBDate($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
+	}
+	
+	function BindTimeStamp($d)
+	{
+		$d = ADOConnection::DBTimeStamp($d);
+		if (strncmp($d,"'",1)) return $d;
+		
+		return substr($d,1,strlen($d)-2);
+	}
+	
 
 	
 	function BeginTrans()

Modified: vtigercrm/trunk/adodb/drivers/adodb-pdo.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-pdo.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-pdo.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-pdo_mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-pdo_mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-pdo_mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -36,6 +36,17 @@
 		return $ret;
 	}
 	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET TRANSACTION ".$transaction_mode);
+	}
+	
 	function MetaTables()
 	{
 		return false;

Modified: vtigercrm/trunk/adodb/drivers/adodb-pdo_mysql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-pdo_mysql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-pdo_mysql.inc.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -48,6 +48,17 @@
 		
 		$this->metaTablesSQL = $save;
 		return $ret;
+	}
+	
+	function SetTransactionMode( $transaction_mode ) 
+	{
+		$this->_transmode  = $transaction_mode;
+		if (empty($transaction_mode)) {
+			$this->Execute('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ');
+			return;
+		}
+		if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
+		$this->Execute("SET SESSION TRANSACTION ".$transaction_mode);
 	}
 	
  	function &MetaColumns($table) 

Modified: vtigercrm/trunk/adodb/drivers/adodb-pdo_oci.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-pdo_oci.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-pdo_oci.inc.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-pdo_pgsql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-pdo_pgsql.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-pdo_pgsql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-postgres.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-postgres.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-postgres.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
- V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-postgres64.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-postgres64.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-postgres64.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
- V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -174,7 +174,7 @@
 	{
 		if ($this->transOff) return true;
 		$this->transCnt += 1;
-		return @pg_Exec($this->_connectionID, "begin");
+		return @pg_Exec($this->_connectionID, "begin ".$this->_transmode);
 	}
 	
 	function RowLock($tables,$where,$flds='1 as ignore') 
@@ -532,6 +532,8 @@
 			$fld->name = $rs->fields[0];
 			$fld->type = $rs->fields[1];
 			$fld->max_length = $rs->fields[2];
+			$fld->attnum = $rs->fields[6];
+			
 			if ($fld->max_length <= 0) $fld->max_length = $rs->fields[3]-4;
 			if ($fld->max_length <= 0) $fld->max_length = -1;
 			if ($fld->type == 'numeric') {
@@ -617,12 +619,14 @@
 					return $false;
                 }
 				
-                $col_names = $this->MetaColumnNames($table,true);
+                $col_names = $this->MetaColumnNames($table,true,true); 
+				//3rd param is use attnum, 
+				// see http://sourceforge.net/tracker/index.php?func=detail&aid=1451245&group_id=42718&atid=433976
                 $indexes = array();
                 while ($row = $rs->FetchRow()) {
                         $columns = array();
                         foreach (explode(' ', $row[2]) as $col) {
-                                $columns[] = $col_names[$col - 1];
+                                $columns[] = $col_names[$col];
                         }
                         
                         $indexes[$row[0]] = array(
@@ -701,7 +705,7 @@
 	// returns queryID or false
 	function _query($sql,$inputarr)
 	{
-		
+		$this->_errorMsg = false;
 		if ($inputarr) {
 		/*
 			It appears that PREPARE/EXECUTE is slower for many queries.
@@ -730,6 +734,7 @@
 			
 			if ($execp) $exsql = "EXECUTE $plan ($execp)";
 			else $exsql = "EXECUTE $plan";
+			
 			
 			$rez = @pg_exec($this->_connectionID,$exsql);
 			if (!$rez) {
@@ -756,12 +761,11 @@
 				$s = "PREPARE $plan ($params) AS ".substr($sql,0,strlen($sql)-2);		
 				//adodb_pr($s);
 				pg_exec($this->_connectionID,$s);
-				echo $this->ErrorMsg();
+				//echo $this->ErrorMsg();
 			}
 			
 			$rez = pg_exec($this->_connectionID,$exsql);
 		} else {
-			$this->_errorMsg = false;
 			//adodb_backtrace();
 			$rez = pg_exec($this->_connectionID,$sql);
 		}
@@ -1000,6 +1004,7 @@
 		   		case 'BPCHAR':
 				case '_VARCHAR':
 				case 'INET':
+				case 'MACADDR':
 					if ($len <= $this->blobSize) return 'C';
 				
 				case 'TEXT':
@@ -1019,6 +1024,8 @@
 				case 'DATE':
 					return 'D';
 				
+				
+				case 'TIMESTAMP WITHOUT TIME ZONE':
 				case 'TIME':
 				case 'DATETIME':
 				case 'TIMESTAMP':

Modified: vtigercrm/trunk/adodb/drivers/adodb-postgres7.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-postgres7.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-postgres7.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
- V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -55,6 +55,7 @@
 		return $sql;
 	}
  	*/
+
 
 	// from  Edward Jaramilla, improved version - works on pg 7.4
 	function MetaForeignKeys($table, $owner=false, $upper=false)
@@ -96,6 +97,7 @@
 			// We don't have native support for parameterized queries, so let's emulate it at the parent
 			return ADODB_postgres64::_query($sql, $inputarr);
 		}
+		$this->_errorMsg = false;
 		// -- added Cristiano da Cunha Duarte
 		if ($inputarr) {
 			$sqlarr = explode('?',trim($sql));

Modified: vtigercrm/trunk/adodb/drivers/adodb-postgres8.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-postgres8.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-postgres8.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
- V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-proxy.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-proxy.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-proxy.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-sapdb.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sapdb.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sapdb.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-sqlanywhere.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sqlanywhere.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sqlanywhere.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-version V4.81 3 May 2006 (c) 2000-2006  John Lim (jlim#natsoft.com.my).  All rights
+version V4.90 8 June 2006 (c) 2000-2006  John Lim (jlim#natsoft.com.my).  All rights
 reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 

Modified: vtigercrm/trunk/adodb/drivers/adodb-sqlite.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sqlite.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sqlite.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-sqlitepo.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sqlitepo.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sqlitepo.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-sybase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sybase.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sybase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim. All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim. All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/drivers/adodb-sybase_ase.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-sybase_ase.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-sybase_ase.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/drivers/adodb-vfp.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/drivers/adodb-vfp.inc.php (original)
+++ vtigercrm/trunk/adodb/drivers/adodb-vfp.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/perf/perf-db2.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-db2.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-db2.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/perf/perf-informix.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-informix.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-informix.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/perf/perf-mssql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-mssql.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-mssql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/perf/perf-mysql.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-mysql.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-mysql.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/perf/perf-oci8.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-oci8.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-oci8.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/perf/perf-postgres.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/perf/perf-postgres.inc.php (original)
+++ vtigercrm/trunk/adodb/perf/perf-postgres.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /* 
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. See License.txt. 

Modified: vtigercrm/trunk/adodb/pivottable.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/pivottable.inc.php (original)
+++ vtigercrm/trunk/adodb/pivottable.inc.php Fri Jun 16 07:06:09 2006
@@ -1,15 +1,12 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 
  *
  * Set tabs to 4 for best viewing.
  * 
- * Latest version is available at http://php.weblogs.com
- *
- * Requires PHP4.01pl2 or later because it uses include_once
 */
 
 /*
@@ -38,7 +35,7 @@
 	else $hidecnt = false;
 	
 	$iif = strpos($db->databaseType,'access') !== false; 
-		// note - vfp still doesn' work even with IIF enabled || $db->databaseType == 'vfp';
+		// note - vfp 6 still doesn' work even with IIF enabled || $db->databaseType == 'vfp';
 	
 	//$hidecnt = false;
 	
@@ -95,7 +92,12 @@
 	else
 		$sel = substr($sel,0,strlen($sel)-2);
 	
+	
+	// Strip aliases
+	$rowfields = preg_replace('/ AS (\w+)/i', '', $rowfields);
+	
 	$sql = "SELECT $sel \nFROM $tables $where \nGROUP BY $rowfields";
+	
 	return $sql;
  }
 

Modified: vtigercrm/trunk/adodb/rsfilter.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/rsfilter.inc.php (original)
+++ vtigercrm/trunk/adodb/rsfilter.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/server.php
==============================================================================
--- vtigercrm/trunk/adodb/server.php (original)
+++ vtigercrm/trunk/adodb/server.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/session/adodb-compress-bzip2.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-compress-bzip2.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-compress-bzip2.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-compress-gzip.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-compress-gzip.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-compress-gzip.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-cryptsession.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-cryptsession.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-cryptsession.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-encrypt-mcrypt.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-encrypt-mcrypt.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-encrypt-mcrypt.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-encrypt-md5.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-encrypt-md5.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-encrypt-md5.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-encrypt-secret.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-encrypt-secret.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-encrypt-secret.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-session-clob.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-session-clob.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-session-clob.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,

Modified: vtigercrm/trunk/adodb/session/adodb-session.php
==============================================================================
--- vtigercrm/trunk/adodb/session/adodb-session.php (original)
+++ vtigercrm/trunk/adodb/session/adodb-session.php Fri Jun 16 07:06:09 2006
@@ -2,7 +2,7 @@
 
 
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
          Contributed by Ross Smith (adodb at netebb.com). 
   Released under both BSD license and Lesser GPL library license.
   Whenever there is any discrepancy between the two licenses,
@@ -492,6 +492,19 @@
 	/////////////////////
 	// public methods
 	/////////////////////
+	
+	function config($driver, $host, $user, $password, $database=false,$options=false)
+	{
+		ADODB_Session::driver($driver);
+		ADODB_Session::host($host);
+		ADODB_Session::user($user);
+		ADODB_Session::password($password);
+		ADODB_Session::database($database);
+		
+		if (isset($options['table'])) ADODB_Session::table($options['table']);
+		if (isset($options['clob'])) ADODB_Session::table($options['clob']);
+		if (isset($options['field'])) ADODB_Session::dataFieldName($options['field']);
+	}
 
 	/*!
 		Create the connection to the database.
@@ -523,7 +536,6 @@
 #		assert('$driver');
 #		assert('$host');
 
-		// cannot use =& below - do not know why...
 		$conn =& ADONewConnection($driver);
 
 		if ($debug) {
@@ -618,6 +630,10 @@
 		If the data has not been modified since the last read(), we do not write.
 	*/
 	function write($key, $val) {
+	global $ADODB_SESSION_READONLY;
+	
+		if (!empty($ADODB_SESSION_READONLY)) return;
+		
 		$clob			= ADODB_Session::clob();
 		$conn			=& ADODB_Session::_conn();
 		$crc			= ADODB_Session::_crc();
@@ -646,12 +662,19 @@
 			if ($debug) {
 				echo '<p>Session: Only updating date - crc32 not changed</p>';
 			}
-			$sql = "UPDATE $table SET expiry = ".$conn->Param('0')." WHERE $binary sesskey = ".$conn->Param('1')." AND expiry >= ".$conn->Param('2');
-			$rs =& $conn->Execute($sql,array($expiry,$key,time()));
-			ADODB_Session::_dumprs($rs);
-			if ($rs) {
-				$rs->Close();
-			}
+			
+			$expirevar = '';
+			if ($expire_notify) {
+				$var = reset($expire_notify);
+				global $$var;
+				if (isset($$var)) {
+					$expirevar = $$var;
+				}
+			}
+			
+			
+			$sql = "UPDATE $table SET expiry = ".$conn->Param('0').",expireref=".$conn->Param('1')." WHERE $binary sesskey = ".$conn->Param('2')." AND expiry >= ".$conn->Param('3');
+			$rs =& $conn->Execute($sql,array($expiry,$expirevar,$key,time()));
 			return true;
 		}
 		$val = rawurlencode($val);
@@ -673,7 +696,7 @@
 		if (!$clob) {	// no lobs, simply use replace()
 			$arr[$data] = $conn->qstr($val);
 			$rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
-			ADODB_Session::_dumprs($rs);
+			
 		} else {
 			// what value shall we insert/update for lob row?
 			switch ($driver) {
@@ -691,13 +714,13 @@
 					break;
 			}
 			
+			$expiryref = $conn->qstr($arr['expireref']);
 			// do we insert or update? => as for sesskey
 			$rs =& $conn->Execute("SELECT COUNT(*) AS cnt FROM $table WHERE $binary sesskey = $qkey");
-			ADODB_Session::_dumprs($rs);
 			if ($rs && reset($rs->fields) > 0) {
-				$sql = "UPDATE $table SET expiry = $expiry, $data = $lob_value WHERE  sesskey = $qkey";
+				$sql = "UPDATE $table SET expiry = $expiry, $data = $lob_value, expireref=$expiryref WHERE  sesskey = $qkey";
 			} else {
-				$sql = "INSERT INTO $table (expiry, $data, sesskey) VALUES ($expiry, $lob_value, $qkey)";
+				$sql = "INSERT INTO $table (expiry, $data, sesskey,expireref) VALUES ($expiry, $lob_value, $qkey,$expiryref)";
 			}
 			if ($rs) {
 				$rs->Close();
@@ -705,12 +728,11 @@
 
 			$err = '';
 			$rs1 =& $conn->Execute($sql);
-			ADODB_Session::_dumprs($rs1);
 			if (!$rs1) {
 				$err = $conn->ErrorMsg()."\n";
 			}
 			$rs2 =& $conn->UpdateBlob($table, $data, $val, " sesskey=$qkey", strtoupper($clob));
-			ADODB_Session::_dumprs($rs2);
+			
 			if (!$rs2) {
 				$err .= $conn->ErrorMsg()."\n";
 			}
@@ -901,7 +923,8 @@
 }
 
 ADODB_Session::_init();
-register_shutdown_function('session_write_close');
+if (empty($ADODB_SESSION_READONLY))
+	register_shutdown_function('session_write_close');
 
 // for backwards compatability only
 function adodb_sess_open($save_path, $session_name, $persist = true) {
@@ -914,4 +937,4 @@
 	return ADODB_Session::gc($t);
 }
 
-?>
+?>

Modified: vtigercrm/trunk/adodb/session/old/adodb-cryptsession.php
==============================================================================
--- vtigercrm/trunk/adodb/session/old/adodb-cryptsession.php (original)
+++ vtigercrm/trunk/adodb/session/old/adodb-cryptsession.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/session/old/adodb-session-clob.php
==============================================================================
--- vtigercrm/trunk/adodb/session/old/adodb-session-clob.php (original)
+++ vtigercrm/trunk/adodb/session/old/adodb-session-clob.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/session/old/adodb-session.php
==============================================================================
--- vtigercrm/trunk/adodb/session/old/adodb-session.php (original)
+++ vtigercrm/trunk/adodb/session/old/adodb-session.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php
 /*
-V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.

Modified: vtigercrm/trunk/adodb/tests/test-active-recs2.php
==============================================================================
--- vtigercrm/trunk/adodb/tests/test-active-recs2.php (original)
+++ vtigercrm/trunk/adodb/tests/test-active-recs2.php Fri Jun 16 07:06:09 2006
@@ -29,9 +29,11 @@
 
 
 
+
 $rec = new ADODB_Active_Record('photos');
 
 $rec = new ADODB_Active_Record('products');
+
 
 adodb_pr($rec->getAttributeNames());
 

Modified: vtigercrm/trunk/adodb/tests/test.php
==============================================================================
--- vtigercrm/trunk/adodb/tests/test.php (original)
+++ vtigercrm/trunk/adodb/tests/test.php Fri Jun 16 07:06:09 2006
@@ -747,7 +747,14 @@
 		where id=".$db->Param('zid')." and created>=".$db->Param('ZDATE')."",
 		$array);
 	if ($id != 1) Err("Bad bind; id=$id");
-	else echo "<br>Bind date/integer passed";
+	else echo "<br>Bind date/integer 1 passed";
+	
+	$array =array(1,$db->BindDate(time()));
+	$id = $db->GetOne("select id from ADOXYZ 
+		where id=".$db->Param('0')." and created>=".$db->Param('1')."",
+		$array);
+	if ($id != 1) Err("Bad bind; id=$id");
+	else echo "<br>Bind date/integer 2 passed";
 	
 	$db->debug = false;
 	$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
@@ -1327,13 +1334,16 @@
 	$date = $db->SQLDate('d-m-M-Y-\QQ h:i:s A',$db->DBDate("1974-02-25"));
 	$sql = "SELECT $date from ADOXYZ";
 	print "<p>Test SQLDate: ".htmlspecialchars($sql)."</p>";
+	$db->debug=1;
 	$rs = $db->SelectLimit($sql,1);
 	$ts = ADOConnection::UnixDate('1974-02-25');
 	$d = date('d-m-M-Y-',$ts).'Q'.(ceil(date('m',$ts)/3.0)).date(' h:i:s A',$ts);
 	if (!$rs) {
 		Err("SQLDate query returned no recordset");
 		echo $db->ErrorMsg(),'<br>';
-	} else if ($d != $rs->fields[0]) Err("SQLDate 2 failed expected: <br>act:$d <br>sql:".$rs->fields[0]);
+	} else if ($d != reset($rs->fields)) {
+		Err("SQLDate 2 failed expected: <br>act:$d <br>sql:".$rs->fields[0].' <br>'.$db->ErrorMsg());
+	}
 	
 	
 	print "<p>Test Filter</p>";
@@ -1504,9 +1514,11 @@
 	flush();
 	
 	if ($db->hasTransactions) {
-		//$db->debug=1;
+		$db->debug=1;
 		echo "<p>Testing StartTrans CompleteTrans</p>";
 		$db->raiseErrorFn = false;
+		
+		$db->SetTransactionMode('SERIALIZABLE');
 		$db->StartTrans();
 		$rs = $db->Execute('select * from notable');
 			$db->StartTrans();
@@ -1515,6 +1527,8 @@
 				$db->CommitTrans();
 			$db->CompleteTrans();
 		$rez = $db->CompleteTrans();
+		$db->SetTransactionMode('');
+		$db->debug=0;
 		if ($rez !== false) {
 			if (is_null($rez)) Err("Error: _transOK not modified");
 			else Err("Error: CompleteTrans (1) should have failed");

Modified: vtigercrm/trunk/adodb/tests/testdatabases.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/tests/testdatabases.inc.php (original)
+++ vtigercrm/trunk/adodb/tests/testdatabases.inc.php Fri Jun 16 07:06:09 2006
@@ -314,17 +314,28 @@
 
 }
 
-ADOLoadCode("db2"); // no longer supported
-if (!empty($testdb2)) { 
-	$db = ADONewConnection();
-	print "<h1>Connecting $db->databaseType...</h1>";
-	
-	$dsn = "db2_sample";
-	$dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft";
-	if ($db->Connect($dsn)) {
-	//	testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
-	} else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
-
+ADOLoadCode("odbc_db2"); // no longer supported
+if (!empty($testdb2)) {
+	if (PHP_VERSION>=5.1) {
+		$db = ADONewConnection("db2");
+		print "<h1>Connecting $db->databaseType...</h1>";
+		
+		#$db->curMode = SQL_CUR_USE_ODBC;
+		#$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
+		if ($db->Connect('localhost','natsoft','guest','test')) {
+			testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
+		} else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
+	} else { 
+		$db = ADONewConnection("odbc_db2");
+		print "<h1>Connecting $db->databaseType...</h1>";
+		
+		$dsn = "db2test";
+		#$db->curMode = SQL_CUR_USE_ODBC;
+		#$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
+		if ($db->Connect($dsn)) {
+			testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
+		} else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
+	}
 echo "<hr />";
 flush();
 	$dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft";

Modified: vtigercrm/trunk/adodb/toexport.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/toexport.inc.php (original)
+++ vtigercrm/trunk/adodb/toexport.inc.php Fri Jun 16 07:06:09 2006
@@ -1,7 +1,7 @@
 <?php
 
 /** 
- * @version V4.81 3 May 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+ * @version V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  * Released under both BSD license and Lesser GPL library license. 
  * Whenever there is any discrepancy between the two licenses, 
  * the BSD license will take precedence. 

Modified: vtigercrm/trunk/adodb/tohtml.inc.php
==============================================================================
--- vtigercrm/trunk/adodb/tohtml.inc.php (original)
+++ vtigercrm/trunk/adodb/tohtml.inc.php Fri Jun 16 07:06:09 2006
@@ -1,6 +1,6 @@
 <?php 
 /*
-  V4.81 3 May 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
+  V4.90 8 June 2006  (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
   Released under both BSD license and Lesser GPL library license. 
   Whenever there is any discrepancy between the two licenses, 
   the BSD license will take precedence.
@@ -95,7 +95,7 @@
 			break;
 			
 			case 'N':
-				if (abs($v) - round($v,0) < 0.00000001)
+				if (abs(abs($v) - round($v,0)) < 0.00000001)
 					$v = round($v);
 				else
 					$v = round($v,$ADODB_ROUND);





More information about the vtigercrm-commits mailing list