[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11338] API: update adodb from upstream
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11338] API: update adodb from upstream |
Date: |
Fri, 27 Sep 2013 13:29:43 +0000 |
Revision: 11338
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11338
Author: sigurdne
Date: 2013-09-27 13:29:42 +0000 (Fri, 27 Sep 2013)
Log Message:
-----------
API: update adodb from upstream
Modified Paths:
--------------
trunk/phpgwapi/inc/adodb/adodb-active-record.inc.php
trunk/phpgwapi/inc/adodb/adodb-active-recordx.inc.php
trunk/phpgwapi/inc/adodb/adodb-csvlib.inc.php
trunk/phpgwapi/inc/adodb/adodb-datadict.inc.php
trunk/phpgwapi/inc/adodb/adodb-error.inc.php
trunk/phpgwapi/inc/adodb/adodb-errorhandler.inc.php
trunk/phpgwapi/inc/adodb/adodb-errorpear.inc.php
trunk/phpgwapi/inc/adodb/adodb-exceptions.inc.php
trunk/phpgwapi/inc/adodb/adodb-iterator.inc.php
trunk/phpgwapi/inc/adodb/adodb-lib.inc.php
trunk/phpgwapi/inc/adodb/adodb-memcache.lib.inc.php
trunk/phpgwapi/inc/adodb/adodb-pager.inc.php
trunk/phpgwapi/inc/adodb/adodb-pear.inc.php
trunk/phpgwapi/inc/adodb/adodb-perf.inc.php
trunk/phpgwapi/inc/adodb/adodb-php4.inc.php
trunk/phpgwapi/inc/adodb/adodb-time.inc.php
trunk/phpgwapi/inc/adodb/adodb.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-access.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-db2.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-firebird.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-generic.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-ibase.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-informix.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-mssql.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-mssqlnative.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-oci8.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-postgres.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-sqlite.inc.php
trunk/phpgwapi/inc/adodb/datadict/datadict-sybase.inc.php
trunk/phpgwapi/inc/adodb/docs/docs-active-record.htm
trunk/phpgwapi/inc/adodb/docs/docs-adodb.htm
trunk/phpgwapi/inc/adodb/docs/docs-datadict.htm
trunk/phpgwapi/inc/adodb/docs/docs-perf.htm
trunk/phpgwapi/inc/adodb/docs/docs-session.htm
trunk/phpgwapi/inc/adodb/docs/docs-session.old.htm
trunk/phpgwapi/inc/adodb/docs/readme.htm
trunk/phpgwapi/inc/adodb/drivers/adodb-access.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ado.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ado5.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ado_access.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ado_mssql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-db2.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-db2oci.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-db2ora.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-fbsql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-firebird.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mssql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mssql_n.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlnative.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mysql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlpo.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-oci8.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-oci8po.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_db2.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_oracle.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mssql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mysql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_oci.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_pgsql.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_sqlite.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-postgres.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-postgres8.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-proxy.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sapdb.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sqlanywhere.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sqlitepo.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sybase.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sybase_ase.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-vfp.inc.php
trunk/phpgwapi/inc/adodb/lang/adodb-en.inc.php
trunk/phpgwapi/inc/adodb/pear/Auth/Container/ADOdb.php
trunk/phpgwapi/inc/adodb/perf/perf-db2.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-informix.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-mssql.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-mssqlnative.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-mysql.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-oci8.inc.php
trunk/phpgwapi/inc/adodb/perf/perf-postgres.inc.php
trunk/phpgwapi/inc/adodb/pivottable.inc.php
trunk/phpgwapi/inc/adodb/readme.txt
trunk/phpgwapi/inc/adodb/rsfilter.inc.php
trunk/phpgwapi/inc/adodb/server.php
trunk/phpgwapi/inc/adodb/session/adodb-compress-bzip2.php
trunk/phpgwapi/inc/adodb/session/adodb-compress-gzip.php
trunk/phpgwapi/inc/adodb/session/adodb-cryptsession.php
trunk/phpgwapi/inc/adodb/session/adodb-cryptsession2.php
trunk/phpgwapi/inc/adodb/session/adodb-encrypt-mcrypt.php
trunk/phpgwapi/inc/adodb/session/adodb-encrypt-md5.php
trunk/phpgwapi/inc/adodb/session/adodb-encrypt-secret.php
trunk/phpgwapi/inc/adodb/session/adodb-session-clob.php
trunk/phpgwapi/inc/adodb/session/adodb-session-clob2.php
trunk/phpgwapi/inc/adodb/session/adodb-session.php
trunk/phpgwapi/inc/adodb/session/adodb-session2.php
trunk/phpgwapi/inc/adodb/session/crypt.inc.php
trunk/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php
trunk/phpgwapi/inc/adodb/session/old/adodb-session-clob.php
trunk/phpgwapi/inc/adodb/session/old/adodb-session.php
trunk/phpgwapi/inc/adodb/tests/benchmark.php
trunk/phpgwapi/inc/adodb/tests/test-datadict.php
trunk/phpgwapi/inc/adodb/tests/test-php5.php
trunk/phpgwapi/inc/adodb/tests/test.php
trunk/phpgwapi/inc/adodb/tests/test3.php
trunk/phpgwapi/inc/adodb/tests/test4.php
trunk/phpgwapi/inc/adodb/tests/test5.php
trunk/phpgwapi/inc/adodb/tests/testcache.php
trunk/phpgwapi/inc/adodb/tests/testdatabases.inc.php
trunk/phpgwapi/inc/adodb/tests/testmssql.php
trunk/phpgwapi/inc/adodb/tests/testoci8.php
trunk/phpgwapi/inc/adodb/tests/testoci8cursor.php
trunk/phpgwapi/inc/adodb/tests/testpaging.php
trunk/phpgwapi/inc/adodb/tests/testpear.php
trunk/phpgwapi/inc/adodb/tests/testsessions.php
trunk/phpgwapi/inc/adodb/toexport.inc.php
trunk/phpgwapi/inc/adodb/tohtml.inc.php
Added Paths:
-----------
trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb.gif
trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb2.gif
trunk/phpgwapi/inc/adodb/drivers/adodb-postgres9.inc.php
trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite3.inc.php
Modified: trunk/phpgwapi/inc/adodb/adodb-active-record.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-active-record.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-active-record.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
address@hidden V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com).
All rights reserved.
address@hidden V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com).
All rights reserved.
Latest version is available at http://adodb.sourceforge.net
Released under both BSD license and Lesser GPL library license.
@@ -87,6 +87,8 @@
var $foreignName; // CFR: class name when in a relationship
+ var $lockMode = ' for update '; // you might want to change to
+
static function UseDefaultValues($bool=null)
{
global $ADODB_ACTIVE_DEFVALS;
@@ -631,17 +633,17 @@
switch($t) {
case 'L':
if (strpos($db->databaseType,'postgres') !== false)
return $db->qstr($val);
- case 'D':
+ case 'D':
case 'T':
if (empty($val)) return 'null';
- case 'B':
+ case 'B':
case 'N':
case 'C':
case 'X':
if (is_null($val)) return 'null';
- if (strlen($val)>1 &&
+ if (strlen($val)>0 &&
(strncmp($val,"'",1) != 0 ||
substr($val,strlen($val)-1,1) != "'")) {
return $db->qstr($val);
break;
@@ -677,7 +679,7 @@
//------------------------------------------------------------ Public
functions below
- function Load($where=null,$bindarr=false)
+ function Load($where=null,$bindarr=false, $lock = false)
{
global $ADODB_FETCH_MODE;
@@ -689,10 +691,12 @@
if ($db->fetchMode !== false) $savem = $db->SetFetchMode(false);
$qry = "select * from ".$this->_table;
-
+
if($where) {
$qry .= ' WHERE '.$where;
}
+ if ($lock) $qry .= $this->lockMode;
+
$row = $db->GetRow($qry,$bindarr);
if (isset($savem)) $db->SetFetchMode($savem);
@@ -701,6 +705,11 @@
return $this->Set($row);
}
+ function LoadLocked($where=null, $bindarr=false)
+ {
+ $this->Load($where,$bindarr,true);
+ }
+
# useful for multiple record inserts
# see http://phplens.com/lens/lensforum/msgs.php?id=17795
function Reset()
@@ -899,10 +908,11 @@
}
}
}
+
+ if (isset($this->_original[$i]) &&
strcmp($val,$this->_original[$i]) == 0) continue;
- if (isset($this->_original[$i]) &&
strcmp($val,$this->_original[$i]) == 0) {
- continue;
- }
+ if (is_null($this->_original[$i]) && is_null($val))
continue;
+
$valarr[] = $val;
$pairs[] =
$this->_QName($name,$db).'='.$db->Param($cnt);
$cnt += 1;
Modified: trunk/phpgwapi/inc/adodb/adodb-active-recordx.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-active-recordx.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-active-recordx.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
address@hidden V5.06 29 Sept 2008 (c) 2000-2010 John Lim (jlim#natsoft.com).
All rights reserved.
address@hidden V5.06 29 Sept 2008 (c) 2000-2012 John Lim (jlim#natsoft.com).
All rights reserved.
Latest version is available at http://adodb.sourceforge.net
Released under both BSD license and Lesser GPL library license.
@@ -715,7 +715,7 @@
case 'X':
if (is_null($val)) return 'null';
- if (strlen($val)>1 &&
+ if (strlen($val)>0 &&
(strncmp($val,"'",1) != 0 ||
substr($val,strlen($val)-1,1) != "'")) {
return $db->qstr($val);
break;
Modified: trunk/phpgwapi/inc/adodb/adodb-csvlib.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-csvlib.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-csvlib.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -8,7 +8,7 @@
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Modified: trunk/phpgwapi/inc/adodb/adodb-datadict.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-datadict.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-datadict.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -589,9 +589,9 @@
return $sql;
}
+
-
function _GenFields($flds,$widespacing=false)
{
if (is_string($flds)) {
Modified: trunk/phpgwapi/inc/adodb/adodb-error.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-error.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-error.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
@@ -41,6 +41,9 @@
define("DB_ERROR_EXTENSION_NOT_FOUND",-25);
define("DB_ERROR_NOSUCHDB", -25);
define("DB_ERROR_ACCESS_VIOLATION", -26);
+ define("DB_ERROR_DEADLOCK", -27);
+ define("DB_ERROR_STATEMENT_TIMEOUT", -28);
+ define("DB_ERROR_SERIALIZATION_FAILURE", -29);
}
function adodb_errormsg($value)
@@ -91,16 +94,19 @@
function adodb_error_pg($errormsg)
{
if (is_numeric($errormsg)) return (integer) $errormsg;
+ // Postgres has no lock-wait timeout. The best we could do would be to
set a statement timeout.
static $error_regexps = array(
'/(Table does not exist\.|Relation [\"\'].*[\"\'] does not
exist|sequence does not exist|class ".+" not found)$/i' => DB_ERROR_NOSUCHTABLE,
- '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate
key into (a )?unique index.*/i' => DB_ERROR_ALREADY_EXISTS,
- '/divide by zero$/i' => DB_ERROR_DIVZERO,
+ '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate
key into (a )?unique index.*|duplicate key.*violates unique constraint/i'
=> DB_ERROR_ALREADY_EXISTS,
+ '/database ".+" does not exist$/i' => DB_ERROR_NOSUCHDB,
+ '/(divide|division) by zero$/i' => DB_ERROR_DIVZERO,
'/pg_atoi: error in .*: can\'t parse /i' =>
DB_ERROR_INVALID_NUMBER,
'/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does
not have attribute [\"\'].*[\"\']/i' => DB_ERROR_NOSUCHFIELD,
- '/parser: parse error at or near \"/i' => DB_ERROR_SYNTAX,
+ '/(parser: parse|syntax) error at or near \"/i' =>
DB_ERROR_SYNTAX,
'/referential integrity violation/i' => DB_ERROR_CONSTRAINT,
- '/Relation [\"\'].*[\"\'] already exists|Cannot insert
a duplicate key into (a )?unique index.*|duplicate key.*violates unique
constraint/i'
- => DB_ERROR_ALREADY_EXISTS
+ '/deadlock detected$/i' => DB_ERROR_DEADLOCK,
+ '/canceling statement due to statement timeout$/i' =>
DB_ERROR_STATEMENT_TIMEOUT,
+ '/could not serialize access due to/i' =>
DB_ERROR_SERIALIZATION_FAILURE
);
reset($error_regexps);
while (list($regexp,$code) = each($error_regexps)) {
Modified: trunk/phpgwapi/inc/adodb/adodb-errorhandler.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-errorhandler.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-errorhandler.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-errorpear.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-errorpear.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-errorpear.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-exceptions.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-exceptions.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-exceptions.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- * @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-iterator.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-iterator.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-iterator.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-lib.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-lib.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb-lib.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -1,8 +1,4 @@
<?php
-
-
-
-
// security - hide paths
if (!defined('ADODB_DIR')) die();
@@ -10,7 +6,7 @@
$ADODB_INCLUDED_LIB = 1;
/*
- @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (address@hidden). All
rights reserved.
+ @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
@@ -459,8 +455,8 @@
$rstest =
$zthis->CacheExecute($secs2cache,$rewritesql,$inputarr);
if (!$rstest) $rstest =
$zthis->CacheExecute($secs2cache,$sql,$inputarr);
} else {
- $rstest = $zthis->Execute($rewritesql,$inputarr);
- if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
+ $rstest = $zthis->Execute($rewritesql,$inputarr);
+ if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
}
if ($rstest) {
$qryRecs = $rstest->RecordCount();
@@ -647,9 +643,17 @@
$type = 'C';
}
- if ((strpos($upperfname,' ') !== false)
|| ($ADODB_QUOTE_FIELDNAMES))
- $fnameq =
$zthis->nameQuote.$upperfname.$zthis->nameQuote;
- else
+ if ((strpos($upperfname,' ') !== false)
|| ($ADODB_QUOTE_FIELDNAMES)) {
+ switch (ADODB_QUOTE_FIELDNAMES)
{
+ case 'LOWER':
+ $fnameq =
$zthis->nameQuote.strtolower($field->name).$zthis->nameQuote;break;
+ case 'NATIVE':
+ $fnameq =
$zthis->nameQuote.$field->name.$zthis->nameQuote;break;
+ case 'UPPER':
+ default:
+ $fnameq =
$zthis->nameQuote.$upperfname.$zthis->nameQuote;break;
+ }
+ } else
$fnameq = $upperfname;
@@ -811,9 +815,17 @@
$upperfname = strtoupper($field->name);
if (adodb_key_exists($upperfname,$arrFields,$force)) {
$bad = false;
- if ((strpos($upperfname,' ') !== false) ||
($ADODB_QUOTE_FIELDNAMES))
- $fnameq =
$zthis->nameQuote.$upperfname.$zthis->nameQuote;
- else
+ if ((strpos($upperfname,' ') !== false) ||
($ADODB_QUOTE_FIELDNAMES)) {
+ switch (ADODB_QUOTE_FIELDNAMES) {
+ case 'LOWER':
+ $fnameq =
$zthis->nameQuote.strtolower($field->name).$zthis->nameQuote;break;
+ case 'NATIVE':
+ $fnameq =
$zthis->nameQuote.$field->name.$zthis->nameQuote;break;
+ case 'UPPER':
+ default:
+ $fnameq =
$zthis->nameQuote.$upperfname.$zthis->nameQuote;break;
+ }
+ } else
$fnameq = $upperfname;
$type = $recordSet->MetaType($field->type);
Modified: trunk/phpgwapi/inc/adodb/adodb-memcache.lib.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-memcache.lib.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-memcache.lib.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -11,7 +11,7 @@
/*
- V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
@@ -91,7 +91,7 @@
}
if (!$this->_memcache) return false;
- if (!$this->_memcache->set($filename, $contents,
$this->compress, $secs2cache)) {
+ if (!$this->_memcache->set($filename, $contents,
$this->compress ? MEMCACHE_COMPRESSED : 0, $secs2cache)) {
if ($debug) ADOConnection::outp(" Failed to
save data at the memcached server!<br>\n");
return false;
}
Modified: trunk/phpgwapi/inc/adodb/adodb-pager.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-pager.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/adodb-pager.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-pear.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-pear.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb-pear.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-perf.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-perf.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb-perf.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Modified: trunk/phpgwapi/inc/adodb/adodb-php4.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-php4.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb-php4.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -1,7 +1,7 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/adodb-time.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb-time.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb-time.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -73,7 +73,10 @@
FUNCTION DESCRIPTIONS
+** FUNCTION adodb_time()
+Returns the current time measured in the number of seconds since the Unix
Epoch (January 1 1970 00:00:00 GMT) as an unsigned integer.
+
** FUNCTION adodb_getdate($date=false)
Returns an array containing date information, as getdate(), but supports
@@ -241,7 +244,15 @@
CHANGELOG
+- 16 Jan 2011 0.36
+Added adodb_time() which returns current time. If > 2038, will return as float
+- 7 Feb 2011 0.35
+Changed adodb_date to be symmetric with adodb_mktime. See $jan1_71. fix for
bc.
+
+- 13 July 2010 0.34
+Changed adodb_get_gm_diff to use DateTimeZone().
+
- 11 Feb 2008 0.33
* Bug in 0.32 fix for hour handling. Fixed.
@@ -386,7 +397,7 @@
/*
Version Number
*/
-define('ADODB_DATE_VERSION',0.33);
+define('ADODB_DATE_VERSION',0.35);
$ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2);
@@ -601,6 +612,12 @@
else print "<p><b>Failed</b> :-(</p>";
}
+function adodb_time()
+{
+ $d = new DateTime();
+ return $d->format('U');
+}
+
/**
Returns day of week, 0 = Sunday,... 6=Saturday.
Algorithm from PEAR::Date_Calc
@@ -729,9 +746,17 @@
} else {
if (isset($TZ)) return $TZ;
$y = date('Y');
- $TZ = mktime(0,0,0,12,2,$y,0) - gmmktime(0,0,0,12,2,$y,0);
+ /*
+ if (function_exists('date_default_timezone_get') &&
function_exists('timezone_offset_get')) {
+ $tzonename = date_default_timezone_get();
+ if ($tzonename) {
+ $tobj = new DateTimeZone($tzonename);
+ $TZ = -timezone_offset_get($tobj,new
DateTime("now",$tzo));
+ }
+ }
+ */
+ if (empty($TZ)) $TZ = mktime(0,0,0,12,2,$y) -
gmmktime(0,0,0,12,2,$y);
}
-
return $TZ;
}
@@ -1040,11 +1065,19 @@
{
static $daylight;
global $ADODB_DATETIME_CLASS;
+static $jan1_1971;
+
+ if (!isset($daylight)) {
+ $daylight = function_exists('adodb_daylight_sv');
+ if (empty($jan1_1971)) $jan1_1971 = mktime(0,0,0,1,1,1971); //
we only use date() when > 1970 as adodb_mktime() only uses mktime() when > 1970
+ }
+
if ($d === false) return ($is_gmt)? @gmdate($fmt): @date($fmt);
if (!defined('ADODB_TEST_DATES')) {
if ((abs($d) <= 0x7FFFFFFF)) { // check if number in 32-bit
signed range
- if (!defined('ADODB_NO_NEGATIVE_TS') || $d >= 0) // if
windows, must be +ve integer
+
+ if (!defined('ADODB_NO_NEGATIVE_TS') || $d >=
$jan1_1971) // if windows, must be +ve integer
return ($is_gmt)? @gmdate($fmt,$d):
@date($fmt,$d);
}
@@ -1053,7 +1086,6 @@
$arr = _adodb_getdate($d,true,$is_gmt);
- if (!isset($daylight)) $daylight = function_exists('adodb_daylight_sv');
if ($daylight) adodb_daylight_sv($arr, $is_gmt);
$year = $arr['year'];
@@ -1426,4 +1458,4 @@
}
-?>
\ No newline at end of file
+?>
Modified: trunk/phpgwapi/inc/adodb/adodb.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/adodb.inc.php 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/adodb.inc.php 2013-09-27 13:29:42 UTC (rev
11338)
@@ -14,7 +14,7 @@
/**
\mainpage
- @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com).
All rights reserved.
+ @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com).
All rights reserved.
Released under both BSD license and Lesser GPL library license. You can
choose which license
you prefer.
@@ -177,7 +177,7 @@
/**
* ADODB version as a string.
*/
- $ADODB_vers = 'V5.11 5 May 2010 (c) 2000-2010 John Lim
(jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
+ $ADODB_vers = 'V5.18 3 Sep 2012 (c) 2000-2012 John Lim
(jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
/**
* Determines whether recordset->RecordCount() is used.
@@ -216,6 +216,36 @@
*/
}
+
+ function _adodb_safedate($s)
+ {
+ return str_replace(array("'", '\\'), '', $s);
+ }
+
+ // parse date string to prevent injection attack
+ // date string will have one quote at beginning e.g. '3434343'
+ function _adodb_safedateq($s)
+ {
+ $len = strlen($s);
+ if ($s[0] !== "'") $s2 = "'".$s[0];
+ else $s2 = "'";
+ for($i=1; $i<$len; $i++) {
+ $ch = $s[$i];
+ if ($ch === '\\') {
+ $s2 .= "'";
+ break;
+ } elseif ($ch === "'") {
+ $s2 .= $ch;
+ break;
+ }
+
+ $s2 .= $ch;
+ }
+
+ return strlen($s2) == 0 ? 'null' : $s2;
+ }
+
+
// for transaction handling
function ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2,
&$thisConnection)
@@ -285,10 +315,12 @@
// create temp directories
function createdir($hash, $debug)
{
+ global $ADODB_CACHE_PERMS;
+
$dir = $this->getdirname($hash);
if ($this->notSafeMode && !file_exists($dir)) {
$oldu = umask(0);
- if (address@hidden($dir,0771)) if(!is_dir($dir)
&& $debug) ADOConnection::outp("Cannot create $dir");
+ if (address@hidden($dir,
empty($ADODB_CACHE_PERMS) ? 0771 : $ADODB_CACHE_PERMS)) if(!is_dir($dir) &&
$debug) ADOConnection::outp("Cannot create $dir");
umask($oldu);
}
@@ -954,6 +986,7 @@
$element0 = reset($inputarr);
# is_object check because oci8 descriptors can be
passed in
$array_2d = $this->bulkBind && is_array($element0) &&
!is_object(reset($element0));
+
//remove extra memory copy of input -mikefedyk
unset($element0);
@@ -961,6 +994,7 @@
$sqlarr = explode('?',$sql);
$nparams = sizeof($sqlarr)-1;
if (!$array_2d) $inputarr = array($inputarr);
+
foreach($inputarr as $arr) {
$sql = ''; $i = 0;
//Use each() instead of foreach to
reduce memory usage -mikefedyk
@@ -1002,7 +1036,7 @@
$stmt = $this->Prepare($sql);
else
$stmt = $sql;
-
+
foreach($inputarr as $arr) {
$ret =
$this->_Execute($stmt,$arr);
if (!$ret) return $ret;
@@ -1594,7 +1628,8 @@
}
/**
- * Return one row of sql statement. Recordset is disposed for you.
+ * Return one row of sql statement. Recordset is disposed for you.
+ * Note that SelectLimit should not be called.
*
* @param sql SQL statement
* @param [inputarr] input bind array
@@ -1799,7 +1834,7 @@
if (get_magic_quotes_runtime() &&
!$this->memCache) {
ADOConnection::outp("Please disable
magic_quotes_runtime - it corrupts cache files :(");
}
- if ($this->debug !== -1) ADOConnection::outp( "
$md5file cache failure: $err (see sql below)");
+ if ($this->debug !== -1) ADOConnection::outp( "
$md5file cache failure: $err (this is a notice and not an error)");
}
$rs = $this->Execute($sqlparam,$inputarr);
@@ -2247,6 +2282,29 @@
return false;
}
+ /**
+ * List procedures or functions in an array.
+ * @param procedureNamePattern a procedure name pattern; must match the
procedure name as it is stored in the database
+ * @param catalog a catalog name; must match the catalog name as it is
stored in the database;
+ * @param schemaPattern a schema name pattern;
+ *
+ * @return array of procedures on current database.
+
+ Array (
+ [name_of_procedure] => Array
+ (
+ [type] => PROCEDURE or FUNCTION
+ [catalog] => Catalog_name
+ [schema] => Schema_name
+ [remarks] => explanatory comment on the procedure
+ )
+ )
+ */
+ function MetaProcedures($procedureNamePattern = null, $catalog = null,
$schemaPattern = null)
+ {
+ return false;
+ }
+
/**
* @param ttype can either be 'VIEW' or 'TABLE' or false.
@@ -2446,7 +2504,11 @@
if (is_string($d) && !is_numeric($d)) {
- if ($d === 'null' || strncmp($d,"'",1) === 0) return $d;
+ if ($d === 'null') return $d;
+ if (strncmp($d,"'",1) === 0) {
+ $d = _adodb_safedateq($d);
+ return $d;
+ }
if ($this->isoDates) return "'$d'";
$d = ADOConnection::UnixDate($d);
}
@@ -2489,8 +2551,10 @@
return adodb_date($this->fmtTimeStamp,$ts);
if ($ts === 'null') return $ts;
- if ($this->isoDates && strlen($ts) !== 14) return "'$ts'";
-
+ if ($this->isoDates && strlen($ts) !== 14) {
+ $ts = _adodb_safedate($ts);
+ return "'$ts'";
+ }
$ts = ADOConnection::UnixTimeStamp($ts);
return adodb_date($this->fmtTimeStamp,$ts);
}
@@ -2786,6 +2850,7 @@
function FieldCount(){ return 0;}
function Init() {}
function getIterator() {return new ADODB_Iterator_empty($this);}
+ function GetAssoc() {return array();}
}
//==============================================================================================
@@ -3096,7 +3161,7 @@
$false = false;
return $false;
}
- $numIndex = isset($this->fields[0]);
+ $numIndex = isset($this->fields[0]) && isset($this->fields[1]);
$results = array();
if (!$first2cols && ($cols > 2 || $force_array)) {
@@ -3437,23 +3502,23 @@
*
* $upper 0 = lowercase, 1 = uppercase, 2 = whatever is returned by
FetchField
*/
- function GetRowAssoc($upper=1)
+ function GetRowAssoc($upper=1)
{
$record = array();
- // if (!$this->fields) return $record;
-
- if (!$this->bind) {
+ if (!$this->bind) {
$this->GetAssocKeys($upper);
}
-
foreach($this->bind as $k => $v) {
- $record[$k] = $this->fields[$v];
+ if( isset( $this->fields[$v] ) ) {
+ $record[$k] = $this->fields[$v];
+ } else if (isset($this->fields[$k])) {
+ $record[$k] = $this->fields[$k];
+ } else
+ $record[$k] = $this->fields[$v];
}
-
return $record;
}
-
/**
* Clean up recordset
*
@@ -4153,7 +4218,7 @@
$fakedsn =
str_replace('@/','@adodb-fakehost/',$fakedsn);
}
- if ((strpos($origdsn, 'sqlite')) !== FALSE) {
+ if ((strpos($origdsn, 'sqlite')) !== FALSE &&
stripos($origdsn, '%2F') === FALSE) {
// special handling for SQLite, it only might have the path to
the database file.
// If you try to connect to a SQLite database using a dsn like
'sqlite:///path/to/database', the 'parse_url' php function
// will throw you an exception with a message such as "unable to
parse url"
@@ -4170,7 +4235,7 @@
if (!$dsna) {
return $false;
}
- $dsna['scheme'] = substr($origdsn,0,$at);
+ $dsna['scheme'] = substr($origdsn,0,$at);
if ($at2 !== FALSE) {
$dsna['host'] = '';
}
@@ -4413,4 +4478,4 @@
}
-?>
\ No newline at end of file
+?>
Added: trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb.gif
===================================================================
(Binary files differ)
Property changes on: trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb2.gif
===================================================================
(Binary files differ)
Property changes on: trunk/phpgwapi/inc/adodb/cute_icons_for_site/adodb2.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-access.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-access.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-access.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-db2.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-db2.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-db2.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-firebird.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-firebird.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-firebird.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-generic.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-generic.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-generic.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-ibase.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-ibase.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-ibase.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-informix.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-informix.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-informix.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-mssql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-mssql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-mssql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-mssqlnative.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-mssqlnative.inc.php
2013-09-27 13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-mssqlnative.inc.php
2013-09-27 13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-mysql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-oci8.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-oci8.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-oci8.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -219,7 +219,7 @@
$seqStart = '';
if (isset($tableoptions['SEQUENCE_START'])){$seqIncr = ' START
WITH '.$tableoptions['SEQUENCE_START'];}
$sql[] = "CREATE SEQUENCE $seqname $seqStart $seqIncr
$seqCache";
- $sql[] = "CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON
$tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField
= 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END;";
+ $sql[] = "CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON
$tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField
= 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END";
$this->seqField = false;
return $sql;
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-postgres.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-postgres.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-postgres.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -30,8 +30,8 @@
$t = $fieldobj->type;
$len = $fieldobj->max_length;
}
- $is_serial = is_object($fieldobj) && $fieldobj->primary_key &&
$fieldobj->unique &&
- $fieldobj->has_default &&
substr($fieldobj->default_value,0,8) == 'nextval(';
+ $is_serial = is_object($fieldobj) &&
!empty($fieldobj->primary_key) && !empty($fieldobj->unique) &&
+ !empty($fieldobj->has_default) &&
substr($fieldobj->default_value,0,8) == 'nextval(';
switch (strtoupper($t)) {
case 'INTERVAL':
@@ -130,13 +130,14 @@
{
$tabname = $this->TableName ($tabname);
$sql = array();
+ $not_null = false;
list($lines,$pkey) = $this->_GenFields($flds);
$alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' ';
foreach($lines as $v) {
if (($not_null = preg_match('/NOT NULL/i',$v))) {
$v = preg_replace('/NOT NULL/i','',$v);
}
- if (preg_match('/^([^ ]+) .*DEFAULT ([^
]+)/',$v,$matches)) {
+ if (preg_match('/^([^ ]+) .*DEFAULT
(\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
list(,$colname,$default) = $matches;
$sql[] = $alter . str_replace('DEFAULT
'.$default,'',$v);
$sql[] = 'UPDATE '.$tabname.' SET
'.$colname.'='.$default;
@@ -188,23 +189,46 @@
$tabname = $this->TableName($tabname);
$sql = array();
list($lines,$pkey) = $this->_GenFields($flds);
+ $set_null = false;
$alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
foreach($lines as $v) {
- if ($not_null = preg_match('/NOT NULL/i',$v)) {
+ if ($not_null = preg_match('/NOT NULL/i',$v)) {
$v = preg_replace('/NOT NULL/i','',$v);
- }
+ }
// this next block doesn't work - there is no way that I can
see to
// explicitly ask a column to be null using $flds
- else if ($set_null = preg_match('/NULL/i',$v)) {
+ else if ($set_null = preg_match('/NULL/i',$v)) {
// if they didn't specify not null, see if they explicitely
asked for null
$v = preg_replace('/\sNULL/i','',$v);
- }
+ }
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) {
- list(,$colname,$default) = $matches;
- $v = preg_replace('/^' . preg_quote($colname) . '\s/', '',
$v);
- $sql[] = $alter . $colname . ' TYPE ' .
str_replace('DEFAULT '.$default,'',$v);
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN
'.$colname.' SET DEFAULT ' . $default;
+ if (preg_match('/^([^ ]+) .*DEFAULT
(\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
+ $existing = $this->MetaColumns($tabname);
+ list(,$colname,$default) = $matches;
+ if ($this->connection) $old_coltype =
$this->connection->MetaType($existing[strtoupper($colname)]);
+ else $old_coltype = $t;
+ $v = preg_replace('/^' . preg_quote($colname) .
'\s/', '', $v);
+ $t = trim(str_replace('DEFAULT
'.$default,'',$v));
+
+ // Type change from bool to int
+ if ( $old_coltype == 'L' && $t == 'INTEGER' ) {
+ $sql[] = $alter . $colname . ' DROP
DEFAULT';
+ $sql[] = $alter . $colname . " TYPE $t
USING ($colname::BOOL)::INT";
+ $sql[] = $alter . $colname . " SET
DEFAULT $default";
+ }
+ // Type change from int to bool
+ else if ( $old_coltype == 'I' && $t ==
'BOOLEAN' ) {
+ $sql[] = $alter . $colname . ' DROP
DEFAULT';
+ $sql[] = $alter . $colname . " TYPE $t
USING CASE WHEN $colname = 0 THEN false ELSE true END";
+ $sql[] = $alter . $colname . " SET
DEFAULT " . $this->connection->qstr($default);
+ }
+ // Any other column types conversion
+ else {
+ $sql[] = $alter . $colname . " TYPE $t";
+ $sql[] = $alter . $colname . " SET
DEFAULT $default";
+ }
+
+
}
else {
// drop default?
@@ -213,14 +237,14 @@
$sql[] = $alter . $colname . ' TYPE ' . $rest;
}
- list($colname) = explode(' ',$v);
+# list($colname) = explode(' ',$v);
if ($not_null) {
// this does not error out if the column is already not null
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN
'.$colname.' SET NOT NULL';
+ $sql[] = $alter . $colname . ' SET NOT NULL';
}
if ($set_null) {
// this does not error out if the column is already null
- $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN
'.$colname.' DROP NOT NULL';
+ $sql[] = $alter . $colname . ' DROP NOT NULL';
}
}
return $sql;
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-sapdb.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V4.50 6 July 2004 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V4.50 6 July 2004 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-sqlite.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-sqlite.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-sqlite.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/datadict/datadict-sybase.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/datadict/datadict-sybase.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/datadict/datadict-sybase.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/**
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/docs/docs-active-record.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-active-record.htm 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-active-record.htm 2013-09-27
13:29:42 UTC (rev 11338)
@@ -637,7 +637,7 @@
$acc = new Account();
$acc->Load('id=23');
- $start = 0;
+ $start = 0;
while(true) {
$acc->LoadRelations('transactions',"tx_done=0 order by
trxdate", $start, $start+100);
if (!$acc->transactions) break;
Modified: trunk/phpgwapi/inc/adodb/docs/docs-adodb.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-adodb.htm 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-adodb.htm 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -620,7 +620,7 @@
<h2>ADOdb Library for PHP</h2>
-<p>V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com)</p>
+<p>V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com)</p>
<p><span style='font-size:7.5pt'>This software is dual licensed using BSD-Style
and LGPL. This means you can use it in compiled proprietary and commercial
@@ -727,7 +727,7 @@
Data Dictionary (metadata): <a href="#metadatabases">MetaDatabases</a> <a
href="#metatables">MetaTables</a> <a href="#metacolumns">MetaColumns</a> <a
href="#metacolumnames">MetaColumnNames</a> <a
href="#metaprimarykeys">MetaPrimaryKeys</a>
-<a href="#metaforeignkeys">MetaForeignKeys</a> <a
href="#serverinfo">ServerInfo</a>
+<a href="#metaforeignkeys">MetaForeignKeys</a> <a
href="#serverinfo">ServerInfo</a> <a href="#setcharset">SetCharSet</a>
<br>
Statistics and Query-Rewriting: <a href="#logsql">LogSQL</a> <a
href="#fnexecute">fnExecute and fnCacheExecute</a><br>
@@ -2023,7 +2023,7 @@
<p class=MsoNormal><span style='font-size:10.0pt'>C</span></p>
</td>
<td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
- <p><span style='font-size:10.0pt'>Native mssql driver from M'soft.
</span></p>
+ <p><span style='font-size:10.0pt'>Native mssql driver from M'soft. Use with
PHP 5.3 or later. </span></p>
</td>
<td valign=top style='padding:.75pt .75pt .75pt .75pt;height:54.75pt'>
<p class=MsoNormal><span style='font-size:10.0pt'>?</span></p>
@@ -2432,6 +2432,27 @@
<p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows.
</span></p>
</td>
</tr>
+ <tr style='mso-yfti-irow:35'>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><b><span style='font-size:10.0pt'>postgres9</span></b></p>
+ </td>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><span style='font-size:10.0pt'>A</span></p>
+ </td>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL which supports
+ version 9 functionality.</span></p>
+ </td>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><span style='font-size:10.0pt'>Y</span></p>
+ </td>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><span style='font-size:10.0pt'>PostgreSQL
client</span></p>
+ </td>
+ <td valign=top style='padding:.75pt .75pt .75pt .75pt'>
+ <p class=MsoNormal><span style='font-size:10.0pt'>Unix and Windows.
</span></p>
+ </td>
+ </tr>
<tr style='mso-yfti-irow:36'>
<td valign=top style='padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><b><span style='font-size:10.0pt'>sapdb</span></b></p>
@@ -3869,7 +3890,12 @@
<h3><a name="adodb_auto_quote"></a>$ADODB_QUOTE_FIELDNAMES</h3>
<p>Auto-quotes field names when using AutoExecute() when set to true. </p>
-
+<p>Since 5.13, if $ADODB_QUOTE_FIELDNAMES is set to:
+<ul>
+<li>'UPPER' or true: uppercase field names. This is the default.
+<li>'NATIVE' : use native case.
+<li>'LOWER': lowercase field names.
+</ul>
<p> </p>
<div class=MsoNormal align=center style='text-align:center'>
@@ -3903,7 +3929,7 @@
<p><b>raiseErrorFn</b>: Allows you to define an error handling function. See
adodb-errorhandler.inc.php for an example.</p>
-<p><b>debug</b>: Set to <i>true</i> to make debug statements to appear.</p>
+<p><b>debug</b>: Set to <i>true</i> to make debug statements. Set to -99 to
only display errors. Set to 99 to display debug statements and add a
backtrace.</p>
<p><b>concat_operator</b>: Set to '+' or '||' normally. The operator used to
concatenate strings in SQL. Used by the <b><a href="#concat">Concat</a></b>
@@ -5482,6 +5508,14 @@
'description' element contains the string description of the database. The
'version' naturally holds the version number (which is also a string).</p>
+<p><b>SetCharSet<a name=setcharset id=setcharset></a>($charset)</b> </p>
+
+<p>Set the charset of the connection. The parameter passed in is dependent on
the actual database RDBMS. e.g.
+<pre>
+ $DB->SetCharSet('utf8'); // for mysql
+</pre>
+This is database driver specific and only supported for mysql, mysqlt, mysqli,
and also postgres7 and later.</p>
+
<p><b>MetaForeignKeys<a name=metaforeignkeys></a>($table, $owner=false,
$upper=false)</b> </p>
@@ -6135,6 +6169,65 @@
PHP</a>. </p>
<h2>Change Log<a name=changes></a><a name=changelog></a></h2>
+<p><a name=5.18><b>5.18 3 Sep 2012</b>
+<p>datadict-postgres: Fixes bug in ALTER COL. See
http://phplens.com/lens/lensforum/msgs.php?id=19202. Also fixed bugs in
MetaType() checking $fieldobj properties.
+<p>GetRowAssoc did not work with null values. Bug in 5.17.
+<p>postgres9: New driver to better support PostgreSQL 9. Thx Glenn Herteg and
Cacti team.
+<p>sqlite3: Modified to support php 5.4. Thx G\xFCnter Weber
[built.development#googlemail.com]
+<p>adodb: When fetch mode is ADODB_FETCH_ASSOC, and we execute
$db->GetAssoc("select 'a','0'"); we get an error. Fixed. See
http://phplens.com/lens/lensforum/msgs.php?id=19190
+<p>adodb: Caching directory permissions now configurable using global variable
+$ADODB_CACHE_PERMS. Default value is 0771.
+<p>mysqli: SetCharSet() did not return true (success) or false (fail)
correctly. Fixed.
+<p>mysqli: changed dataProvider to 'mysql' so that MetaError and other shared
functions will work.
+<p>mssqlnative: Prepare() did not work previously. Now calling Prepare() will
work but the sql is not actually compiled. Unfortunately bind params are passed
to sqlsrv_prepare and not to sqlsrv_execute.
+make Prepare() and empty function, and we still execute the unprepared stmt.
+<p>mysql: FetchField(-1), turns it is is not possible to retrieve the
max_length. Set to -1.
+<p>mysql-perf: Fixed "SHOW INNODB STATUS". Change to "SHOW ENGINE INNODB
STATUS"
+<p><a name=5.17><b>5.17 18 May 2012</b>
+<p>Active Record: Removed trailing whitespace from adodb-active-record.inc.php.
+<p>odbc: Added support for $database parameter in odbc Connect() function.
E.g. $DB->Connect($dsn_without_db, $user, $pwd, $database).
+Previously $database had to be left blank and the $dsn was used to pass in
this parameter.
+<p>oci8: Added better empty($rs) error handling to metaindexes().
+<p>oci8: Changed to use newer oci API to support PHP 5.4.
+<p>adodb.inc.php: Changed GetRowAssoc to more generic code that will work in
all scenarios.
+<p><a name=5.16><b>5.16 26 March 2012</b>
+<p>mysqli: extra mysqli_next_result() in close() removed. See
http://phplens.com/lens/lensforum/msgs.php?id=19100
+<p>datadict-oci8: minor typo in create sequence trigger fixed. See
http://phplens.com/lens/lensforum/msgs.php?id=18879.
+<p>security: safe date parsing changes. Does not impact security, these are
code optimisations. Thx Saithis.
+<p>postgres, oci8, oci8po, db2oci: Param() function parameters inconsistent
with base class. $type='C' missing. Fixed.
+<p>active-record: locked bug fixed.
http://phplens.com/lens/lensforum/msgs.php?phplens_forummsg=new&id=19073
+<p>mysql, mysqli and informix: added MetaProcedures. Metaprocedures allows to
retrieve an array list of all procedures in database.
http://phplens.com/lens/lensforum/msgs.php?id=18414
+<p>Postgres7: added support for serial data type in MetaColumns().
+<p><a name=5.15><b>5.15 19 Jan 2012</b>
+<p>pdo: fix ErrorMsg() to detect errors correctly. Thx Jens.
+<p>mssqlnative: added another check for $this->fields array exists.
+<p>mssqlnative: bugs in FetchField() fixed. See
http://phplens.com/lens/lensforum/msgs.php?id=19024
+<p>DBDate and DBTimeStamp had sql injection bug. Fixed. Thx Saithis
+<p>mysql and mysqli: MetaTables() now identifies views and tables correctly.
+<p>Added function adodb_time() to adodb-time.inc.php. Generates current time
in unsigned integer format.
+<p><a name=5.14><b>5.14 8 Sep 2011</b>
+<p>mysqli: fix php compilation bug.
+<p>postgres: bind variables did not work properly. Fixed.
+<p>postgres: blob handling bug in _decode. Fixed.
+<p>ActiveRecord: if a null field was never updated, activerecord would still
update the record. Fixed.
+<p>ActiveRecord: 1 char length string never quoted. Fixed.
+<p>LDAP: Connection string ldap:// and ldaps:// did not work. Fixed.
+<p><a name=5.13></a><b>5.13 15 Aug 2011</b>
+<p>Postgres: Fix in 5.12 was wrong. Uses pg_unescape_bytea() correctly now in
_decode.
+<p>GetInsertSQL/GetUpdateSQL: Now $ADODB_QUOTE_FIELDNAMES allows you to define
'NATIVE', 'UPPER', 'LOWER'. If set to true, will default to 'UPPER'.
+<p>mysqli: added support for persistent connections 'p:'.
+<p>mssqlnative: ADODB_FETCH_BOTH did not work properly. Fixed.
+<p>mssqlnative: return values for stored procedures where not returned! Fixed.
See http://phplens.com/lens/lensforum/msgs.php?id=18919
+<p>mssqlnative: timestamp and fetchfield bugs fixed. http
://phplens.com/lens/lensforum/msgs.php?id=18453
+<p><a name=5.12></a><b>5.12 30 June 2011</b> </p>
+<p>Postgres: Added information_schema support for postgresql.
+<p>Postgres: Use pg_unescape_bytea() in _decode.
+<p>Fix bulk binding with oci8.
http://phplens.com/lens/lensforum/msgs.php?id=18786
+<p>oci8 perf: added wait evt monitoring. Also db cache advice now handles
multiple buffer pools properly.
+<p>sessions2: Fixed setFetchMode problem.
+<p>sqlite: Some DSN connection settings were not parsed correctly.
+<p>mysqli: now GetOne obeys $ADODB_GETONE_EOF;
+<p>memcache: compress option did not work. Fixed. See
http://phplens.com/lens/lensforum/msgs.php?id=18899
<p><a name=5.11></a><b>5.11 5 May 2010</b> </p>
<p>mysql: Fixed GetOne() to return null if no records returned.
<p>oci8 perf: added stats on sga, rman, memory usage, and flash in performance
tab.
Modified: trunk/phpgwapi/inc/adodb/docs/docs-datadict.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-datadict.htm 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-datadict.htm 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -20,7 +20,7 @@
</head>
<body style="background-color: rgb(255, 255, 255);">
<h2>ADOdb Data Dictionary Library for PHP</h2>
-<p>V5.06 16 Oct 2008 (c) 2000-2010 John Lim (<a
+<p>V5.18 3 Sep 2012 (c) 2000-2010 John Lim (<a
href="mailto:jlim#natsoft.com">jlim#natsoft.com</a>).<br>
AXMLS (c) 2004 ars Cognita, Inc</p>
<p><font size="1">This software is dual licensed using BSD-Style and
Modified: trunk/phpgwapi/inc/adodb/docs/docs-perf.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-perf.htm 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-perf.htm 2013-09-27 13:29:42 UTC (rev
11338)
@@ -18,7 +18,7 @@
</head>
<body>
<h3>The ADOdb Performance Monitoring Library</h3>
-<p>V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com)</p>
+<p>V5.18 3 Sep 2012 (c) 2000-2010 John Lim (jlim#natsoft.com)</p>
<p><font size="1">This software is dual licensed using BSD-Style and
LGPL. This means you can use it in compiled proprietary and commercial
products.</font></p>
Modified: trunk/phpgwapi/inc/adodb/docs/docs-session.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-session.htm 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-session.htm 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -21,7 +21,7 @@
<body style="background-color: rgb(255, 255, 255);">
<h1>ADODB Session 2 Management Manual</h1>
<p>
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com)
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com)
</p>
<p> <font size="1">This software is dual licensed using BSD-Style and
LGPL. This means you can use it in compiled proprietary and commercial
@@ -44,7 +44,8 @@
<p>To use session variables, call session_start() at the beginning of
your web page, before your HTTP headers are sent. Then for every
variable you want to keep alive for the duration of the session, call
-session_register($variable_name). By default, the session handler will
+variable you want to keep alive for the duration of the session, use
$_SESSION['variablename'].
+ By default, the session handler will
keep track of the session by using a cookie. You can save objects or
arrays in session variables also.
</p>
Modified: trunk/phpgwapi/inc/adodb/docs/docs-session.old.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/docs-session.old.htm 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/docs/docs-session.old.htm 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -21,7 +21,7 @@
<body style="background-color: rgb(255, 255, 255);">
<h3>ADODB Session Management Manual</h3>
<p>
-V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com)
+V5.18 3 Sep 2012 (c) 2000-2010 John Lim (jlim#natsoft.com)
</p>
<p> <font size="1">This software is dual licensed using BSD-Style and
LGPL. This means you can use it in compiled proprietary and commercial
Modified: trunk/phpgwapi/inc/adodb/docs/readme.htm
===================================================================
--- trunk/phpgwapi/inc/adodb/docs/readme.htm 2013-09-27 13:24:08 UTC (rev
11337)
+++ trunk/phpgwapi/inc/adodb/docs/readme.htm 2013-09-27 13:29:42 UTC (rev
11338)
@@ -23,7 +23,7 @@
</ul>
<p>
<h3>Installation</h3>
-Make sure you are running PHP4.0.4 or later. Unpack all the files into a
directory accessible by your webserver.
+Make sure you are running PHP5 or later. For PHP 4 or earlier, you need to use
adodb 4.9. Unpack all the files into a directory accessible by your webserver.
<p>
To test, try modifying some of the tutorial examples. Make sure you customize
the connection settings correctly. You can debug using:
<pre>
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-access.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-access.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-access.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ado.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ado.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ado.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ado5.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ado5.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ado5.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ado_access.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ado_access.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ado_access.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ado_mssql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ado_mssql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ado_mssql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
2013-09-27 13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
2013-09-27 13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-db2.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-db2.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-db2.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 (jlim#natsoft.com). All rights reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 (jlim#natsoft.com). All rights reserved.
This is a version of the ADODB driver for DB2. It uses the 'ibm_db2' PECL
extension
for PHP (http://pecl.php.net/package/ibm_db2), which in turn requires DB2
V8.2.2 or
@@ -212,7 +212,7 @@
{
$row = $this->GetRow("SELECT service_level, fixpack_num FROM
TABLE(sysproc.env_get_inst_info())
as INSTANCEINFO");
-
+
if ($row) {
$info['version'] = $row[0].':'.$row[1];
@@ -224,7 +224,7 @@
return $info;
}
-
+
function CreateSequence($seqname='adodbseq',$start=1)
{
if (empty($this->_genSeqSQL)) return false;
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-db2oci.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-db2oci.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-db2oci.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -163,7 +163,7 @@
parent::ADODB_db2();
}
- function Param($name,$type=false)
+ function Param($name,$type='C')
{
return ':'.$name;
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-db2ora.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-db2ora.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-db2ora.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-fbsql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-fbsql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-fbsql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-firebird.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-firebird.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-firebird.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
-* @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+* @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-informix72.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim. All rights reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 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.
@@ -146,6 +146,51 @@
return 0;
}
+
+ function MetaProcedures($NamePattern = false, $catalog = null,
$schemaPattern = null)
+ {
+ // save old fetch mode
+ global $ADODB_FETCH_MODE;
+
+ $false = false;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+ if ($this->fetchMode !== FALSE) {
+ $savem = $this->SetFetchMode(FALSE);
+
+ }
+ $procedures = array ();
+
+ // get index details
+
+ $likepattern = '';
+ if ($NamePattern) {
+ $likepattern = " WHERE procname LIKE '".$NamePattern."'";
+ }
+
+ $rs = $this->Execute('SELECT procname, isproc FROM
sysprocedures'.$likepattern);
+
+ if (is_object($rs)) {
+ // parse index data into array
+
+ while ($row = $rs->FetchRow()) {
+ $procedures[$row[0]] = array(
+ 'type' => ($row[1] == 'f' ? 'FUNCTION' : 'PROCEDURE'),
+ 'catalog' => '',
+ 'schema' => '',
+ 'remarks' => ''
+ );
+ }
+ }
+
+ // restore fetchmode
+ if (isset($savem)) {
+ $this->SetFetchMode($savem);
+ }
+ $ADODB_FETCH_MODE = $save;
+
+ return $procedures;
+ }
function MetaColumns($table, $normalize=true)
{
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -55,7 +55,7 @@
if ( !function_exists( 'ldap_connect' ) ) return null;
- if (strpos('ldap://',$host) === 0 || strpos('ldaps://',$host)
=== 0) {
+ if (strpos($host,'ldap://') === 0 || strpos($host,'ldaps://')
=== 0) {
$this->_connectionID = @ldap_connect($host);
} else {
$conn_info = array( $host,$this->port);
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mssql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mssql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mssql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -84,9 +84,9 @@
var $metaDatabasesSQL = "select name from sysdatabases where name <>
'master'";
var $metaTablesSQL="select name,case when type='U' then 'T' else 'V'
end from sysobjects where (type='U' or type='V') and (name not in
('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE','dtproperties'))";
var $metaColumnsSQL = # xtype==61 is datetime
-"select c.name,t.name,c.length,
- (case when c.xusertype=61 then 0 else c.xprec end),
- (case when c.xusertype=61 then 0 else c.xscale end)
+ "select c.name,t.name,c.length,c.isnullable, c.status,
+ (case when c.xusertype=61 then 0 else c.xprec end),
+ (case when c.xusertype=61 then 0 else c.xscale end)
from syscolumns c join systypes t on t.xusertype=c.xusertype join
sysobjects o on o.id=c.id where o.name='%s'";
var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM
TABLE
var $hasGenID = true;
@@ -374,6 +374,64 @@
}
+ function MetaColumns($table, $normalize=true)
+ {
+// $arr = ADOConnection::MetaColumns($table);
+// return $arr;
+
+ $this->_findschema($table,$schema);
+ if ($schema) {
+ $dbName = $this->database;
+ $this->SelectDB($schema);
+ }
+ global $ADODB_FETCH_MODE;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+
+ if ($this->fetchMode !== false) $savem =
$this->SetFetchMode(false);
+ $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
+
+ if ($schema) {
+ $this->SelectDB($dbName);
+ }
+
+ if (isset($savem)) $this->SetFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+ if (!is_object($rs)) {
+ $false = false;
+ return $false;
+ }
+
+ $retarr = array();
+ while (!$rs->EOF){
+ $fld = new ADOFieldObject();
+ $fld->name = $rs->fields[0];
+ $fld->type = $rs->fields[1];
+
+ $fld->not_null = (!$rs->fields[3]);
+ $fld->auto_increment = ($rs->fields[4] == 128);
// sys.syscolumns status field. 0x80 = 128 ref:
http://msdn.microsoft.com/en-us/library/ms186816.aspx
+
+ if (isset($rs->fields[5]) && $rs->fields[5]) {
+ if ($rs->fields[5]>0) $fld->max_length =
$rs->fields[5];
+ $fld->scale = $rs->fields[6];
+ if ($fld->scale>0) $fld->max_length += 1;
+ } else
+ $fld->max_length = $rs->fields[2];
+
+ if ($save == ADODB_FETCH_NUM) {
+ $retarr[] = $fld;
+ } else {
+ $retarr[strtoupper($fld->name)] = $fld;
+ }
+ $rs->MoveNext();
+ }
+
+ $rs->Close();
+ return $retarr;
+
+ }
+
+
function MetaIndexes($table,$primary=false, $owner=false)
{
$table = $this->qstr($table);
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mssql_n.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mssql_n.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mssql_n.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -9,7 +9,7 @@
// ADOdb - Database Abstraction Library for PHP //
// http://adodb.sourceforge.net/ //
// //
-// Copyright (c) 2000-2010 John Lim (address@hidden) //
+// Copyright (c) 2000-2012 John Lim (address@hidden) //
// All rights reserved. //
// Released under both BSD license and LGPL library license. //
// Whenever there is any discrepancy between the two licenses, //
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlnative.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlnative.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlnative.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -130,6 +130,7 @@
var $uniqueOrderBy = true;
var $_bindInputArray = true;
var $_dropSeqSQL = "drop table %s";
+ var $connectionInfo = array();
function ADODB_mssqlnative()
{
@@ -156,6 +157,7 @@
} else
$savem = $this->SetFetchMode(ADODB_FETCH_NUM);
$arrServerInfo = sqlsrv_server_info($this->_connectionID);
+ $ADODB_FETCH_MODE = $savem;
$arr['description'] = $arrServerInfo['SQLServerName'].'
connected to '.$arrServerInfo['CurrentDatabase'];
$arr['version'] =
$arrServerInfo['SQLServerVersion'];//ADOConnection::_findvers($arr['description']);
return $arr;
@@ -377,7 +379,10 @@
function _connect($argHostname, $argUsername, $argPassword,
$argDatabasename)
{
if (!function_exists('sqlsrv_connect')) return null;
- $connectionInfo =
array("Database"=>$argDatabasename,'UID'=>$argUsername,'PWD'=>$argPassword);
+ $connectionInfo = $this->connectionInfo;
+ $connectionInfo["Database"]=$argDatabasename;
+ $connectionInfo["UID"]=$argUsername;
+ $connectionInfo["PWD"]=$argPassword;
if ($this->debug) error_log("<hr>connecting... hostname: $argHostname
params: ".var_export($connectionInfo,true));
//if ($this->debug) error_log("<hr>_connectionID before:
".serialize($this->_connectionID));
if(!($this->_connectionID =
sqlsrv_connect($argHostname,$connectionInfo))) {
@@ -398,6 +403,8 @@
function Prepare($sql)
{
+ return $sql; // prepare does not work properly with bind
parameters as bind parameters are managed by sqlsrv_prepare!
+
$stmt = sqlsrv_prepare( $this->_connectionID, $sql);
if (!$stmt) return $sql;
return array($sql,$stmt);
@@ -457,19 +464,12 @@
if (is_array($inputarr)) {
$rez = sqlsrv_query($this->_connectionID,$sql,$inputarr);
} else if (is_array($sql)) {
- $rez = sqlsrv_query($this->_connectionID,$sql[1],$inputarr);
+ // $inputarr is prepared in sqlsrv_prepare();
+ $rez = sqlsrv_execute($this->_connectionID,$sql[1]);
} else {
$rez = sqlsrv_query($this->_connectionID,$sql);
}
- if ($this->debug) error_log("<hr>running query:
".var_export($sql,true)."<hr>input array:
".var_export($inputarr,true)."<hr>result:
".var_export($rez,true));//"<hr>connection: ".serialize($this->_connectionID)
- //fix for returning true on anything besides select statements
- if (is_array($sql)) $sql = $sql[1];
- $sql = ltrim($sql);
- if(stripos($sql, 'SELECT') !== 0 && $rez !== false) {
- if ($this->debug) error_log(" isn't a select query, returning
boolean true");
- return true;
- }
- //end fix
+ if ($this->debug) error_log("<hr>running query:
".var_export($sql,true)."<hr>input array:
".var_export($inputarr,true)."<hr>result: ".var_export($rez,true));
if(!$rez) $rez = false;
return $rez;
}
@@ -486,12 +486,12 @@
// mssql uses a default date like Dec 30 2000 12:00AM
static function UnixDate($v)
{
- return ADORecordSet_array_mssql::UnixDate($v);
+ return ADORecordSet_array_mssqlnative::UnixDate($v);
}
static function UnixTimeStamp($v)
{
- return ADORecordSet_array_mssql::UnixTimeStamp($v);
+ return ADORecordSet_array_mssqlnative::UnixTimeStamp($v);
}
function &MetaIndexes($table,$primary=false, $owner = false)
@@ -592,7 +592,7 @@
// "Stein-Aksel Basma" <address@hidden>
// tested with MSSQL 2000
- function &MetaPrimaryKeys($table)
+ function MetaPrimaryKeys($table, $owner=false)
{
global $ADODB_FETCH_MODE;
@@ -702,21 +702,28 @@
fields in a certain query result. If the field offset isn't
specified, the next field that wasn't yet retrieved by
fetchField() is retrieved. */
- function &FetchField($fieldOffset = -1)
+ function FetchField($fieldOffset = -1)
{
if ($this->connection->debug) error_log("<hr>fetchfield: $fieldOffset,
fetch array: <pre>".print_r($this->fields,true)."</pre> backtrace:
".adodb_backtrace(false));
if ($fieldOffset != -1) $this->fieldOffset = $fieldOffset;
- $arrKeys = array_keys($this->fields);
+ /*$arrKeys = array_keys($this->fields);
if(array_key_exists($this->fieldOffset,$arrKeys) &&
!array_key_exists($arrKeys[$this->fieldOffset],$this->fields)) {
$f = false;
} else {
- $f = $this->fields[ $arrKeys[$this->fieldOffset] ];
+ $f = new ADOFetchObj();
+ $f->name = $arrKeys[$this->fieldOffset];
if($fieldOffset == -1) $this->fieldOffset++;
}
if (empty($f)) {
$f = false;//PHP Notice: Only variable references should be
returned by reference
- }
+ }*/
+ $fieldMeta = @sqlsrv_field_metadata($this->_queryID);
+ $f = new ADOFieldObject();
+ $f->name = $fieldMeta[$this->fieldOffset]['Name'];
+ $f->type = $fieldMeta[$this->fieldOffset]['Type'];
+ $f->max_length = $fieldMeta[$this->fieldOffset]['Size'];
+
return $f;
}
@@ -748,7 +755,7 @@
function _fetch($ignore_fields=false)
{
if ($this->connection->debug) error_log("_fetch()");
- if ($this->fetchMode & ADODB_FETCH_ASSOC) {
+ if ($this->fetchMode & ADODB_FETCH_BOTH) {
if ($this->fetchMode & ADODB_FETCH_NUM) {
if ($this->connection->debug) error_log("fetch mode: both");
$this->fields =
@sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_BOTH);
@@ -757,14 +764,16 @@
$this->fields =
@sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_ASSOC);
}
- if (ADODB_ASSOC_CASE == 0) {
- foreach($this->fields as $k=>$v) {
- $this->fields[strtolower($k)] = $v;
+ if (is_array($this->fields)) {
+ if (ADODB_ASSOC_CASE == 0) {
+ foreach($this->fields as $k=>$v) {
+ $this->fields[strtolower($k)] =
$v;
+ }
+ } else if (ADODB_ASSOC_CASE == 1) {
+ foreach($this->fields as $k=>$v) {
+ $this->fields[strtoupper($k)] =
$v;
+ }
}
- } else if (ADODB_ASSOC_CASE == 1) {
- foreach($this->fields as $k=>$v) {
- $this->fields[strtoupper($k)] = $v;
- }
}
} else {
if ($this->connection->debug) error_log("fetch mode: num");
@@ -851,7 +860,7 @@
$themth = $ADODB_mssql_mths[$themth];
if ($themth <= 0) return false;
// h-m-s-MM-DD-YY
- return mktime(0,0,0,$themth,$theday,$rr[3]);
+ return adodb_mktime(0,0,0,$themth,$theday,$rr[3]);
}
static function UnixTimeStamp($v)
@@ -892,7 +901,7 @@
break;
}
// h-m-s-MM-DD-YY
- return mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]);
+ return adodb_mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]);
}
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
-* @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+* @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mysql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mysql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mysql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -23,7 +23,7 @@
var $dataProvider = 'mysql';
var $hasInsertID = true;
var $hasAffectedRows = true;
- var $metaTablesSQL = "SHOW TABLES";
+ var $metaTablesSQL = "SELECT TABLE_NAME, CASE WHEN TABLE_TYPE = 'VIEW'
THEN 'V' ELSE 'T' END FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA=SCHEMA()";
var $metaColumnsSQL = "SHOW COLUMNS FROM `%s`";
var $fmtTimeStamp = "'Y-m-d H:i:s'";
var $hasLimit = true;
@@ -36,6 +36,7 @@
var $forceNewConnect = false;
var $poorAffectedRows = true;
var $clientFlags = 0;
+ var $charSet = '';
var $substr = "substring";
var $nameQuote = '`'; /// string to use to quote identifiers
and names
var $compat323 = false; // true if compat with mysql
3.23
@@ -44,7 +45,25 @@
{
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
}
-
+
+
+ // SetCharSet - switch the client encoding
+ function SetCharSet($charset_name)
+ {
+ if (!function_exists('mysql_set_charset'))
+ return false;
+
+ if ($this->charSet !== $charset_name) {
+ $ok = @mysql_set_charset($charset_name,$this->_connectionID);
+ if ($ok) {
+ $this->charSet = $charset_name;
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+
function ServerInfo()
{
$arr['description'] = ADOConnection::GetOne("select version()");
@@ -57,6 +76,65 @@
return " IFNULL($field, $ifNull) "; // if MySQL
}
+ function MetaProcedures($NamePattern = false, $catalog = null,
$schemaPattern = null)
+ {
+ // save old fetch mode
+ global $ADODB_FETCH_MODE;
+
+ $false = false;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+
+ if ($this->fetchMode !== FALSE) {
+ $savem = $this->SetFetchMode(FALSE);
+ }
+
+ $procedures = array ();
+
+ // get index details
+
+ $likepattern = '';
+ if ($NamePattern) {
+ $likepattern = " LIKE '".$NamePattern."'";
+ }
+ $rs = $this->Execute('SHOW PROCEDURE STATUS'.$likepattern);
+ if (is_object($rs)) {
+
+ // parse index data into array
+ while ($row = $rs->FetchRow()) {
+ $procedures[$row[1]] = array(
+ 'type' => 'PROCEDURE',
+ 'catalog' => '',
+
+ 'schema' => '',
+ 'remarks' => $row[7],
+ );
+ }
+ }
+
+ $rs = $this->Execute('SHOW FUNCTION STATUS'.$likepattern);
+ if (is_object($rs)) {
+ // parse index data into array
+ while ($row = $rs->FetchRow()) {
+ $procedures[$row[1]] = array(
+ 'type' => 'FUNCTION',
+ 'catalog' => '',
+ 'schema' => '',
+ 'remarks' => $row[7]
+ );
+ }
+ }
+
+ // restore fetchmode
+ if (isset($savem)) {
+ $this->SetFetchMode($savem);
+
+ }
+ $ADODB_FETCH_MODE = $save;
+
+
+ return $procedures;
+ }
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
@@ -530,6 +608,8 @@
function _close()
{
@mysql_close($this->_connectionID);
+
+ $this->charSet = '';
$this->_connectionID = false;
}
@@ -644,10 +724,10 @@
//$o->max_length = -1; // mysql returns the max length
less spaces -- so it is unrealiable
if ($o) $o->binary = (strpos($f,'binary')!== false);
}
- else if ($fieldOffset == -1) { /* The $fieldOffset
argument is not provided thus its -1 */
+ else { /* The $fieldOffset argument is not provided thus
its -1 */
$o = @mysql_fetch_field($this->_queryID);
- if ($o) $o->max_length =
@mysql_field_len($this->_queryID); // suggested by: Jim Nicholson
(jnich#att.com)
- //$o->max_length = -1; // mysql returns the max length less
spaces -- so it is unrealiable
+ //if ($o) $o->max_length =
@mysql_field_len($this->_queryID); // suggested by: Jim Nicholson
(jnich#att.com)
+ $o->max_length = -1; // mysql returns the max length
less spaces -- so it is unrealiable
}
return $o;
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -28,10 +28,10 @@
class ADODB_mysqli extends ADOConnection {
var $databaseType = 'mysqli';
- var $dataProvider = 'native';
+ var $dataProvider = 'mysql';
var $hasInsertID = true;
var $hasAffectedRows = true;
- var $metaTablesSQL = "SHOW TABLES";
+ var $metaTablesSQL = "SELECT TABLE_NAME, CASE WHEN TABLE_TYPE = 'VIEW'
THEN 'V' ELSE 'T' END FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA=SCHEMA()";
var $metaColumnsSQL = "SHOW COLUMNS FROM `%s`";
var $fmtTimeStamp = "'Y-m-d H:i:s'";
var $hasLimit = true;
@@ -50,7 +50,7 @@
var $_bindInputArray = false;
var $nameQuote = '`'; /// string to use to quote identifiers
and names
var $optionFlags = array(array(MYSQLI_READ_DEFAULT_GROUP,0));
- var $arrayClass = 'ADORecordSet_array_mysqli';
+ var $arrayClass = 'ADORecordSet_array_mysqli';
var $multiQuery = false;
function ADODB_mysqli()
@@ -99,6 +99,9 @@
mysqli_options($this->_connectionID,$arr[0],$arr[1]);
}
+ //http ://php.net/manual/en/mysqli.persistconns.php
+ if ($persist && PHP_VERSION > 5.2 &&
strncmp($argHostname,'p:',2) != 0) $argHostname = 'p:'.$argHostname;
+
#if (!empty($this->port)) $argHostname .= ":".$this->port;
$ok = mysqli_real_connect($this->_connectionID,
$argHostname,
@@ -144,10 +147,13 @@
// do not use $ADODB_COUNTRECS
function GetOne($sql,$inputarr=false)
{
+ global $ADODB_GETONE_EOF;
+
$ret = false;
$rs = $this->Execute($sql,$inputarr);
- if ($rs) {
- if (!$rs->EOF) $ret = reset($rs->fields);
+ if ($rs) {
+ if ($rs->EOF) $ret = $ADODB_GETONE_EOF;
+ else $ret = reset($rs->fields);
$rs->Close();
}
return $ret;
@@ -464,6 +470,66 @@
// return "from_unixtime(unix_timestamp($date)+$fraction)";
}
+ function MetaProcedures($NamePattern = false, $catalog = null,
$schemaPattern = null)
+ {
+ // save old fetch mode
+ global $ADODB_FETCH_MODE;
+
+ $false = false;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+
+ if ($this->fetchMode !== FALSE) {
+ $savem = $this->SetFetchMode(FALSE);
+ }
+
+ $procedures = array ();
+
+ // get index details
+
+ $likepattern = '';
+ if ($NamePattern) {
+ $likepattern = " LIKE '".$NamePattern."'";
+ }
+ $rs = $this->Execute('SHOW PROCEDURE STATUS'.$likepattern);
+ if (is_object($rs)) {
+
+ // parse index data into array
+ while ($row = $rs->FetchRow()) {
+ $procedures[$row[1]] = array(
+ 'type' => 'PROCEDURE',
+ 'catalog' => '',
+
+ 'schema' => '',
+ 'remarks' => $row[7],
+ );
+ }
+ }
+
+ $rs = $this->Execute('SHOW FUNCTION STATUS'.$likepattern);
+ if (is_object($rs)) {
+ // parse index data into array
+ while ($row = $rs->FetchRow()) {
+ $procedures[$row[1]] = array(
+ 'type' => 'FUNCTION',
+ 'catalog' => '',
+ 'schema' => '',
+ 'remarks' => $row[7]
+ );
+ }
+ }
+
+ // restore fetchmode
+ if (isset($savem)) {
+ $this->SetFetchMode($savem);
+
+ }
+ $ADODB_FETCH_MODE = $save;
+
+
+ return $procedures;
+ }
+
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
$save = $this->metaTablesSQL;
@@ -688,8 +754,8 @@
if ($this->multiQuery) {
$rs = mysqli_multi_query($this->_connectionID,
$sql.';');
if ($rs) {
- $rs = ($ADODB_COUNTRECS) ? @mysqli_store_result(
$this->_connectionID ) : @mysqli_use_result( $this->_connectionID );
- return $rs ? $rs : true; // mysqli_more_results(
$this->_connectionID )
+ $rs = ($ADODB_COUNTRECS) ?
@mysqli_store_result( $this->_connectionID ) : @mysqli_use_result(
$this->_connectionID );
+ return $rs ? $rs : true; //
mysqli_more_results( $this->_connectionID )
}
} else {
$rs = mysqli_query($this->_connectionID, $sql,
$ADODB_COUNTRECS ? MYSQLI_STORE_RESULT : MYSQLI_USE_RESULT);
@@ -697,10 +763,10 @@
if ($rs) return $rs;
}
- if($this->debug)
+ if($this->debug)
ADOConnection::outp("Query: " . $sql . " failed. " .
$this->ErrorMsg());
- return false;
+ return false;
}
@@ -777,7 +843,7 @@
if ($this->charSet !== $charset_name) {
$if = @$this->_connectionID->set_charset($charset_name);
- if ($if == "0" & $this->GetCharSet() == $charset_name) {
+ if ($if === true & $this->GetCharSet() == $charset_name) {
return true;
} else return false;
} else return true;
@@ -959,16 +1025,10 @@
//if results are attached to this pointer from Stored Proceedure
calls, the next standard query will die 2014
//only a problem with persistant connections
- //mysqli_next_result($this->connection->_connectionID); trashes the DB
side attached results.
-
while(mysqli_more_results($this->connection->_connectionID)){
@mysqli_next_result($this->connection->_connectionID);
}
- //Because you can have one attached result, without tripping
mysqli_more_results
- @mysqli_next_result($this->connection->_connectionID);
-
-
mysqli_free_result($this->_queryID);
$this->_queryID = false;
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlpo.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlpo.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlpo.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com
Based on the previous postgres drivers.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-oci8.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-oci8.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-oci8.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
- version V5.11 5 May 2010 (c) 2000-2010 John Lim. All rights reserved.
+ version V5.18 3 Sep 2012 (c) 2000-2012 John Lim. All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
@@ -72,8 +72,15 @@
where owner='%s' and table_name='%s' order by column_id"; // when there is a
schema
var $_bindInputArray = true;
var $hasGenID = true;
- var $_genIDSQL = "SELECT (%s.nextval) FROM DUAL";
- var $_genSeqSQL = "CREATE SEQUENCE %s START WITH %s";
+ var $_genIDSQL = "SELECT (%s.nextval) FROM DUAL";
+ var $_genSeqSQL = "
+DECLARE
+ PRAGMA AUTONOMOUS_TRANSACTION;
+BEGIN
+ execute immediate 'CREATE SEQUENCE %s START WITH %s';
+END;
+";
+
var $_dropSeqSQL = "DROP SEQUENCE %s";
var $hasAffectedRows = true;
var $random = "abs(mod(DBMS_RANDOM.RANDOM,10000001)/10000000)";
@@ -81,7 +88,7 @@
var $connectSID = false;
var $_bind = false;
var $_nestedSQL = true;
- var $_hasOCIFetchStatement = false;
+ var $_hasOciFetchStatement = false;
var $_getarray = false; // currently not working
var $leftOuter = ''; // oracle wierdness, $col = $value (+) for LEFT
OUTER, $col (+)= $value for RIGHT OUTER
var $session_sharing_force_blob = false; // alter session on updateblob
if set to true
@@ -97,7 +104,7 @@
function ADODB_oci8()
{
- $this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
+ $this->_hasOciFetchStatement = ADODB_PHPVER >= 0x4200;
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
}
@@ -105,7 +112,7 @@
function MetaColumns($table, $normalize=true)
{
global $ADODB_FETCH_MODE;
-
+
$schema = '';
$this->_findschema($table, $schema);
@@ -113,11 +120,11 @@
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem =
$this->SetFetchMode(false);
-
+
if ($schema)
$rs = $this->Execute(sprintf($this->metaColumnsSQL2,
strtoupper($schema), strtoupper($table)));
else
- $rs =
$this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
+ $rs =
$this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
@@ -194,7 +201,7 @@
*/
function _connect($argHostname, $argUsername, $argPassword,
$argDatabasename,$mode=0)
{
- if (!function_exists('OCIPLogon')) return null;
+ if (!function_exists('oci_pconnect')) return null;
#adodb_backtrace();
$this->_errorMsg = false;
@@ -228,22 +235,22 @@
//if ($argHostname) print "<p>Connect: 1st argument should be
left blank for $this->databaseType</p>";
if ($mode==1) {
$this->_connectionID = ($this->charSet) ?
- OCIPLogon($argUsername,$argPassword,
$argDatabasename,$this->charSet)
+ oci_pconnect($argUsername,$argPassword,
$argDatabasename,$this->charSet)
:
- OCIPLogon($argUsername,$argPassword,
$argDatabasename)
+ oci_pconnect($argUsername,$argPassword,
$argDatabasename)
;
- if ($this->_connectionID && $this->autoRollback)
OCIrollback($this->_connectionID);
+ if ($this->_connectionID && $this->autoRollback)
oci_rollback($this->_connectionID);
} else if ($mode==2) {
$this->_connectionID = ($this->charSet) ?
- OCINLogon($argUsername,$argPassword,
$argDatabasename,$this->charSet)
+ oci_new_connect($argUsername,$argPassword,
$argDatabasename,$this->charSet)
:
- OCINLogon($argUsername,$argPassword,
$argDatabasename);
+ oci_new_connect($argUsername,$argPassword,
$argDatabasename);
} else {
$this->_connectionID = ($this->charSet) ?
- OCILogon($argUsername,$argPassword,
$argDatabasename,$this->charSet)
+ oci_connect($argUsername,$argPassword,
$argDatabasename,$this->charSet)
:
- OCILogon($argUsername,$argPassword,
$argDatabasename);
+ oci_connect($argUsername,$argPassword,
$argDatabasename);
}
if (!$this->_connectionID) return false;
if ($this->_initdate) {
@@ -252,7 +259,7 @@
// looks like:
// Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
With the Partitioning option JServer Release 8.1.7.0.0 - Production
- // $vers = OCIServerVersion($this->_connectionID);
+ // $vers = oci_server_version($this->_connectionID);
// if (strpos($vers,'8i') !== false) $this->ansiOuter = true;
return true;
}
@@ -260,7 +267,7 @@
function ServerInfo()
{
$arr['compat'] = $this->GetOne('select value from
sys.database_compatible_level');
- $arr['description'] = @OCIServerVersion($this->_connectionID);
+ $arr['description'] = @oci_server_version($this->_connectionID);
$arr['version'] = ADOConnection::_findvers($arr['description']);
return $arr;
}
@@ -278,7 +285,7 @@
function _affectedrows()
{
- if (is_resource($this->_stmt)) return
@OCIRowCount($this->_stmt);
+ if (is_resource($this->_stmt)) return
@oci_num_rows($this->_stmt);
return 0;
}
@@ -291,8 +298,12 @@
function DBDate($d,$isfld=false)
{
if (empty($d) && $d !== 0) return 'null';
- if ($isfld) return 'TO_DATE('.$d.",'".$this->dateformat."')";
+ if ($isfld) {
+ $d = _adodb_safedate($d);
+ return 'TO_DATE('.$d.",'".$this->dateformat."')";
+ }
+
if (is_string($d)) $d = ADORecordSet::UnixDate($d);
if (is_object($d)) $ds = $d->format($this->fmtDate);
@@ -326,9 +337,9 @@
if (empty($ts) && $ts !== 0) return 'null';
if ($isfld) return 'TO_DATE(substr('.$ts.",1,19),'RRRR-MM-DD,
HH24:MI:SS')";
if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts);
-
+
if (is_object($ts)) $tss = $ts->format("'Y-m-d H:i:s'");
- else $tss = adodb_date("'Y-m-d H:i:s'",$ts);
+ else $tss = date("'Y-m-d H:i:s'",$ts);
return 'TO_DATE('.$tss.",'RRRR-MM-DD, HH24:MI:SS')";
}
@@ -375,6 +386,13 @@
$false = false;
$rs = $this->Execute(sprintf("SELECT * FROM ALL_CONSTRAINTS
WHERE UPPER(TABLE_NAME)='%s' AND CONSTRAINT_TYPE='P'",$table));
+ if (!is_object($rs)) {
+ if (isset($savem))
+ $this->SetFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+ return $false;
+ }
+
if ($row = $rs->FetchRow())
$primary_key = $row[1]; //constraint_name
@@ -440,7 +458,7 @@
if (!$ok) return $this->RollbackTrans();
if ($this->transCnt) $this->transCnt -= 1;
- $ret = OCIcommit($this->_connectionID);
+ $ret = oci_commit($this->_connectionID);
$this->_commit = OCI_COMMIT_ON_SUCCESS;
$this->autoCommit = true;
return $ret;
@@ -450,7 +468,7 @@
{
if ($this->transOff) return true;
if ($this->transCnt) $this->transCnt -= 1;
- $ret = OCIrollback($this->_connectionID);
+ $ret = oci_rollback($this->_connectionID);
$this->_commit = OCI_COMMIT_ON_SUCCESS;
$this->autoCommit = true;
return $ret;
@@ -466,10 +484,10 @@
{
if ($this->_errorMsg !== false) return $this->_errorMsg;
- if (is_resource($this->_stmt)) $arr = @OCIError($this->_stmt);
+ if (is_resource($this->_stmt)) $arr = @oci_error($this->_stmt);
if (empty($arr)) {
- if (is_resource($this->_connectionID)) $arr =
@OCIError($this->_connectionID);
- else $arr = @OCIError();
+ if (is_resource($this->_connectionID)) $arr =
@oci_error($this->_connectionID);
+ else $arr = @oci_error();
if ($arr === false) return '';
}
$this->_errorMsg = $arr['message'];
@@ -481,10 +499,10 @@
{
if ($this->_errorCode !== false) return $this->_errorCode;
- if (is_resource($this->_stmt)) $arr = @OCIError($this->_stmt);
+ if (is_resource($this->_stmt)) $arr = @oci_error($this->_stmt);
if (empty($arr)) {
- $arr = @OCIError($this->_connectionID);
- if ($arr == false) $arr = @OCIError();
+ $arr = @oci_error($this->_connectionID);
+ if ($arr == false) $arr = @oci_error();
if ($arr == false) return '';
}
@@ -598,10 +616,13 @@
{
// seems that oracle only supports 1 hint comment in 8i
if ($this->firstrows) {
+ if ($nrows > 500 && $nrows < 1000) $hint =
"FIRST_ROWS($nrows)";
+ else $hint = 'FIRST_ROWS';
+
if (strpos($sql,'/*+') !== false)
- $sql = str_replace('/*+ ','/*+FIRST_ROWS
',$sql);
+ $sql = str_replace('/*+ ',"/*+$hint ",$sql);
else
- $sql = preg_replace('/^[
\t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql);
+ $sql = preg_replace('/^[
\t\n]*select/i',"SELECT /*+$hint*/",$sql);
}
if ($offset == -1 || ($offset < $this->selectOffsetAlg1 && 0 <
$nrows && $nrows < 1000)) {
@@ -637,34 +658,34 @@
foreach($inputarr as $k => $v) {
if (is_array($v)) {
if (sizeof($v) == 2) //
suggested by address@hidden
-
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1]);
else
-
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
} else {
$len = -1;
if ($v === ' ') $len = 1;
- if (isset($bindarr)) { // is
prepared sql, so no need to ocibindbyname again
+ if (isset($bindarr)) { // is
prepared sql, so no need to oci_bind_by_name again
$bindarr[$k] = $v;
} else {
// dynamic sql, so rebind every time
-
OCIBindByName($stmt,":$k",$inputarr[$k],$len);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k],$len);
}
}
}
}
- if (!OCIExecute($stmt, OCI_DEFAULT)) {
- OCIFreeStatement($stmt);
+ if (!oci_execute($stmt, OCI_DEFAULT)) {
+ oci_free_statement($stmt);
return $false;
}
- $ncols = OCINumCols($stmt);
+ $ncols = oci_num_fields($stmt);
for ( $i = 1; $i <= $ncols; $i++ ) {
- $cols[] = '"'.OCIColumnName($stmt, $i).'"';
+ $cols[] = '"'.oci_field_name($stmt, $i).'"';
}
$result = false;
- OCIFreeStatement($stmt);
+ oci_free_statement($stmt);
$fields = implode(',', $cols);
if ($nrows <= 0) $nrows = 999999999999;
else $nrows += $offset;
@@ -727,7 +748,7 @@
else
$sql = "UPDATE $table set $column=EMPTY_{$blobtype}()
WHERE $where RETURNING $column INTO :blob";
- $desc = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
+ $desc = oci_new_descriptor($this->_connectionID, OCI_D_LOB);
$arr['blob'] = array($desc,-1,$type);
if ($this->session_sharing_force_blob) $this->Execute('ALTER
SESSION SET CURSOR_SHARING=EXACT');
$commit = $this->autoCommit;
@@ -758,7 +779,7 @@
else
$sql = "UPDATE $table set $column=EMPTY_{$blobtype}()
WHERE $where RETURNING $column INTO :blob";
- $desc = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
+ $desc = oci_new_descriptor($this->_connectionID, OCI_D_LOB);
$arr['blob'] = array($desc,-1,$type);
$this->BeginTrans();
@@ -788,11 +809,14 @@
if ($inputarr) {
#if (!is_array($inputarr)) $inputarr = array($inputarr);
- $element0 = reset($inputarr);
+ $element0 = reset($inputarr);
+ $array2d = $this->bulkBind && is_array($element0) &&
!is_object(reset($element0));
- if (!$this->_bindInputArray) {
+ # see
http://phplens.com/lens/lensforum/msgs.php?id=18786
+ if ($array2d || !$this->_bindInputArray) {
+
# is_object check because oci8 descriptors can be
passed in
- if (is_array($element0) &&
!is_object(reset($element0))) {
+ if ($array2d && $this->_bindInputArray) {
if (is_string($sql))
$stmt = $this->Prepare($sql);
else
@@ -802,6 +826,7 @@
$ret = $this->_Execute($stmt,$arr);
if (!$ret) return $ret;
}
+ return $ret;
} else {
$sqlarr = explode(':',$sql);
$sql = '';
@@ -855,12 +880,12 @@
{
static $BINDNUM = 0;
- $stmt = OCIParse($this->_connectionID,$sql);
+ $stmt = oci_parse($this->_connectionID,$sql);
if (!$stmt) {
$this->_errorMsg = false;
$this->_errorCode = false;
- $arr = @OCIError($this->_connectionID);
+ $arr = @oci_error($this->_connectionID);
if ($arr === false) return false;
$this->_errorMsg = $arr['message'];
@@ -870,9 +895,9 @@
$BINDNUM += 1;
- $sttype = @OCIStatementType($stmt);
+ $sttype = @oci_statement_type($stmt);
if ($sttype == 'BEGIN' || $sttype == 'DECLARE') {
- return array($sql,$stmt,0,$BINDNUM, ($cursor) ?
OCINewCursor($this->_connectionID) : false);
+ return array($sql,$stmt,0,$BINDNUM, ($cursor) ?
oci_new_cursor($this->_connectionID) : false);
}
return array($sql,$stmt,0,$BINDNUM);
}
@@ -894,7 +919,7 @@
function ExecuteCursor($sql,$cursorName='rs',$params=false)
{
if (is_array($sql)) $stmt = $sql;
- else $stmt = ADODB_oci8::Prepare($sql,true); # true to allocate
OCINewCursor
+ else $stmt = ADODB_oci8::Prepare($sql,true); # true to allocate
oci_new_cursor
if (is_array($stmt) && sizeof($stmt) >= 5) {
$hasref = true;
@@ -910,7 +935,7 @@
$rs = $this->Execute($stmt);
if ($rs) {
- if ($rs->databaseType == 'array')
OCIFreeCursor($stmt[4]);
+ if ($rs->databaseType == 'array')
oci_free_cursor($stmt[4]);
else if ($hasref) $rs->_refcursor = $stmt[4];
}
return $rs;
@@ -937,13 +962,13 @@
Some timings:
** Test table has 3 cols, and 1 index. Test to insert
1000 records
- Time 0.6081s (1644.60 inserts/sec) with direct
OCIParse/OCIExecute
+ Time 0.6081s (1644.60 inserts/sec) with direct
oci_parse/oci_execute
Time 0.6341s (1577.16 inserts/sec) with ADOdb
Prepare/Bind/Execute
Time 1.5533s ( 643.77 inserts/sec) with pure SQL using
Execute
Now if PHP only had batch/bulk updating like Java or PL/SQL...
- Note that the order of parameters differs from OCIBindByName,
+ Note that the order of parameters differs from oci_bind_by_name,
because we default the names to :0, :1, :2
*/
function
Bind(&$stmt,&$var,$size=4000,$type=false,$name=false,$isOutput=false)
@@ -952,12 +977,12 @@
if (!is_array($stmt)) return false;
if (($type == OCI_B_CURSOR) && sizeof($stmt) >= 5) {
- return OCIBindByName($stmt[1],":".$name,$stmt[4],$size,$type);
+ return oci_bind_by_name($stmt[1],":".$name,$stmt[4],$size,$type);
}
if ($name == false) {
- if ($type !== false) $rez =
OCIBindByName($stmt[1],":".$stmt[2],$var,$size,$type);
- else $rez =
OCIBindByName($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null terminator
+ if ($type !== false) $rez =
oci_bind_by_name($stmt[1],":".$stmt[2],$var,$size,$type);
+ else $rez =
oci_bind_by_name($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null
terminator
$stmt[2] += 1;
} else if (oci_lob_desc($type)) {
if ($this->debug) {
@@ -965,11 +990,11 @@
}
//we have to create a new Descriptor here
$numlob = count($this->_refLOBs);
- $this->_refLOBs[$numlob]['LOB'] =
OCINewDescriptor($this->_connectionID, oci_lob_desc($type));
+ $this->_refLOBs[$numlob]['LOB'] =
oci_new_descriptor($this->_connectionID, oci_lob_desc($type));
$this->_refLOBs[$numlob]['TYPE'] = $isOutput;
$tmp = $this->_refLOBs[$numlob]['LOB'];
- $rez = OCIBindByName($stmt[1], ":".$name, $tmp, -1, $type);
+ $rez = oci_bind_by_name($stmt[1], ":".$name, $tmp, -1, $type);
if ($this->debug) {
ADOConnection::outp("<b>Bind</b>: descriptor
has been allocated, var (".$name.") binded");
}
@@ -990,14 +1015,14 @@
if ($this->debug)
ADOConnection::outp("<b>Bind</b>: name =
$name");
- if ($type !== false) $rez =
OCIBindByName($stmt[1],":".$name,$var,$size,$type);
- else $rez =
OCIBindByName($stmt[1],":".$name,$var,$size); // +1 byte for null terminator
+ if ($type !== false) $rez =
oci_bind_by_name($stmt[1],":".$name,$var,$size,$type);
+ else $rez =
oci_bind_by_name($stmt[1],":".$name,$var,$size); // +1 byte for null terminator
}
return $rez;
}
- function Param($name,$type=false)
+ function Param($name,$type='C')
{
return ':'.$name;
}
@@ -1016,7 +1041,7 @@
@param [$maxLen] Holds an maximum length of the variable.
@param [$type] The data type of $var. Legal values depend on
driver.
- See OCIBindByName documentation at php.net.
+ See oci_bind_by_name documentation at php.net.
*/
function
Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)
{
@@ -1048,7 +1073,7 @@
if (is_array($sql)) { // is prepared sql
$stmt = $sql[1];
- // we try to bind to permanent array, so that
OCIBindByName is persistent
+ // we try to bind to permanent array, so that
oci_bind_by_name is persistent
// and carried out once only - note that max array
element size is 4000 chars
if (is_array($inputarr)) {
$bindpos = $sql[3];
@@ -1060,27 +1085,27 @@
$bindarr = array();
foreach($inputarr as $k => $v) {
$bindarr[$k] = $v;
-
OCIBindByName($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 :
4000);
+
oci_bind_by_name($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1
: 4000);
}
$this->_bind[$bindpos] = $bindarr;
}
}
} else {
- $stmt=OCIParse($this->_connectionID,$sql);
+ $stmt=oci_parse($this->_connectionID,$sql);
}
$this->_stmt = $stmt;
if (!$stmt) return false;
- if (defined('ADODB_PREFETCH_ROWS'))
@OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS);
+ if (defined('ADODB_PREFETCH_ROWS'))
@oci_set_prefetch($stmt,ADODB_PREFETCH_ROWS);
if (is_array($inputarr)) {
foreach($inputarr as $k => $v) {
if (is_array($v)) {
if (sizeof($v) == 2) // suggested by
address@hidden
-
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1]);
else
-
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]);
if ($this->debug==99) {
if (is_object($v[0]))
@@ -1092,10 +1117,10 @@
} else {
$len = -1;
if ($v === ' ') $len = 1;
- if (isset($bindarr)) { // is prepared
sql, so no need to ocibindbyname again
+ if (isset($bindarr)) { // is prepared
sql, so no need to oci_bind_by_name again
$bindarr[$k] = $v;
} else {
// dynamic sql, so rebind every time
-
OCIBindByName($stmt,":$k",$inputarr[$k],$len);
+
oci_bind_by_name($stmt,":$k",$inputarr[$k],$len);
}
}
}
@@ -1103,8 +1128,8 @@
$this->_errorMsg = false;
$this->_errorCode = false;
- if (OCIExecute($stmt,$this->_commit)) {
-//OCIInternalDebug(1);
+ if (oci_execute($stmt,$this->_commit)) {
+
if (count($this -> _refLOBs) > 0) {
foreach ($this -> _refLOBs as $key => $value) {
@@ -1126,7 +1151,7 @@
}
}
- switch (@OCIStatementType($stmt)) {
+ switch (@oci_statement_type($stmt)) {
case "SELECT":
return $stmt;
@@ -1135,20 +1160,20 @@
if (is_array($sql) && !empty($sql[4])) {
$cursor = $sql[4];
if (is_resource($cursor)) {
- $ok =
OCIExecute($cursor);
+ $ok =
oci_execute($cursor);
return $cursor;
}
return $stmt;
} else {
if (is_resource($stmt)) {
- OCIFreeStatement($stmt);
+
oci_free_statement($stmt);
return true;
}
return $stmt;
}
break;
default :
- // ociclose -- no because it could be
used in a LOB?
+
return true;
}
}
@@ -1186,14 +1211,14 @@
{
if (!$this->_connectionID) return;
- if (!$this->autoCommit) OCIRollback($this->_connectionID);
+ if (!$this->autoCommit) oci_rollback($this->_connectionID);
if (count($this->_refLOBs) > 0) {
foreach ($this ->_refLOBs as $key => $value) {
$this->_refLOBs[$key]['LOB']->free();
unset($this->_refLOBs[$key]);
}
}
- OCILogoff($this->_connectionID);
+ oci_close($this->_connectionID);
$this->_stmt = false;
$this->_connectionID = false;
@@ -1360,12 +1385,13 @@
$this->_currentRow = 0;
@$this->_initrs();
- $this->EOF = !$this->_fetch();
+ if ($this->_numOfFields) $this->EOF = !$this->_fetch();
+ else $this->EOF = true;
/*
// based on idea by Gaetano Giunta to detect unusual
oracle errors
// see
http://phplens.com/lens/lensforum/msgs.php?id=6771
- $err = OCIError($this->_queryID);
+ $err = oci_error($this->_queryID);
if ($err && $this->connection->debug)
ADOConnection::outp($err);
*/
@@ -1384,7 +1410,7 @@
function _initrs()
{
$this->_numOfRows = -1;
- $this->_numOfFields = OCInumcols($this->_queryID);
+ $this->_numOfFields = oci_num_fields($this->_queryID);
if ($this->_numOfFields>0) {
$this->_fieldobjs = array();
$max = $this->_numOfFields;
@@ -1401,13 +1427,13 @@
{
$fld = new ADOFieldObject;
$fieldOffset += 1;
- $fld->name =OCIcolumnname($this->_queryID, $fieldOffset);
- $fld->type = OCIcolumntype($this->_queryID, $fieldOffset);
- $fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset);
+ $fld->name =oci_field_name($this->_queryID, $fieldOffset);
+ $fld->type = oci_field_type($this->_queryID, $fieldOffset);
+ $fld->max_length = oci_field_size($this->_queryID,
$fieldOffset);
switch($fld->type) {
case 'NUMBER':
- $p = OCIColumnPrecision($this->_queryID, $fieldOffset);
- $sc = OCIColumnScale($this->_queryID, $fieldOffset);
+ $p = oci_field_precision($this->_queryID, $fieldOffset);
+ $sc = oci_field_scale($this->_queryID, $fieldOffset);
if ($p != 0 && $sc == 0) $fld->type = 'INT';
$fld->scale = $p;
break;
@@ -1421,7 +1447,7 @@
return $fld;
}
- /* For some reason, OCIcolumnname fails when called after _initrs() so
we cache it */
+ /* For some reason, oci_field_name fails when called after _initrs() so
we cache it */
function FetchField($fieldOffset = -1)
{
return $this->_fieldobjs[$fieldOffset];
@@ -1437,7 +1463,7 @@
if ($this->EOF) return false;
$this->_currentRow++;
-
if(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode))
+ if($this->fields =
@oci_fetch_array($this->_queryID,$this->fetchMode))
return true;
$this->EOF = true;
@@ -1447,7 +1473,7 @@
function MoveNext()
{
- if
(@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode)) {
+ if ($this->fields =
@oci_fetch_array($this->_queryID,$this->fetchMode)) {
$this->_currentRow += 1;
return true;
}
@@ -1467,18 +1493,18 @@
if (true || !empty($ADODB_OCI8_GETARRAY)) {
# does not support $ADODB_ANSI_PADDING_OFF
- //OCI_RETURN_NULLS and OCI_RETURN_LOBS is set by
OCIfetchstatement
+ //OCI_RETURN_NULLS and OCI_RETURN_LOBS is set by
oci_fetch_all
switch($this->adodbFetchMode) {
case ADODB_FETCH_NUM:
- $ncols = @OCIfetchstatement($this->_queryID,
$results, 0, $nRows, OCI_FETCHSTATEMENT_BY_ROW+OCI_NUM);
+ $ncols = @oci_fetch_all($this->_queryID,
$results, 0, $nRows, oci_fetch_all_BY_ROW+OCI_NUM);
$results =
array_merge(array($this->fields),$results);
return $results;
case ADODB_FETCH_ASSOC:
if (ADODB_ASSOC_CASE != 2 ||
$this->databaseType != 'oci8') break;
- $ncols = @OCIfetchstatement($this->_queryID,
$assoc, 0, $nRows, OCI_FETCHSTATEMENT_BY_ROW);
+ $ncols = @oci_fetch_all($this->_queryID,
$assoc, 0, $nRows, oci_fetch_all_BY_ROW);
$results =
array_merge(array($this->fields),$assoc);
return $results;
@@ -1492,7 +1518,7 @@
} */
- /* Optimize SelectLimit() by using OCIFetch() instead of OCIFetchInto()
*/
+ /* Optimize SelectLimit() by using oci_fetch() */
function GetArrayLimit($nrows,$offset=-1)
{
if ($offset <= 0) {
@@ -1501,9 +1527,9 @@
}
$arr = array();
for ($i=1; $i < $offset; $i++)
- if (address@hidden($this->_queryID)) return $arr;
+ if (address@hidden($this->_queryID)) return $arr;
- if
(address@hidden($this->_queryID,$this->fields,$this->fetchMode)) return $arr;;
+ if (!$this->fields =
@oci_fetch_array($this->_queryID,$this->fetchMode)) return $arr;;
$results = array();
$cnt = 0;
while (!$this->EOF && $nrows != $cnt) {
@@ -1538,7 +1564,7 @@
function _fetch()
{
- return
@OCIfetchinto($this->_queryID,$this->fields,$this->fetchMode);
+ return $this->fields =
@oci_fetch_array($this->_queryID,$this->fetchMode);
}
/* close() only needs to be called if you are worried
about using too much memory while your script
@@ -1548,10 +1574,10 @@
{
if ($this->connection->_stmt === $this->_queryID)
$this->connection->_stmt = false;
if (!empty($this->_refcursor)) {
- OCIFreeCursor($this->_refcursor);
+ oci_free_cursor($this->_refcursor);
$this->_refcursor = false;
}
- @OCIFreeStatement($this->_queryID);
+ @oci_free_statement($this->_queryID);
$this->_queryID = false;
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/**
- * @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ * @version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights reserved.
* Released under both BSD license and Lesser GPL library license.
* Whenever there is any discrepancy between the two licenses,
* the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-oci8po.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-oci8po.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-oci8po.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim. All rights reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 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.
@@ -34,7 +34,7 @@
# oci8po does not support adodb extension: adodb_movenext()
}
- function Param($name)
+ function Param($name,$type='C')
{
return '?';
}
@@ -49,6 +49,11 @@
return ADODB_oci8::Prepare($sql,$cursor);
}
+ function Execute($sql,$inputarr=false)
+ {
+ return ADOConnection::Execute($sql,$inputarr);
+ }
+
// emulate handling of parameters ? ?, replacing with :bind0 :bind1
function _query($sql,$inputarr=false)
{
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -52,9 +52,13 @@
if (!function_exists('odbc_connect')) return null;
- if ($this->debug && $argDatabasename && $this->databaseType !=
'vfp') {
- ADOConnection::outp("For odbc Connect(),
$argDatabasename is not used. Place dsn in 1st parameter.");
+ if (!empty($argDatabasename) && stristr($argDSN, 'Database=')
=== false) {
+ $argDSN = trim($argDSN);
+ $endDSN = substr($argDSN, strlen($argDSN) - 1);
+ if ($endDSN != ';') $argDSN .= ';';
+ $argDSN .= 'Database='.$argDatabasename;
}
+
if (isset($php_errormsg)) $php_errormsg = '';
if ($this->curmode === false) $this->_connectionID =
odbc_connect($argDSN,$argUsername,$argPassword);
else $this->_connectionID =
odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode);
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_db2.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_db2.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_db2.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -27,7 +27,11 @@
var $_bindInputArray = true;
var $metaDatabasesSQL = "select name from sysdatabases where name <>
'master'";
var $metaTablesSQL="select name,case when type='U' then 'T' else 'V'
end from sysobjects where (type='U' or type='V') and (name not in
('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE'))";
- var $metaColumnsSQL = "select c.name,t.name,c.length from syscolumns c
join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where
o.name='%s'";
+ var $metaColumnsSQL = # xtype==61 is datetime
+ "select c.name,t.name,c.length,c.isnullable, c.status,
+ (case when c.xusertype=61 then 0 else c.xprec end),
+ (case when c.xusertype=61 then 0 else c.xscale end)
+ from syscolumns c join systypes t on t.xusertype=c.xusertype
join sysobjects o on o.id=c.id where o.name='%s'";
var $hasTop = 'top'; // support mssql/interbase SELECT TOP
10 * FROM TABLE
var $sysDate = 'GetDate()';
var $sysTimeStamp = 'GetDate()';
@@ -118,7 +122,7 @@
function MetaTables($ttype=false,$showSchema=false,$mask=false)
{
- if ($mask) {$this->debug=1;
+ if ($mask) {//$this->debug=1;
$save = $this->metaTablesSQL;
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " AND name like $mask";
@@ -133,8 +137,59 @@
function MetaColumns($table, $normalize=true)
{
- $arr = ADOConnection::MetaColumns($table);
- return $arr;
+
+ $this->_findschema($table,$schema);
+ if ($schema) {
+ $dbName = $this->database;
+ $this->SelectDB($schema);
+ }
+ global $ADODB_FETCH_MODE;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+
+ if ($this->fetchMode !== false) $savem =
$this->SetFetchMode(false);
+ $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
+
+ if ($schema) {
+ $this->SelectDB($dbName);
+ }
+
+ if (isset($savem)) $this->SetFetchMode($savem);
+ $ADODB_FETCH_MODE = $save;
+ if (!is_object($rs)) {
+ $false = false;
+ return $false;
+ }
+
+ $retarr = array();
+ while (!$rs->EOF){
+ $fld = new ADOFieldObject();
+ $fld->name = $rs->fields[0];
+ $fld->type = $rs->fields[1];
+
+ $fld->not_null = (!$rs->fields[3]);
+ $fld->auto_increment = ($rs->fields[4] == 128);
// sys.syscolumns status field. 0x80 = 128 ref:
http://msdn.microsoft.com/en-us/library/ms186816.aspx
+
+
+ if (isset($rs->fields[5]) && $rs->fields[5]) {
+ if ($rs->fields[5]>0) $fld->max_length =
$rs->fields[5];
+ $fld->scale = $rs->fields[6];
+ if ($fld->scale>0) $fld->max_length += 1;
+ } else
+ $fld->max_length = $rs->fields[2];
+
+
+ if ($save == ADODB_FETCH_NUM) {
+ $retarr[] = $fld;
+ } else {
+ $retarr[strtoupper($fld->name)] = $fld;
+ }
+ $rs->MoveNext();
+ }
+
+ $rs->Close();
+ return $retarr;
+
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_oracle.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_oracle.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_oracle.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
@@ -175,7 +175,7 @@
if ($argPassword && stripos($UserOrDSN,'DRIVER=') !== false) {
$this->_connectionID =
odbtp_connect($HostOrInterface,$UserOrDSN.';PWD='.$argPassword);
} else
- $this->_connectionID =
odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
+ $this->_connectionID =
odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
if ($this->_connectionID === false) {
$this->_errorMsg = $this->ErrorMsg() ;
return false;
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
2013-09-27 13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
2013-09-27 13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo.inc.php 2013-09-27 13:24:08 UTC
(rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo.inc.php 2013-09-27 13:29:42 UTC
(rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -241,7 +241,7 @@
if ($arr) {
if (sizeof($arr)<2) return '';
- if ((integer)$arr[1]) return $arr[2];
+ if ((integer)$arr[0]) return $arr[2];
else return '';
} else return '-1';
}
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mssql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mssql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mssql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -2,7 +2,7 @@
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mysql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mysql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_mysql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -2,7 +2,7 @@
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_oci.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_oci.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_oci.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -2,7 +2,7 @@
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_pgsql.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_pgsql.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_pgsql.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_sqlite.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_sqlite.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-pdo_sqlite.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,7 +1,7 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
@@ -198,6 +198,6 @@
$this->metaTablesSQL = $save;
}
return $ret;
- }
+ }
}
?>
\ No newline at end of file
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-postgres.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-postgres.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-postgres.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -109,6 +109,8 @@
var $_bindInputArray = false; // requires postgresql 7.3+ and ability
to modify database
var $disableBlobs = false; // set to true to disable blob checking,
resulting in 2-5% improvement in performance.
+ var $_pnum = 0;
+
// The last (fmtTimeStamp is not entirely correct:
// PostgreSQL also has support for time zones,
// and writes these time in this format: "2001-03-01 18:59:26+02".
@@ -206,19 +208,17 @@
{
$info = $this->ServerInfo();
if ($info['version'] >= 7.3) {
- $this->metaTablesSQL = "select tablename,'T' from pg_tables
where tablename not like 'pg\_%'
- and schemaname not in (
'pg_catalog','information_schema')
- union
- select viewname,'V' from pg_views where viewname not like 'pg\_%' and
schemaname not in ( 'pg_catalog','information_schema') ";
+ $this->metaTablesSQL = "select table_name,'T' from
information_schema.tables where table_schema not in (
'pg_catalog','information_schema')
+ union
+ select table_name,'V' from information_schema.views
where table_schema not in ( 'pg_catalog','information_schema') ";
}
if ($mask) {
$save = $this->metaTablesSQL;
$mask = $this->qstr(strtolower($mask));
if ($info['version']>=7.3)
- $this->metaTablesSQL = "
-select tablename,'T' from pg_tables where tablename like $mask and schemaname
not in ( 'pg_catalog','information_schema')
- union
-select viewname,'V' from pg_views where viewname like $mask and schemaname
not in ( 'pg_catalog','information_schema') ";
+ $this->metaTablesSQL = "select table_name,'T'
from information_schema.tables where table_name like $mask and table_schema not
in ( 'pg_catalog','information_schema')
+ union
+ select table_name,'V' from information_schema.views
where table_name like $mask and table_schema not in (
'pg_catalog','information_schema') ";
else
$this->metaTablesSQL = "
select tablename,'T' from pg_tables where tablename like $mask
@@ -240,7 +240,7 @@
if (is_bool($s)) return $s ? 'true' : 'false';
if (!$magic_quotes) {
- if (ADODB_PHPVER >= 0x5200) {
+ if (ADODB_PHPVER >= 0x5200 && $this->_connectionID) {
return
"'".pg_escape_string($this->_connectionID,$s)."'";
}
if (ADODB_PHPVER >= 0x4200) {
@@ -444,7 +444,6 @@
// assumes bytea for blob, and varchar for clob
function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
{
-
if ($blobtype == 'CLOB') {
return $this->Execute("UPDATE $table SET $column=" .
$this->qstr($val) . " WHERE $where");
}
@@ -485,7 +484,7 @@
if ($this->fetchMode !== false) $savem =
$this->SetFetchMode(false);
if ($schema) $rs =
$this->Execute(sprintf($this->metaColumnsSQL1,$table,$table,$schema));
- else $rs =
$this->Execute(sprintf($this->metaColumnsSQL,$table,$table));
+ else $rs =
$this->Execute(sprintf($this->metaColumnsSQL,$table,$table,$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
@@ -583,7 +582,13 @@
return $retarr;
}
-
+
+ function Param($name,$type='C')
+ {
+ $this->_pnum += 1;
+ return '$'.$this->_pnum;
+ }
+
function MetaIndexes ($table, $primary = FALSE, $owner = false)
{
global $ADODB_FETCH_MODE;
@@ -721,6 +726,7 @@
// returns queryID or false
function _query($sql,$inputarr=false)
{
+ $this->_pnum = 0;
$this->_errorMsg = false;
if ($inputarr) {
/*
@@ -898,6 +904,7 @@
$row = ADORecordSet::GetRowAssoc($upper);
return $row;
}
+
function _initrs()
{
@@ -950,8 +957,8 @@
function _decode($blob)
{
if ($blob === NULL) return NULL;
-
eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";');
- return $realblob;
+//
eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";');
+ return pg_unescape_bytea($blob);
}
function _fixblobs()
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -21,6 +21,59 @@
var $hasLimit = true; // set to true for pgsql 6.5+ only. support
pgsql/mysql SELECT * FROM TABLE LIMIT 10
var $ansiOuter = true;
var $charSet = true; //set to true for Postgres 7 and above - PG client
supports encodings
+ // Richard 3/18/2012 - Modified SQL to return SERIAL type correctly
AS old driver no longer return SERIAL as data type.
+ var $metaColumnsSQL =
+ "SELECT a.attname,
+ CASE
+
WHEN x.sequence_name != '' THEN 'SERIAL'
+
ELSE t.typname
+ END AS
typname,
+
a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,a.attnum
+ FROM pg_class c, pg_attribute a
+ JOIN pg_type t ON a.atttypid =
t.oid
+ LEFT JOIN
+ (SELECT
c.relname as sequence_name,
+
c1.relname as related_table,
+
a.attname as related_column
+ FROM
pg_class c
+ JOIN
pg_depend d ON d.objid = c.oid
+ LEFT
JOIN pg_class c1 ON d.refobjid = c1.oid
+ LEFT
JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum)
+ WHERE
c.relkind = 'S' AND c1.relname = '%s') x
+ ON
x.related_column= a.attname
+ WHERE c.relkind in ('r','v')
AND
+
(c.relname='%s' or c.relname = lower('%s')) AND
+
a.attname not like '....%%' AND
+
a.attnum > 0 AND
+
a.attrelid = c.oid
+ ORDER BY a.attnum";
+
+ // used when schema defined
+ var $metaColumnsSQL1 = "
+ SELECT a.attname,
+ CASE
+
WHEN x.sequence_name != '' THEN 'SERIAL'
+
ELSE t.typname
+ END AS
typname,
+
a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum
+ FROM pg_class c, pg_namespace
n, pg_attribute a
+ JOIN pg_type t ON a.atttypid =
t.oid
+ LEFT JOIN
+ (SELECT
c.relname as sequence_name,
+
c1.relname as related_table,
+
a.attname as related_column
+ FROM
pg_class c
+ JOIN
pg_depend d ON d.objid = c.oid
+ LEFT
JOIN pg_class c1 ON d.refobjid = c1.oid
+ LEFT
JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum)
+ WHERE
c.relkind = 'S' AND c1.relname = '%s') x
+ ON
x.related_column= a.attname
+ WHERE c.relkind in ('r','v')
AND (c.relname='%s' or c.relname = lower('%s'))
+ AND
c.relnamespace=n.oid and n.nspname='%s'
+ AND
a.attname not like '....%%' AND a.attnum > 0
+ AND
a.atttypid = t.oid AND a.attrelid = c.oid
+ ORDER BY a.attnum";
+
function ADODB_postgres7()
{
@@ -146,6 +199,8 @@
// We don't have native support for parameterized
queries, so let's emulate it at the parent
return ADODB_postgres64::_query($sql, $inputarr);
}
+
+ $this->_pnum = 0;
$this->_errorMsg = false;
// -- added Cristiano da Cunha Duarte
if ($inputarr) {
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-postgres8.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-postgres8.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-postgres8.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
- V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+ V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Added: trunk/phpgwapi/inc/adodb/drivers/adodb-postgres9.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-postgres9.inc.php
(rev 0)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-postgres9.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -0,0 +1,57 @@
+<?php
+/*
+ V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights
reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4.
+
+ Postgres9 support.
+ 01 Dec 2011: gherteg added support for retrieving insert IDs from tables
without OIDs
+*/
+
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
+include_once(ADODB_DIR."/drivers/adodb-postgres7.inc.php");
+
+class ADODB_postgres9 extends ADODB_postgres7 {
+ var $databaseType = 'postgres9';
+
+ function ADODB_postgres9()
+ {
+ $this->ADODB_postgres7();
+ }
+
+ // Don't use OIDs, as they typically won't be there, and
+ // they're not what the application wants back, anyway.
+ function _insertid($table,$column)
+ {
+ return empty($table) || empty($column)
+ ? $this->GetOne("SELECT lastval()")
+ : $this->GetOne("SELECT
currval(pg_get_serial_sequence('$table','$column'))");
+ }
+}
+
+/*--------------------------------------------------------------------------------------
+ Class Name: Recordset
+--------------------------------------------------------------------------------------*/
+
+class ADORecordSet_postgres9 extends ADORecordSet_postgres7{
+ var $databaseType = "postgres9";
+
+ function ADORecordSet_postgres9($queryID,$mode=false)
+ {
+ $this->ADORecordSet_postgres7($queryID,$mode);
+ }
+}
+
+class ADORecordSet_assoc_postgres9 extends ADORecordSet_postgres7{
+ var $databaseType = "postgres9";
+
+ function ADORecordSet_assoc_postgres9($queryID,$mode=false)
+ {
+ $this->ADORecordSet_postgres7($queryID,$mode);
+ }
+}
+?>
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-proxy.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-proxy.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-proxy.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-sapdb.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-sapdb.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-sapdb.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-sqlanywhere.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-sqlanywhere.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-sqlanywhere.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). All
rights
+version V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All
rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
Modified: trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite.inc.php 2013-09-27
13:24:08 UTC (rev 11337)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -1,6 +1,6 @@
<?php
/*
-V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights
reserved.
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
@@ -104,7 +104,8 @@
$fld->max_length = $size;
$fld->not_null = $r['notnull'];
$fld->default_value = $r['dflt_value'];
- $fld->scale = 0;
+ $fld->scale = 0;
+ if (isset($r['pk']) && $r['pk']) $fld->primary_key=1;
if ($save == ADODB_FETCH_NUM) $arr[] = $fld;
else $arr[strtoupper($fld->name)] = $fld;
}
Added: trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite3.inc.php
===================================================================
--- trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite3.inc.php
(rev 0)
+++ trunk/phpgwapi/inc/adodb/drivers/adodb-sqlite3.inc.php 2013-09-27
13:29:42 UTC (rev 11338)
@@ -0,0 +1,431 @@
+<?php
+/*
+V5.18 3 Sep 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights
reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+
+ Latest version is available at http://adodb.sourceforge.net
+
+ SQLite info: http://www.hwaci.com/sw/sqlite/
+
+ Install Instructions:
+ ====================
+ 1. Place this in adodb/drivers
+ 2. Rename the file, remove the .txt prefix.
+*/
+
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
+// class ADODB_sqlite extends ADOConnection { **change
+class ADODB_sqlite3 extends ADOConnection {
+ //var $databaseType = "sqlite"; **change
+ var $databaseType = "sqlite3";
+ var $replaceQuote = "''"; // string to use to replace quotes
+ var $concat_operator='||';
+ var $_errorNo = 0;
+ var $hasLimit = true;
+ var $hasInsertID = true; /// supports autoincrement ID?
+ var $hasAffectedRows = true; /// supports affected rows for
update/delete?
+ var $metaTablesSQL = "SELECT name FROM sqlite_master WHERE type='table'
ORDER BY name";
+ var $sysDate = "adodb_date('Y-m-d')";
+ var $sysTimeStamp = "adodb_date('Y-m-d H:i:s')";
+ var $fmtTimeStamp = "'Y-m-d H:i:s'";
+
+ //function ADODB_sqlite3() **change
+ function ADODB_sqlite3()
+ {
+ }
+
+/*
+ function __get($name)
+ {
+ switch($name) {
+ case 'sysDate': return "'".date($this->fmtDate)."'";
+ case 'sysTimeStamp' : return "'".date($this->sysTimeStamp)."'";
+ }
+ }*/
+
+ function ServerInfo()
+ {
+ $arr['version'] = $this->_connectionID->version(); //**tochange
+ $arr['description'] = 'SQLite 3'; //**tochange
+ //$arr['encoding'] = sqlite_libencoding();//**tochange
+ return $arr;
+ }
+
+ function BeginTrans()
+ {
+ if ($this->transOff) return true;
+ $ret = $this->Execute("BEGIN TRANSACTION");
+ $this->transCnt += 1;
+ return true;
+ }
+
+ function CommitTrans($ok=true)
+ {
+ if ($this->transOff) return true;
+ if (!$ok) return $this->RollbackTrans();
+ $ret = $this->Execute("COMMIT");
+ if ($this->transCnt>0)$this->transCnt -= 1;
+ return !empty($ret);
+ }
+
+ function RollbackTrans()
+ {
+ if ($this->transOff) return true;
+ $ret = $this->Execute("ROLLBACK");
+ if ($this->transCnt>0)$this->transCnt -= 1;
+ return !empty($ret);
+ }
+
+ // mark newnham
+ function MetaColumns($table, $normalize=true)
+ {
+ global $ADODB_FETCH_MODE;
+ $false = false;
+ $save = $ADODB_FETCH_MODE;
+ $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+ if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
+ $rs = $this->Execute("PRAGMA table_info('$table')");
+ if (isset($savem)) $this->SetFetchMode($savem);
+ if (!$rs) {
+ $ADODB_FETCH_MODE = $save;
+ return $false;
+ }
+ $arr = array();
+ while ($r = $rs->FetchRow()) {
+
+ $type = explode('(',$r['type']);
+ $size = '';
+ if (sizeof($type)==2)
+ $size = trim($type[1],')');
+ $fn = strtoupper($r['name']);
+ $fld = new ADOFieldObject;
+ $fld->name = $r['name'];
+ $fld->type = $type[0];
+ $fld->max_length = $size;
+ $fld->not_null = $r['notnull'];
+ $fld->default_value = $r['dflt_value'];
+ $fld->scale = 0;
+ if (isset($r['pk']) && $r['pk']) $fld->primary_key=1;
+ if ($save == ADODB_FETCH_NUM) $arr[] = $fld;
+ else $arr[strtoupper($fld->name)] = $fld;
+ }
+ $rs->Close();
+ $ADODB_FETCH_MODE = $save;
+ return $arr;
+ }
+
+ function _init($parentDriver)
+ {
+
+ $parentDriver->hasTransactions = false;
+ $parentDriver->hasInsertID = true;
+ }
+
+ function _insertid()
+ {
+ //return sqlite_last_insert_rowid($this->_connectionID)->;
//**change
+ return $this->_connectionID->lastInsertRowID();
+ }
+
+ function _affectedrows()
+ {
+ return $this->_connectionID->changes();
+ //return sqlite3_changes($this->_connectionID); //**tochange
+ }
+
+ function ErrorMsg()
+ {
+ if ($this->_logsql) return $this->_errorMsg;
+
+ return ($this->_errorNo) ? $this->ErrorNo() : ''; //**tochange?
+ }
+
+ function ErrorNo()
+ {
+ return $this->_connectionID->lastErrorCode(); //**tochange??
+ }
+
+ function SQLDate($fmt, $col=false)
+ {
+ $fmt = $this->qstr($fmt);
+ return ($col) ? "adodb_date2($fmt,$col)" : "adodb_date($fmt)";
+ }
+
+
+ function _createFunctions()
+ {
+ //@sqlite3_create_function($this->_connectionID, 'adodb_date',
'adodb_date', 1); *change
+ $this->_connectionID->createFunction('adodb_date',
'adodb_date', 1);
+
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11338] API: update adodb from upstream,
Sigurd Nes <=