diff --git a/phpgwapi/inc/adodb/adodb-csvlib.inc.php b/phpgwapi/inc/adodb/adodb-csvlib.inc.php index 17a606a3f9..80d0d8cb62 100644 --- a/phpgwapi/inc/adodb/adodb-csvlib.inc.php +++ b/phpgwapi/inc/adodb/adodb-csvlib.inc.php @@ -1,15 +1,19 @@ timeCreated = $ttl; + else { + $err = "Unable to unserialize recordset"; + //echo htmlspecialchars($text),' !--END--!
'; + } return $rs; } diff --git a/phpgwapi/inc/adodb/adodb-datadict.inc.php b/phpgwapi/inc/adodb/adodb-datadict.inc.php index ea68b3fe6e..80e77767a3 100644 --- a/phpgwapi/inc/adodb/adodb-datadict.inc.php +++ b/phpgwapi/inc/adodb/adodb-datadict.inc.php @@ -1,7 +1,7 @@ DB_ERROR_NOSUCHTABLE, '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*/' => DB_ERROR_ALREADY_EXISTS, @@ -96,7 +98,9 @@ function adodb_error_pg($errormsg) '/pg_atoi: error in .*: can\'t parse /' => DB_ERROR_INVALID_NUMBER, '/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/' => DB_ERROR_NOSUCHFIELD, '/parser: parse error at or near \"/' => DB_ERROR_SYNTAX, - '/referential integrity violation/' => DB_ERROR_CONSTRAINT + '/referential integrity violation/' => DB_ERROR_CONSTRAINT, + '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/' + => DB_ERROR_ALREADY_EXISTS ); reset($error_regexps); while (list($regexp,$code) = each($error_regexps)) { diff --git a/phpgwapi/inc/adodb/adodb-errorhandler.inc.php b/phpgwapi/inc/adodb/adodb-errorhandler.inc.php index c5ed4cc307..ff8c35059a 100644 --- a/phpgwapi/inc/adodb/adodb-errorhandler.inc.php +++ b/phpgwapi/inc/adodb/adodb-errorhandler.inc.php @@ -1,6 +1,6 @@ Execute("select * from adoxyz"); foreach($rs as $k => $v) { @@ -19,6 +20,7 @@ Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2 */ + class ADODB_Iterator implements Iterator { private $rs; @@ -59,9 +61,16 @@ function __toString() { - return 'ADODB Iterator'; + if (isset($rs->databaseType)) $s = ' for '.$rs->databaseType; + else $s = ''; + + return 'ADODB Iterator'.$s; + } + + function hasMore() + { + return !$this->rs->EOF; } - } diff --git a/phpgwapi/inc/adodb/adodb-lib.inc.php b/phpgwapi/inc/adodb/adodb-lib.inc.php index ede10e3917..f6046b5ca3 100644 --- a/phpgwapi/inc/adodb/adodb-lib.inc.php +++ b/phpgwapi/inc/adodb/adodb-lib.inc.php @@ -1,10 +1,13 @@ ".htmlspecialchars($zval).''; + $s .= "'; else $s .= "\n'; } else { if (strcasecmp($selected,$defstr)==0) - $s .= "'; + $s .= "'; else $s .= "\n'; } @@ -206,12 +209,13 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0) } if ($qryRecs !== false) return $qryRecs; } - //-------------------------------------------- // query rewrite failed - so try slower way... - // strip off unneeded ORDER BY - $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); + // strip off unneeded ORDER BY if no UNION + if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql; + else $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); + $rstest = &$zthis->Execute($rewritesql,$inputarr); if ($rstest) { $qryRecs = $rstest->RecordCount(); @@ -347,7 +351,7 @@ function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputar return $rsreturn; } -function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq=false) +function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq=false,$forcenulls=false) { if (!$rs) { printf(ADODB_BAD_RS,'GetUpdateSQL'); @@ -391,18 +395,23 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq $type = $rs->MetaType($field->type); // is_null requires php 4.0.4 - if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) || + if (($forcenulls && is_null($arrFields[$upperfname])) || $arrFields[$upperfname] === 'null') { $setFields .= $field->name . " = null, "; } else { if ($type == 'null') { $type = 'C'; } + + if (strpos($upperfname,' ') !== false) + $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote; + else + $fnameq = $upperfname; //we do this so each driver can customize the sql for //DB specific column types. //Oracle needs BLOB types to be handled with a returning clause //postgres has special needs as well - $setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname, + $setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname, $fnameq, $arrFields, $magicq); } } @@ -439,9 +448,9 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq } } -function adodb_key_exists($key, &$arr) +function adodb_key_exists($key, &$arr,$forcenulls=false) { - if (!defined('ADODB_FORCE_NULLS')) { + if (!$forcenulls) { // the following is the old behaviour where null or empty fields are ignored return (!empty($arr[$key])) || (isset($arr[$key]) && strlen($arr[$key])>0); } @@ -459,7 +468,7 @@ function adodb_key_exists($key, &$arr) * * */ -function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) +function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false,$forcenulls=false) { $tableName = ''; $values = ''; @@ -498,13 +507,19 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) // Set the counter for the number of fields that will be inserted. $fieldInsertedCount++; + + if (strpos($upperfname,' ') !== false) + $fnameq = $zthis->nameQuote.$upperfname.$zthis->nameQuote; + else + $fnameq = $upperfname; + // Get the name of the fields to insert - $fields .= $field->name . ", "; + $fields .= $fnameq . ", "; $type = $recordSet->MetaType($field->type); - if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) || + if (($forcenulls && is_null($arrFields[$upperfname])) || $arrFields[$upperfname] === 'null') { $values .= "null, "; } else { @@ -512,7 +527,7 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) //DB specific column types. //Oracle needs BLOB types to be handled with a returning clause //postgres has special needs as well - $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, + $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, $fnameq, $arrFields, $magicq); } } @@ -553,7 +568,7 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) * @return string * */ -function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $arrFields, $magicq) +function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $fnameq, $arrFields, $magicq) { $sql = ''; @@ -570,16 +585,22 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $arrFields, $mag if ($action == 'I') { $sql = 'empty_blob(), '; } else { - $sql = $fname. '=empty_blob(), '; + $sql = $fnameq. '=empty_blob(), '; } //add the variable to the returning clause array //so the user can build this later in //case they want to add more to it $zthis->_returningArray[$fname] = ':xx'.$fname.'xx'; + } else if (empty($arrFields[$fname])){ + if ($action == 'I') { + $sql = 'empty_blob(), '; + } else { + $sql = $fnameq. '=empty_blob(), '; + } } else { //this is to maintain compatibility //with older adodb versions. - $sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false); + $sql = _adodb_column_sql($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq,false); } break; @@ -593,7 +614,7 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $arrFields, $mag if ($action == 'I') { $sql = ':xx'.$fname.'xx, '; } else { - $sql = $fname.'=:xx'.$fname.'xx, '; + $sql = $fnameq.'=:xx'.$fname.'xx, '; } //add the variable to the returning clause array //so the user can build this later in @@ -602,19 +623,19 @@ function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $arrFields, $mag } else { //this is to maintain compatibility //with older adodb versions. - $sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false); + $sql = _adodb_column_sql($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq,false); } break; default: - $sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false); + $sql = _adodb_column_sql($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq,false); break; } return $sql; } -function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, $recurse=true) +function _adodb_column_sql(&$zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq, $recurse=true) { if ($recurse) { @@ -623,13 +644,13 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, if ($type == 'L') $type = 'C'; break; case 'oci8': - return _adodb_column_sql_oci8($zthis, $action, $type, $fname, $arrFields, $magicq); + return _adodb_column_sql_oci8($zthis, $action, $type, $fname, $fnameq, $arrFields, $magicq); } } $sql = ''; - + switch($type) { case "C": case "X": @@ -637,7 +658,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, if ($action == 'I') { $sql = $zthis->qstr($arrFields[$fname],$magicq) . ", "; } else { - $sql .= $fname . "=" . $zthis->qstr($arrFields[$fname],$magicq) . ", "; + $sql .= $fnameq . "=" . $zthis->qstr($arrFields[$fname],$magicq) . ", "; } break; @@ -645,7 +666,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, if ($action == 'I') { $sql = $zthis->DBDate($arrFields[$fname]) . ", "; } else { - $sql .= $fname . "=" . $zthis->DBDate($arrFields[$fname]) . ", "; + $sql .= $fnameq . "=" . $zthis->DBDate($arrFields[$fname]) . ", "; } break; @@ -653,7 +674,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, if ($action == 'I') { $sql = $zthis->DBTimeStamp($arrFields[$fname]) . ", "; } else { - $sql .= $fname . "=" . $zthis->DBTimeStamp($arrFields[$fname]) . ", "; + $sql .= $fnameq . "=" . $zthis->DBTimeStamp($arrFields[$fname]) . ", "; } break; @@ -665,7 +686,7 @@ function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, if ($action == 'I') { $sql .= $val . ", "; } else { - $sql .= $fname . "=" . $val . ", "; + $sql .= $fnameq . "=" . $val . ", "; } break; } diff --git a/phpgwapi/inc/adodb/adodb-pager.inc.php b/phpgwapi/inc/adodb/adodb-pager.inc.php index 355806dac8..f4d2525eb4 100644 --- a/phpgwapi/inc/adodb/adodb-pager.inc.php +++ b/phpgwapi/inc/adodb/adodb-pager.inc.php @@ -1,6 +1,7 @@ trim(substr($sql,0,230)), - 'c'=>substr($sql,0,3900), 'd'=>$params,'e'=>$tracer,'f'=>round($time,6)); + 'c'=>substr($sql,0,3900), 'd'=>$params,'e'=>$tracer,'f'=>adodb_round($time,6)); //var_dump($arr); $saved = $conn->debug; $conn->debug = 0; @@ -402,7 +408,7 @@ Committed_AS: 348732 kB $suffix = ' ... String too long for GET parameter: '.strlen($prefix).''; $prefix = ''; } - $s .= "
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com)
+V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com)
This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.
-Useful ADOdb links: Download Other Docs + + +
Kindly note that the ADOdb home page has moved to http://adodb.sourceforge.net/ because of the persistent + unreliability of http://php.weblogs.com. Please change your links! |
Useful ADOdb links: Download Other Docs
Introduction Feature requests and bug reports can be emailed to jlim#natsoft.com.my
or posted to the ADOdb Help forums at http://phplens.com/lens/lensforum/topics.php?id=4. Make sure you are running PHP 4.0.4 or later.
+ Make sure you are running PHP 4.0.5 or later.
Unpack all the files into a directory accessible by your webserver. To test, try modifying some of the tutorial examples. Make sure you customize
the connection settings correctly. You can debug using $db->debug = true as shown below: MySQL connections are very straightforward, and the parameters are identical
@@ -262,7 +267,7 @@ different databases. The solution is to always use different userid's for differ
b. the classical 4 parameters:
Unique Features
@@ -181,7 +185,7 @@ visit http://php.weblog
Installation Guide
-Examples of Connecting to Databases
MySQL and Most Other Database Drivers
$conn->PConnect('localhost','userid','password','database');
-
+
LDAP
Here is an example of querying a LDAP server. Thanks to Josh Eldridge for the driver and this example:
@@ -295,10 +300,8 @@ if ($rs) $rs->MoveNext(); } -$rs = $ldap->Execute( $filter ); print_r( $ldap->GetArray( $filter ) ); -$rs = $ldap->Execute( $filter ); print_r( $ldap->GetRow( $filter ) ); $ldap->Close(); @@ -311,30 +314,35 @@ You define the database in the $host parameter: $conn->PConnect('localhost:c:\ibase\employee.gdb','sysdba','masterkey');
$conn = &ADONewConnection('sqlite'); $conn->PConnect('c:\path\to\sqlite.db'); # sqlite will create if does not exist-
With Oracle, you can connect in multiple ways.
+With oci8, you can connect in multiple ways. Note that oci8 works fine with +newer versions of the Oracle, eg. 9i and 10g.
a. PHP and Oracle reside on the same machine, use default SID.
$conn->Connect(false, 'scott', 'tiger');-
b. TNS Name defined, eg. 'myTNS'
-$conn->PConnect(false, 'scott', 'tiger', 'myTNS'); -+
b. TNS Name defined in tnsnames.ora (or ONAMES or HOSTNAMES), eg. 'myTNS'
+$conn->PConnect(false, 'scott', 'tiger', 'myTNS');
or
$conn->PConnect('myTNS', 'scott', 'tiger');
c. Host Address and SID
$conn->Connect('192.168.0.1', 'scott', 'tiger', 'SID');
d. Host Address and Service Name
$conn->Connect('192.168.0.1', 'scott', 'tiger', 'servicename');+
e. Oracle connection string: +
$cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port)) + (CONNECT_DATA=(SID=$sid)))"; + $conn->Connect($cstr, 'scott', 'tiger'); +
ODBC DSN's can be created in the ODBC control panel, or you can use a DSN-less connection.To use DSN-less connections with ODBC you need PHP 4.3 or later.
-For Microsoft Access:
+For Microsoft Access:
$db =& ADONewConnection('access'); $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;"; @@ -346,6 +354,11 @@ For Microsoft SQL Server: $dsn = "Driver={SQL Server};Server=localhost;Database=northwind;"; $db->Connect($dsn,'userid','password');+or if you prefer to use the mssql extension (which is limited to mssql 6.5 functionality): +
+ $db =& ADONewConnection('mssql'); + $db->Execute("localhost', 'userid', 'password', 'northwind'); +DSN-less Connections with ADO
The fastest way to access the fields is by accessing the array $recordset->fields directly. Also set the global variables $ADODB_FETCH_MODE = ADODB_FETCH_NUM, and (for oci8, ibase/firebird and odbc) $ADODB_COUNTRECS = false - before you connect to your database. At the time of writing (Dec 2003).
+ before you connect to your database.Consider using bind parameters if your database supports it, as it improves query plan reuse. Use ADOdb's performance tuning system to identify bottlenecks quickly. At the time of writing (Dec 2003), this means oci8 and odbc drivers.
@@ -470,6 +483,8 @@ catch exceptions on errors as they occur.Note that reaching EOF is not considered an error nor an exception.
Name | @@ -572,19 +587,11 @@ catch exceptions on errors as they occur.Interbase client | Unix and Windows | ||||||||||
informix72 | -C | -Informix databases before Informix 7.3 that do no support - SELECT FIRST. | -Y/N | -Informix client | -Unix and Windows | -|||||||
informix | C | -Generic informix driver. | +Generic informix driver. Use this if you are using Informix 7.3 or later. | Y/N | Informix client | Unix and Windows | @@ -637,7 +644,7 @@ catch exceptions on errors as they occur.A | MySQL without transaction support. You can also set $db->clientFlags before connecting. | -Y/N | +Y | MySQL client | Unix and Windows |
sqlite | B | -SQLite. Only tested on PHP5. | +SQLite. | Y | - | Unix and Windows. |
||||||
sqlitepo | +B | +Portable SQLite driver. This is because assoc mode does not work like other drivers in sqlite.
+ Namely, when selecting (joining) multiple tables, the table
+ names are included in the assoc keys in the "sqlite" driver. + In "sqlitepo" driver, the table names are stripped from the returned column names. + When this results in a conflict, the first field get preference. + |
+ Y | +- | + Unix and Windows. |
+ |||||||
sybase | C | @@ -1096,6 +1118,10 @@ $conn->Execute($updateSQL); # Update the record in the database $conn->Close(); ?> +GetInsertSQL/GetUpdateSQL ignore all empty fields (they are not added to the SQL generated). +To explicitly force a field to be set to "null", set the constant define('ADODB_FORCE_NULLS',1) before +you call the functions. +
Kindly note that the ADOdb home page has moved to http://adodb.sourceforge.net/ because of the persistent + unreliability of http://php.weblogs.com. Please change your links! |
Useful ADOdb links: Download Other Docs
This documentation describes a PHP class library to automate the creation of tables, indexes and foreign key constraints portably for multiple databases. Richard Tango-Lowy and Dan Cech @@ -138,7 +140,7 @@ field size. Then optional keywords in $otheroptions:
NAME C(32) CONSTRAINTS 'FOREIGN KEY REFERENCES reftable' "; -Note that if you have special characters in the field name (e.g. My Date), you should enclose it in back-quotes. Normally field names are not case-sensitive, but if you enclose it in back-quotes, some databases treat the names as case-sensitive, and some don't. So be careful.
+Note that if you have special characters in the field name (e.g. My Date), you should enclose it in back-quotes. Normally field names are not case-sensitive, but if you enclose it in back-quotes, some databases will treat the names as case-sensitive (eg. Oracle) , and others won't. So be careful.
The $taboptarray is the 3rd parameter of the CreateTableSQL function. This contains table specific settings. Legal keywords include:
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
+V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.
-Useful ADOdb links: Download Other Docs +
Kindly note that the ADOdb home page has moved to http://adodb.sourceforge.net/ because of the persistent + unreliability of http://php.weblogs.com. Please change your links! |
Useful ADOdb links: Download Other Docs
This module, part of the ADOdb package, provides both CLI and HTML interfaces for viewing key performance indicators of your database. This is very useful diff --git a/phpgwapi/inc/adodb/docs/docs-session.htm b/phpgwapi/inc/adodb/docs/docs-session.htm index 0a7809b655..96571b81b7 100644 --- a/phpgwapi/inc/adodb/docs/docs-session.htm +++ b/phpgwapi/inc/adodb/docs/docs-session.htm @@ -11,10 +11,12 @@
-V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my) +V4.50 6 July 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products. -
Useful ADOdb links: Download Other Docs +
Kindly note that the ADOdb home page has moved to http://adodb.sourceforge.net/ because of the persistent + unreliability of http://php.weblogs.com. Please change your links! |
Useful ADOdb links: Download Other Docs
diff --git a/phpgwapi/inc/adodb/docs/tips_portable_sql.htm b/phpgwapi/inc/adodb/docs/tips_portable_sql.htm index 2670423331..2d08bbb1be 100644 --- a/phpgwapi/inc/adodb/docs/tips_portable_sql.htm +++ b/phpgwapi/inc/adodb/docs/tips_portable_sql.htm @@ -17,7 +17,7 @@ Dimension in my Mac days, to the databases I currently use, which are: Oracle, FoxPro, Access, MS SQL Server and MySQL. Although most of the advice here applies to using SQL with Perl, Python and other programming languages, I will focus on PHP and how - the ADOdb database abstraction library + the ADOdb database abstraction library offers some solutions.
Most database vendors practice product lock-in. The best or fastest way to
do things is often implemented using proprietary extensions to SQL. This makes
diff --git a/phpgwapi/inc/adodb/drivers/adodb-access.inc.php b/phpgwapi/inc/adodb/drivers/adodb-access.inc.php
index ebaaf810bd..9a3f200a8c 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-access.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-access.inc.php
@@ -1,16 +1,18 @@
ADODB_ado();
+ $this->ADODB_ado();
}
function _insertid()
{
- return $this->GetOne('select @@identity');
+ return $this->GetOne('select @@identity');
}
function _affectedrows()
{
- return $this->GetOne('select @@rowcount');
+ return $this->GetOne('select @@rowcount');
}
-}
-
-class ADORecordSet_ado_mssql extends ADORecordSet_ado {
+ function MetaColumns($table)
+ {
+ $table = strtoupper($table);
+ $arr= array();
+ $dbc = $this->_connectionID;
+
+ $osoptions = array();
+ $osoptions[0] = null;
+ $osoptions[1] = null;
+ $osoptions[2] = $table;
+ $osoptions[3] = null;
+
+ $adors=@$dbc->OpenSchema(4, $osoptions);//tables
+
+ if ($adors){
+ while (!$adors->EOF){
+ $fld = new ADOFieldObject();
+ $c = $adors->Fields(3);
+ $fld->name = $c->Value;
+ $fld->type = 'CHAR'; // cannot discover type in ADO!
+ $fld->max_length = -1;
+ $arr[strtoupper($fld->name)]=$fld;
+
+ $adors->MoveNext();
+ }
+ $adors->Close();
+ }
+
+ return $arr;
+ }
+ }
+
+ class ADORecordSet_ado_mssql extends ADORecordSet_ado {
var $databaseType = 'ado_mssql';
function ADORecordSet_ado_mssql($id,$mode=false)
{
- return $this->ADORecordSet_ado($id,$mode);
+ return $this->ADORecordSet_ado($id,$mode);
}
}
?>
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php b/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
index 208d5e7d91..c130afaaa9 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-borland_ibase.inc.php
@@ -1,17 +1,20 @@
ADODB_ibase();
}
+ function BeginTrans()
+ {
+ if ($this->transOff) return true;
+ $this->transCnt += 1;
+ $this->autoCommit = false;
+ $this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID);
+ return $this->_transactionID;
+ }
+
function ServerInfo()
{
$arr['dialect'] = $this->dialect;
diff --git a/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php b/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php
index 3a1ac86acd..db65a9e65a 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-csv.inc.php
@@ -1,6 +1,6 @@
ADODB_ibase();
diff --git a/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php b/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php
index e9f5e83023..71078d8bcf 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-ibase.inc.php
@@ -1,11 +1,11 @@
Execute("insert into table (id, col1,...) values ($id, $val1,...)");
*/
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
class ADODB_ibase extends ADOConnection {
var $databaseType = "ibase";
var $dataProvider = "ibase";
var $replaceQuote = "''"; // string to use to replace quotes
- var $ibase_timefmt = '%Y-%m-%d'; // For hours,mins,secs change to '%Y-%m-%d %H:%M:%S';
+ var $ibase_datefmt = '%Y-%m-%d'; // For hours,mins,secs change to '%Y-%m-%d %H:%M:%S';
var $fmtDate = "'Y-m-d'";
+ var $ibase_timestampfmt = "%Y-%m-%d %H:%M:%S";
+ var $ibase_timefmt = "%H:%M:%S";
var $fmtTimeStamp = "'Y-m-d, H:i:s'";
var $concat_operator='||';
var $_transactionID;
@@ -42,7 +46,7 @@ class ADODB_ibase extends ADOConnection {
var $_bindInputArray = true;
var $buffers = 0;
var $dialect = 1;
- var $sysDate = "cast('TODAY' as date)";
+ var $sysDate = "cast('TODAY' as timestamp)";
var $sysTimeStamp = "cast('NOW' as timestamp)";
var $ansiOuter = true;
var $hasAffectedRows = false;
@@ -109,6 +113,23 @@ class ADODB_ibase extends ADOConnection {
return $ret;
}
+ // there are some compat problems with ADODB_COUNTRECS=false and $this->_logsql currently.
+ // it appears that ibase extension cannot support multiple concurrent queryid's
+ function &_Execute($sql,$inputarr=false)
+ {
+ global $ADODB_COUNTRECS;
+
+ if ($this->_logsql) {
+ $savecrecs = $ADODB_COUNTRECS;
+ $ADODB_COUNTRECS = true; // force countrecs
+ $ret =& ADOConnection::_Execute($sql,$inputarr);
+ $ADODB_COUNTRECS = $savecrecs;
+ } else {
+ $ret =& ADOConnection::_Execute($sql,$inputarr);
+ }
+ return $ret;
+ }
+
function RollbackTrans()
{
if ($this->transOff) return true;
@@ -237,28 +258,14 @@ class ADODB_ibase extends ADOConnection {
}
// returns true or false
- function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
+ function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false)
{
- if (!function_exists('ibase_pconnect')) return false;
+ if (!function_exists('ibase_pconnect')) return null;
if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
- $this->_connectionID = ibase_connect($argHostname,$argUsername,$argPassword,$this->charSet,$this->buffers,$this->dialect);
- if ($this->dialect != 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
- $this->replaceQuote = "''";
- }
- if ($this->_connectionID === false) {
- $this->_handleerror();
- return false;
- }
+ $fn = ($persist) ? 'ibase_pconnect':'ibase_connect';
+ $this->_connectionID = $fn($argHostname,$argUsername,$argPassword,
+ $this->charSet,$this->buffers,$this->dialect);
- ibase_timefmt($this->ibase_timefmt);
- return true;
- }
- // returns true or false
- function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
- {
- if (!function_exists('ibase_pconnect')) return false;
- if ($argDatabasename) $argHostname .= ':'.$argDatabasename;
- $this->_connectionID = ibase_pconnect($argHostname,$argUsername,$argPassword,$this->charSet,$this->buffers,$this->dialect);
if ($this->dialect != 1) { // http://www.ibphoenix.com/ibp_60_del_id_ds.html
$this->replaceQuote = "''";
}
@@ -267,8 +274,29 @@ class ADODB_ibase extends ADOConnection {
return false;
}
- ibase_timefmt($this->ibase_timefmt);
+ // PHP5 change.
+ if (function_exists('ibase_timefmt')) {
+ ibase_timefmt($this->ibase_datefmt,IBASE_DATE );
+ if ($this->dialect == 1) ibase_timefmt($this->ibase_datefmt,IBASE_TIMESTAMP );
+ else ibase_timefmt($this->ibase_timestampfmt,IBASE_TIMESTAMP );
+ ibase_timefmt($this->ibase_timefmt,IBASE_TIME );
+ } else {
+ ini_set("ibase.timestampformat", $this->base_timestampfmt);
+ ini_set("ibase.dateformat", $this->ibase_datefmt);
+ ini_set("ibase.timeformat", $this->ibase_timefmt);
+ }
+ //you can use
+ /*
+ ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
+ ini_set("ibase.dateformat", $this->ibase_datefmt);
+ ini_set("ibase.timeformat", $this->ibase_timefmt);
+ */
return true;
+ }
+ // returns true or false
+ function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
+ {
+ return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true);
}
function Prepare($sql)
@@ -293,7 +321,6 @@ class ADODB_ibase extends ADOConnection {
if (is_array($sql)) {
$fn = 'ibase_execute';
$sql = $sql[1];
-
if (is_array($iarr)) {
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
@@ -318,7 +345,7 @@ class ADODB_ibase extends ADOConnection {
if (is_array($iarr)) {
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
- if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
+ if (sizeof($iarr) == 0) $iarr[0] = ''; // PHP5 compat hack
$fnarr =& array_merge( array($conn,$sql) , $iarr);
$ret = call_user_func_array($fn,$fnarr);
} else {
@@ -350,7 +377,7 @@ class ADODB_ibase extends ADOConnection {
}
//OPN STUFF start
- function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $isInterbase6)
+ function _ConvertFieldType(&$fld, $ftype, $flen, $fscale, $fsubtype, $fprecision, $dialect3)
{
$fscale = abs($fscale);
$fld->max_length = $flen;
@@ -358,7 +385,7 @@ class ADODB_ibase extends ADOConnection {
switch($ftype){
case 7:
case 8:
- if ($isInterbase6) {
+ if ($dialect3) {
switch($fsubtype){
case 0:
$fld->type = ($ftype == 7 ? 'smallint' : 'integer');
@@ -385,7 +412,7 @@ class ADODB_ibase extends ADOConnection {
}
break;
case 16:
- if ($isInterbase6) {
+ if ($dialect3) {
switch($fsubtype){
case 0:
$fld->type = 'decimal';
@@ -421,16 +448,18 @@ class ADODB_ibase extends ADOConnection {
}
break;
case 35:
- if ($isInterbase6) {
+ if ($dialect3) {
$fld->type = 'timestamp';
} else {
$fld->type = 'date';
}
break;
case 12:
- case 13:
$fld->type = 'date';
break;
+ case 13:
+ $fld->type = 'time';
+ break;
case 37:
$fld->type = 'varchar';
break;
@@ -461,13 +490,13 @@ class ADODB_ibase extends ADOConnection {
$retarr = array();
//OPN STUFF start
- $isInterbase6 = ($this->dialect==3 ? true : false);
+ $dialect3 = ($this->dialect==3 ? true : false);
//OPN STUFF end
while (!$rs->EOF) { //print_r($rs->fields);
$fld = new ADOFieldObject();
$fld->name = trim($rs->fields[0]);
//OPN STUFF start
- $this->_ConvertFieldType($fld, $rs->fields[7], $rs->fields[3], $rs->fields[4], $rs->fields[5], $rs->fields[6], $isInterbase6);
+ $this->_ConvertFieldType($fld, $rs->fields[7], $rs->fields[3], $rs->fields[4], $rs->fields[5], $rs->fields[6], $dialect3);
if (isset($rs->fields[1]) && $rs->fields[1]) {
$fld->not_null = true;
}
@@ -666,7 +695,7 @@ class ADODB_ibase extends ADOConnection {
Class Name: Recordset
--------------------------------------------------------------------------------------*/
-class ADORecordset_ibase extends ADORecordSet
+class ADORecordset_ibase extends ADORecordSet
{
var $databaseType = "ibase";
@@ -678,7 +707,7 @@ class ADORecordset_ibase extends ADORecordSet
global $ADODB_FETCH_MODE;
$this->fetchMode = ($mode === false) ? $ADODB_FETCH_MODE : $mode;
- return $this->ADORecordSet($id);
+ $this->ADORecordSet($id);
}
/* Returns: an object containing field information.
@@ -690,31 +719,47 @@ class ADORecordset_ibase extends ADORecordSet
{
$fld = new ADOFieldObject;
$ibf = ibase_field_info($this->_queryID,$fieldOffset);
- $fld->name = strtolower($ibf['alias']);
- if (empty($fld->name)) $fld->name = strtolower($ibf['name']);
+ switch (ADODB_ASSOC_CASE) {
+ case 2: // the default
+ $fld->name = ($ibf['alias']);
+ if (empty($fld->name)) $fld->name = ($ibf['name']);
+ break;
+ case 0:
+ $fld->name = strtoupper($ibf['alias']);
+ if (empty($fld->name)) $fld->name = strtoupper($ibf['name']);
+ break;
+ case 1:
+ $fld->name = strtolower($ibf['alias']);
+ if (empty($fld->name)) $fld->name = strtolower($ibf['name']);
+ break;
+ }
+
$fld->type = $ibf['type'];
$fld->max_length = $ibf['length'];
+
+ /* This needs to be populated from the metadata */
+ $fld->not_null = false;
+ $fld->has_default = false;
+ $fld->default_value = 'null';
return $fld;
}
function _initrs()
{
- $this->_numOfRows = -1;
- $this->_numOfFields = @ibase_num_fields($this->_queryID);
-
- // cache types for blob decode check
- for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
- $f1 = $this->FetchField($i);
- $this->_cacheType[] = $f1->type;
- }
+ $this->_numOfRows = -1;
+ $this->_numOfFields = @ibase_num_fields($this->_queryID);
+
+ // cache types for blob decode check
+ for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
+ $f1 = $this->FetchField($i);
+ $this->_cacheType[] = $f1->type;
+ }
}
function _seek($row)
{
return false;
}
-
-
function _fetch()
{
@@ -768,7 +813,7 @@ class ADORecordset_ibase extends ADORecordSet
}
}
- return $this->fields[$this->bind[strtoupper($colname)]];
+ return $this->fields[$this->bind[strtoupper($colname)]];
}
@@ -799,7 +844,7 @@ class ADORecordset_ibase extends ADORecordSet
case 'TIMESTAMP':
case 'DATE': return 'D';
-
+ case 'TIME': return 'T';
//case 'T': return 'T';
//case 'L': return 'L';
diff --git a/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php b/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php
index 228a406c29..f8b0bec8f9 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-informix.inc.php
@@ -1,6 +1,6 @@
SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs === false) return false;
+ $rspkey = $this->Execute(sprintf($this->metaPrimaryKeySQL,$table)); //Added to get primary key colno items
$retarr = array();
while (!$rs->EOF) { //print_r($rs->fields);
$fld = new ADOFieldObject();
$fld->name = $rs->fields[0];
$fld->type = $rs->fields[1];
+ $fld->primary_key=$rspkey->fields && array_search($rs->fields[4],$rspkey->fields); //Added to set primary key flag
$fld->max_length = $rs->fields[2];
if (trim($rs->fields[3]) != "AAAAAA 0") {
$fld->has_default = 1;
@@ -194,7 +207,7 @@ class ADODB_informix72 extends ADOConnection {
// returns true or false
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
- if (!function_exists('ifx_connect')) return false;
+ if (!function_exists('ifx_connect')) return null;
$dbs = $argDatabasename . "@" . $argHostname;
if ($argHostname) putenv("INFORMIXSERVER=$argHostname");
@@ -208,7 +221,7 @@ class ADODB_informix72 extends ADOConnection {
// returns true or false
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
- if (!function_exists('ifx_connect')) return false;
+ if (!function_exists('ifx_connect')) return null;
$dbs = $argDatabasename . "@" . $argHostname;
putenv("INFORMIXSERVER=".trim($argHostname));
diff --git a/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php b/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
index 8092899072..180335a977 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
@@ -1,6 +1,6 @@
_connectionID = mssql_connect($argHostname,$argUsername,$argPassword);
if ($this->_connectionID === false) return false;
if ($argDatabasename) return $this->SelectDB($argDatabasename);
@@ -446,7 +449,7 @@ order by constraint_name, referenced_table_name, keyno";
// returns true or false
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
- if (!function_exists('mssql_pconnect')) return false;
+ if (!function_exists('mssql_pconnect')) return null;
$this->_connectionID = mssql_pconnect($argHostname,$argUsername,$argPassword);
if ($this->_connectionID === false) return false;
@@ -771,7 +774,7 @@ class ADORecordset_mssql extends ADORecordSet {
$this->fields = @mssql_fetch_assoc($this->_queryID);
else {
$this->fields = @mssql_fetch_array($this->_queryID);
- if (is_array($$this->fields)) {
+ if (@is_array($$this->fields)) {
$fassoc = array();
foreach($$this->fields as $k => $v) {
if (is_integer($k)) continue;
diff --git a/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php b/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php
index c64119f141..a9f03e974a 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-mssqlpo.inc.php
@@ -1,6 +1,6 @@
metaTablesSQL;
+ if ($showSchema && is_string($showSchema)) {
+ $this->metaTablesSQL .= " from $showSchema";
+ }
+
if ($mask) {
- $save = $this->metaTablesSQL;
$mask = $this->qstr($mask);
$this->metaTablesSQL .= " like $mask";
}
$ret =& ADOConnection::MetaTables($ttype,$showSchema);
- if ($mask) {
- $this->metaTablesSQL = $save;
- }
+ $this->metaTablesSQL = $save;
return $ret;
}
@@ -148,13 +153,16 @@ class ADODB_mysql extends ADOConnection {
function GetOne($sql,$inputarr=false)
{
- $rs =& $this->SelectLimit($sql,1,-1,$inputarr);
- if ($rs) {
- $rs->Close();
- if ($rs->EOF) return false;
- return reset($rs->fields);
+ if (strncasecmp($sql,'sele',4) == 0) {
+ $rs =& $this->SelectLimit($sql,1,-1,$inputarr);
+ if ($rs) {
+ $rs->Close();
+ if ($rs->EOF) return false;
+ return reset($rs->fields);
+ }
+ } else {
+ return ADOConnection::GetOne($sql,$inputarr);
}
-
return false;
}
@@ -431,6 +439,8 @@ class ADODB_mysql extends ADOConnection {
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
{
$offsetStr =($offset>=0) ? "$offset," : '';
+ // jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
+ if ($nrows < 0) $nrows = '18446744073709551615';
if ($secs)
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr);
@@ -532,7 +542,6 @@ class ADORecordSet_mysql extends ADORecordSet{
function &FetchField($fieldOffset = -1)
{
-
if ($fieldOffset != -1) {
$o = @mysql_fetch_field($this->_queryID, $fieldOffset);
$f = @mysql_field_flags($this->_queryID,$fieldOffset);
diff --git a/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php b/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php
index 19ef810728..2ee13a4e6c 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-mysqli.inc.php
@@ -1,6 +1,6 @@
qstr(HTTP_GET_VARS['name'],get_magic_quotes_gpc());
function qstr($s, $magic_quotes = false)
{
- if (!$magic_quotes) {
- if (ADODB_PHPVER >= 0x5000) {
- // $this->_connectionID = $this->mysqli_resolve_link($this->_connectionID);
- return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'";
- }
- else
- {
- trigger_error("phpver < 5 not implemented", E_USER_ERROR);
- }
+ if (!$magic_quotes) {
+ if (PHP_VERSION >= 5)
+ return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'";
- if ($this->replaceQuote[0] == '\\')
- {
- $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
- }
+ if ($this->replaceQuote[0] == '\\')
+ $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
return "'".str_replace("'",$this->replaceQuote,$s)."'";
}
// undo magic quotes for "
@@ -632,10 +628,11 @@ class ADORecordSet_mysqli extends ADORecordSet{
function ADORecordSet_mysqli($queryID, $mode = false)
{
if ($mode === false)
- {
+ {
global $ADODB_FETCH_MODE;
$mode = $ADODB_FETCH_MODE;
- }
+ }
+
switch ($mode)
{
case ADODB_FETCH_NUM:
@@ -647,31 +644,26 @@ class ADORecordSet_mysqli extends ADORecordSet{
case ADODB_FETCH_DEFAULT:
case ADODB_FETCH_BOTH:
default:
- $this->fetchMode = MYSQLI_ASSOC;
+ $this->fetchMode = MYSQLI_BOTH;
break;
}
+
$this->ADORecordSet($queryID);
}
function _initrs()
{
- // mysqli_num_rows only return correct number, depens
- // on the use of mysql_store_result and mysql_use_result
- if (!$this->Connection->executeOnly) {
- $this->_numOfRows = @mysqli_num_rows($this->_queryID);
- $this->_numOfFields = @mysqli_num_fields($this->_queryID);
- }
- else {
- $this->_numOfRows = 0;
- $this->_numOfFields = 0;
- }
+ global $ADODB_COUNTRECS;
+
+ $this->_numOfRows = $ADODB_COUNTRECS ? @mysqli_num_rows($this->_queryID) : -1;
+ $this->_numOfFields = @mysqli_num_fields($this->_queryID);
}
function &FetchField($fieldOffset = -1)
{
$fieldnr = $fieldOffset;
if ($fieldOffset != -1) {
- $fieldOffset = mysqi_field_seek($this->_queryID, $fieldnr);
+ $fieldOffset = mysqli_field_seek($this->_queryID, $fieldnr);
}
$o = mysqli_fetch_field($this->_queryID);
return $o;
@@ -719,43 +711,25 @@ class ADORecordSet_mysqli extends ADORecordSet{
// Other functions return no or the wrong results.
function MoveNext()
{
- if ($this->EOF)
- return false;
- $this->_currentRow++;
- switch($this->fetchMode)
- {
- case MYSQLI_NUM:
- $this->fields = mysqli_fetch_array($this->_queryID);
- break;
- case MYSQLI_ASSOC:
- case MYSQLI_BOTH:
- $this->fields = mysqli_fetch_assoc($this->_queryID);
- break;
- default:
- }
- if (is_array($this->fields))
- return true;
- $this->EOF = true;
- return false;
+ if ($this->EOF) return false;
+ $this->_currentRow++;
+ $this->fields = mysqli_fetch_array($this->_queryID,$this->fetchMode);
+
+ if (is_array($this->fields)) return true;
+ $this->EOF = true;
+ return false;
}
function _fetch()
{
- // mysqli_fetch_array($this->_queryID, MYSQLI_NUM) does not
- // work (22-10-2003). But mysqli_fetch_array($this->_queryID) gives
- // int resulttype should default to MYSQLI_BOTH,but give MYSQLI_NUM.
-
- // $this->fields = mysqli_fetch_fields($this->_queryID);
- // $this->fields = mysqli_fetch_array($this->_queryID); //, $this->fetchMode);
-
- $this->fields = mysqli_fetch_assoc($this->_queryID); // $this->fetchMode);
- return is_array($this->fields);
+ $this->fields = mysqli_fetch_array($this->_queryID,$this->fetchMode);
+ return is_array($this->fields);
}
function _close()
{
- mysqli_free_result($this->_queryID);
- $this->_queryID = false;
+ mysqli_free_result($this->_queryID);
+ $this->_queryID = false;
}
function MetaType($t, $len = -1, $fieldobj = false)
diff --git a/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php b/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php
index 6b8b39529b..1b102389a4 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-mysqlt.inc.php
@@ -1,7 +1,7 @@
13 Nov 2000 jlim - removed all ora_* references.
*/
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
/*
NLS_Date_Format
Allows you to use a date format other than the Oracle Lite default. When a literal
@@ -35,6 +38,20 @@ NLS_DATE_FORMAT='RR-MM-DD'
You can also modify the date format using the ALTER SESSION command.
*/
+# define the LOB descriptor type for the given type
+# returns false if no LOB descriptor
+function oci_lob_desc($type) {
+ switch ($type) {
+ case OCI_B_BFILE: $result = OCI_D_FILE; break;
+ case OCI_B_CFILEE: $result = OCI_D_FILE; break;
+ case OCI_B_CLOB: $result = OCI_D_LOB; break;
+ case OCI_B_BLOB: $result = OCI_D_LOB; break;
+ case OCI_B_ROWID: $result = OCI_D_ROWID; break;
+ default: $result = false; break;
+ }
+ return $result;
+}
+
class ADODB_oci8 extends ADOConnection {
var $databaseType = 'oci8';
var $dataProvider = 'oci8';
@@ -67,6 +84,7 @@ class ADODB_oci8 extends ADOConnection {
var $NLS_DATE_FORMAT = 'YYYY-MM-DD'; // To include time, use 'RRRR-MM-DD HH24:MI:SS'
var $useDBDateFormatForTextInput=false;
var $datetime = false; // MetaType('DATE') returns 'D' (datetime==false) or 'T' (datetime == true)
+ var $_refLOBs = array();
// var $ansiOuter = true; // if oracle9
@@ -156,7 +174,7 @@ NATSOFT.DOMAIN =
*/
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$mode=0)
{
- if (!function_exists('OCIPLogon')) return false;
+ if (!function_exists('OCIPLogon')) return null;
$this->_errorMsg = false;
@@ -680,8 +698,9 @@ NATSOFT.DOMAIN =
Note that the order of parameters differs from OCIBindByName,
because we default the names to :0, :1, :2
*/
- function Bind(&$stmt,&$var,$size=4000,$type=false,$name=false)
+ function Bind(&$stmt,&$var,$size=4000,$type=false,$name=false,$isOutput=false)
{
+
if (!is_array($stmt)) return false;
if (($type == OCI_B_CURSOR) && sizeof($stmt) >= 5) {
@@ -689,15 +708,39 @@ NATSOFT.DOMAIN =
}
if ($name == false) {
- if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type);
+ 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
$stmt[2] += 1;
- } else if ($type == OCI_B_BLOB){
+ } else if (oci_lob_desc($type)) {
+ if ($this->debug) {
+ ADOConnection::outp("Bind: name = $name");
+ }
//we have to create a new Descriptor here
- $_blob = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
- $rez = OCIBindByName($stmt[1], ":".$name, &$_blob, -1, OCI_B_BLOB);
- $rez = $_blob;
+ $numlob = count($this -> _refLOBs);
+ $this -> _refLOBs[$numlob]['LOB'] = OCINewDescriptor($this->_connectionID, oci_lob_desc($type));
+ $this -> _refLOBs[$numlob]['TYPE'] = $isOutput;
+
+ $tmp = &$this -> _refLOBs[$numlob]['LOB'];
+ $rez = OCIBindByName($stmt[1], ":".$name, $tmp, -1, $type);
+ if ($this->debug) {
+ ADOConnection::outp("Bind: descriptor has been allocated, var binded");
+ }
+
+ // if type is input then write data to lob now
+ if ($isOutput == false) {
+ $var = $this -> BlobEncode($var);
+ $tmp -> WriteTemporary($var);
+ if ($this->debug) {
+ ADOConnection::outp("Bind: LOB has been written to temp");
+ }
+ } else {
+ $this -> _refLOBs[$numlob]['VAR'] = &$var;
+ }
+ $rez = $tmp;
} else {
+ if ($this->debug)
+ ADOConnection::outp("Bind: 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
}
@@ -733,7 +776,7 @@ NATSOFT.DOMAIN =
$ztype = (empty($type)) ? 'false' : $type;
ADOConnection::outp( "{$prefix}Parameter(\$stmt, \$php_var='$var', \$name='$name', \$maxLen=$maxLen, \$type=$ztype);");
}
- return $this->Bind($stmt,$var,$maxLen,$type,$name);
+ return $this->Bind($stmt,$var,$maxLen,$type,$name,$isOutput);
}
/*
@@ -807,6 +850,22 @@ NATSOFT.DOMAIN =
$this->_errorMsg = false;
$this->_errorCode = false;
if (OCIExecute($stmt,$this->_commit)) {
+//OCIInternalDebug(1);
+ if (count($this -> _refLOBs) > 0) {
+
+ foreach ($this -> _refLOBs as $key => $value) {
+ if ($this -> _refLOBs[$key]['TYPE'] == true) {
+ $tmp = $this -> _refLOBs[$key]['LOB'] -> load();
+ if ($this -> debug) {
+ ADOConnection::outp("OUT LOB: LOB has been loaded. $string ";
$db = NewADOConnection($dbType);
$dict = NewDataDictionary($db);
@@ -21,7 +21,7 @@ foreach(array('sybase','mysql','access','oci8','postgres','odbc_mssql','odbc','s
if (!$dict) continue;
$dict->debug = 1;
- $opts = array('REPLACE','mysql' => 'TYPE=ISAM', 'oci8' => 'TABLESPACE USERS');
+ $opts = array('REPLACE','mysql' => 'TYPE=INNODB', 'oci8' => 'TABLESPACE USERS');
/* $flds = array(
array('id', 'I',
diff --git a/phpgwapi/inc/adodb/tests/test-php5.php b/phpgwapi/inc/adodb/tests/test-php5.php
index 5142e6942d..3a682fe602 100644
--- a/phpgwapi/inc/adodb/tests/test-php5.php
+++ b/phpgwapi/inc/adodb/tests/test-php5.php
@@ -1,6 +1,6 @@
PHP ".PHP_VERSION."\n";
try {
-$dbt = 'oci8';
+$dbt = 'mysqli';
switch($dbt) {
case 'oci8':
@@ -30,6 +30,11 @@ case 'mysql':
$db = NewADOConnection("mysql");
$db->Connect('localhost','root','','test');
break;
+
+case 'mysqli':
+ $db = NewADOConnection("mysqli");
+ $db->Connect('localhost','root','','test');
+ break;
}
$db->debug=1;
diff --git a/phpgwapi/inc/adodb/tests/test-xmlschema.php b/phpgwapi/inc/adodb/tests/test-xmlschema.php
index bfa70ca476..d3099fd3d9 100644
--- a/phpgwapi/inc/adodb/tests/test-xmlschema.php
+++ b/phpgwapi/inc/adodb/tests/test-xmlschema.php
@@ -1,6 +1,6 @@
\n";
// Finally, clean up after the XML parser
// (PHP won't do this for you!)
//$schema->Destroy();
+
+
+$db2 = ADONewConnection('mssql');
+$db2->Connect('localhost','sa','natsoft','northwind') || die("Fail 2");
+
+$db2->Execute("drop table simple_table");
+
+$schema = new adoSchema( $db2 );
+$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
+
+print "Here's the SQL to do the build:\n Testing MetaDatabases() Testing MetaTables() and MetaColumns()
");
+ }
+ //$_GLOBALS[$this -> _refLOBs[$key]['VAR']] = $tmp;
+ $this -> _refLOBs[$key]['VAR'] = $tmp;
+ }
+ $this -> _refLOBs[$key]['LOB'] -> free();
+ unset($this -> _refLOBs[$key]);
+ }
+ }
switch (@OCIStatementType($stmt)) {
case "SELECT":
@@ -840,6 +899,12 @@ NATSOFT.DOMAIN =
function _close()
{
if (!$this->autoCommit) OCIRollback($this->_connectionID);
+ if (count($this -> _refLOBs) > 0) {
+ foreach ($this -> _refLOBs as $key => $value) {
+ $this -> _refLOBs[$key] -> free();
+ unset($this -> _refLOBs[$key]);
+ }
+ }
OCILogoff($this->_connectionID);
$this->_stmt = false;
$this->_connectionID = false;
@@ -944,7 +1009,6 @@ SELECT /*+ RULE */ distinct b.column_name
{
$nofixquotes=false;
- if (is_array($s)) adodb_backtrace();
if ($this->noNullStrings && strlen($s)==0)$s = ' ';
if (!$magic_quotes) {
if ($this->replaceQuote[0] == '\\'){
@@ -956,12 +1020,9 @@ SELECT /*+ RULE */ distinct b.column_name
// undo magic quotes for "
$s = str_replace('\\"','"',$s);
- if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything
- return "'$s'";
- else {// change \' to '' for sybase/mssql
- $s = str_replace('\\\\','\\',$s);
- return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
- }
+ $s = str_replace('\\\\','\\',$s);
+ return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
+
}
}
diff --git a/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php b/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php
index e4b9a8402b..d7991d12ab 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-oci805.inc.php
@@ -1,6 +1,6 @@
debug && $argDatabasename && $this->databaseType != 'vfp') {
ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter.");
}
- $php_errormsg = '';
+ 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);
- $this->_errorMsg = $php_errormsg;
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
//if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
@@ -177,9 +180,10 @@ class ADODB_odbc extends ADOConnection {
{
global $php_errormsg;
- if (!function_exists('odbc_connect')) return false;
+ if (!function_exists('odbc_connect')) return null;
- $php_errormsg = '';
+ if (isset($php_errormsg)) $php_errormsg = '';
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
if ($this->debug && $argDatabasename) {
ADOConnection::outp("For odbc PConnect(), $argDatabasename is not used. Place dsn in 1st parameter.");
}
@@ -187,7 +191,7 @@ class ADODB_odbc extends ADOConnection {
if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword);
else $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode);
- $this->_errorMsg = $php_errormsg;
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID);
if (isset($this->connectStmt)) $this->Execute($this->connectStmt);
@@ -466,7 +470,7 @@ class ADODB_odbc extends ADOConnection {
function _query($sql,$inputarr=false)
{
GLOBAL $php_errormsg;
- $php_errormsg = '';
+ if (isset($php_errormsg)) $php_errormsg = '';
$this->_error = '';
if ($inputarr) {
@@ -476,7 +480,7 @@ class ADODB_odbc extends ADOConnection {
$stmtid = odbc_prepare($this->_connectionID,$sql);
if ($stmtid == false) {
- $this->_errorMsg = $php_errormsg;
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
return false;
}
}
@@ -518,13 +522,13 @@ class ADODB_odbc extends ADOConnection {
$this->_errorMsg = '';
$this->_errorCode = 0;
} else
- $this->_errorMsg = $php_errormsg;
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
} else {
if ($this->_haserrorfunctions) {
$this->_errorMsg = odbc_errormsg();
$this->_errorCode = odbc_error();
} else
- $this->_errorMsg = $php_errormsg;
+ $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
}
return $stmtid;
}
@@ -707,4 +711,4 @@ class ADORecordSet_odbc extends ADORecordSet {
}
-?>
+?>
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php b/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php
index 3e62bd31fc..38c7eb70e9 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-odbc_mssql.inc.php
@@ -1,17 +1,20 @@
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
define("_ADODB_ODBTP_LAYER", 2 );
class ADODB_odbtp extends ADOConnection{
diff --git a/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php b/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
index 3d0512e738..bee94d2184 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
@@ -1,15 +1,18 @@
+// security - hide paths
+if (!defined('ADODB_DIR')) die();
+
/*
Because the ODBTP server sends and reads UNICODE text data using UTF-8
encoding, the following HTML meta tag must be included within the HTML
diff --git a/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php b/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php
index 78ec801343..765c50b319 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-oracle.inc.php
@@ -1,18 +1,20 @@
fmtTimeStamp,$ts).",'RRRR-MM-DD, HH:MI:SS AM')";
}
@@ -71,17 +74,22 @@ class ADODB_oracle extends ADOConnection {
/* there seems to be a bug in the oracle extension -- always returns ORA-00000 - no error */
function ErrorMsg()
- {
- $this->_errorMsg = @ora_error($this->_curs);
- if (!$this->_errorMsg) $this->_errorMsg = @ora_error($this->_connectionID);
+ {
+ if ($this->_errorMsg !== false) return $this->_errorMsg;
+
+ if (is_resource($this->_curs)) $this->_errorMsg = @ora_error($this->_curs);
+ if (empty($this->_errorMsg)) $this->_errorMsg = @ora_error($this->_connectionID);
return $this->_errorMsg;
}
function ErrorNo()
{
- $err = @ora_errorcode($this->_curs);
- if (!$err) return @ora_errorcode($this->_connectionID);
+ if ($this->_errorCode !== false) return $this->_errorCode;
+
+ if (is_resource($this->_curs)) $this->_errorCode = @ora_errorcode($this->_curs);
+ if (empty($this->_errorCode)) $this->_errorCode = @ora_errorcode($this->_connectionID);
+ return $this->_errorCode;
}
@@ -89,6 +97,12 @@ class ADODB_oracle extends ADOConnection {
// returns true or false
function _connect($argHostname, $argUsername, $argPassword, $argDatabasename, $mode=0)
{
+ if (!function_exists('ora_plogon')) return null;
+
+ //
";
return $o;
}
diff --git a/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php b/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php
index b92fe267fb..dbab597e65 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-postgres7.inc.php
@@ -1,6 +1,6 @@
_connectionID = sqlite_open($argHostname);
if ($this->_connectionID === false) return false;
@@ -138,7 +141,7 @@ class ADODB_sqlite extends ADOConnection {
// returns true or false
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
- if (!function_exists('sqlite_open')) return false;
+ if (!function_exists('sqlite_open')) return null;
$this->_connectionID = sqlite_popen($argHostname);
if ($this->_connectionID === false) return false;
diff --git a/phpgwapi/inc/adodb/drivers/adodb-sqlitepo.inc.php b/phpgwapi/inc/adodb/drivers/adodb-sqlitepo.inc.php
new file mode 100644
index 0000000000..396039d8fe
--- /dev/null
+++ b/phpgwapi/inc/adodb/drivers/adodb-sqlitepo.inc.php
@@ -0,0 +1,62 @@
+ADODB_sqlite();
+ }
+}
+
+/*--------------------------------------------------------------------------------------
+ Class Name: Recordset
+--------------------------------------------------------------------------------------*/
+
+class ADORecordset_sqlitepo extends ADORecordset_sqlite {
+
+ var $databaseType = 'sqlitepo';
+
+ function ADORecordset_sqlitepo($queryID,$mode=false)
+ {
+ $this->ADORecordset_sqlite($queryID,$mode);
+ }
+
+ // Modified to strip table names from returned fields
+ function _fetch($ignore_fields=false)
+ {
+ $this->fields = array();
+ $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
+ if(is_array($fields))
+ foreach($fields as $n => $v)
+ {
+ if(($p = strpos($n, ".")) !== false)
+ $n = substr($n, $p+1);
+ $this->fields[$n] = $v;
+ }
+
+ return !empty($this->fields);
+ }
+}
+?>
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/drivers/adodb-sybase.inc.php b/phpgwapi/inc/adodb/drivers/adodb-sybase.inc.php
index 549179b078..d4123e3b12 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-sybase.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-sybase.inc.php
@@ -1,12 +1,12 @@
_connectionID = sybase_connect($argHostname,$argUsername,$argPassword);
if ($this->_connectionID === false) return false;
@@ -122,7 +125,7 @@ class ADODB_sybase extends ADOConnection {
// returns true or false
function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
{
- if (!function_exists('sybase_connect')) return false;
+ if (!function_exists('sybase_connect')) return null;
$this->_connectionID = sybase_pconnect($argHostname,$argUsername,$argPassword);
if ($this->_connectionID === false) return false;
diff --git a/phpgwapi/inc/adodb/drivers/adodb-vfp.inc.php b/phpgwapi/inc/adodb/drivers/adodb-vfp.inc.php
index 5f5c1523d0..3c7ee2931f 100644
--- a/phpgwapi/inc/adodb/drivers/adodb-vfp.inc.php
+++ b/phpgwapi/inc/adodb/drivers/adodb-vfp.inc.php
@@ -1,16 +1,19 @@
+
+$ADODB_LANG_ARRAY = array (
+ 'LANG' => 'pl',
+ DB_ERROR => 'niezidentyfikowany błąd',
+ DB_ERROR_ALREADY_EXISTS => 'już istnieją',
+ DB_ERROR_CANNOT_CREATE => 'nie można stworzyć',
+ DB_ERROR_CANNOT_DELETE => 'nie można usunąć',
+ DB_ERROR_CANNOT_DROP => 'nie można porzucić',
+ DB_ERROR_CONSTRAINT => 'pogwałcenie uprawnień',
+ DB_ERROR_DIVZERO => 'dzielenie przez zero',
+ DB_ERROR_INVALID => 'błędny',
+ DB_ERROR_INVALID_DATE => 'błędna godzina lub data',
+ DB_ERROR_INVALID_NUMBER => 'błędny numer',
+ DB_ERROR_MISMATCH => 'niedopasowanie',
+ DB_ERROR_NODBSELECTED => 'baza danych nie została wybrana',
+ DB_ERROR_NOSUCHFIELD => 'nie znaleziono pola',
+ DB_ERROR_NOSUCHTABLE => 'nie znaleziono tabeli',
+ DB_ERROR_NOT_CAPABLE => 'nie zdolny',
+ DB_ERROR_NOT_FOUND => 'nie znaleziono',
+ DB_ERROR_NOT_LOCKED => 'nie zakmnięty',
+ DB_ERROR_SYNTAX => 'błąd składni',
+ DB_ERROR_UNSUPPORTED => 'nie obsługuje',
+ DB_ERROR_VALUE_COUNT_ON_ROW => 'wartość liczona w szeregu',
+ DB_ERROR_INVALID_DSN => 'błędny DSN',
+ DB_ERROR_CONNECT_FAILED => 'połączenie nie zostało zrealizowane',
+ 0 => 'brak błędów', // DB_OK
+ DB_ERROR_NEED_MORE_DATA => 'niedostateczna ilość informacji',
+ DB_ERROR_EXTENSION_NOT_FOUND=> 'nie znaleziono rozszerzenia',
+ DB_ERROR_NOSUCHDB => 'nie znaleziono bazy',
+ DB_ERROR_ACCESS_VIOLATION => 'niedostateczne uprawnienia'
+);
+?>
+
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/license.txt b/phpgwapi/inc/adodb/license.txt
index 786fc32bfe..9821fcb764 100644
--- a/phpgwapi/inc/adodb/license.txt
+++ b/phpgwapi/inc/adodb/license.txt
@@ -2,12 +2,12 @@ ADOdb is dual licensed using BSD and LGPL.
In plain English, you do not need to distribute your application in source code form, nor do you need to distribute ADOdb source code, provided you follow the rest of terms of the BSD license.
-Commercial use of ADOdb is encouraged. Make money and multiply!
+For more info about ADOdb, visit http://adodb.sourceforge.net/
BSD Style-License
=================
-Copyright (c) 2000, 2001, 2002, 2003 John Lim
+Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
diff --git a/phpgwapi/inc/adodb/pear/Auth/Container/ADOdb.php b/phpgwapi/inc/adodb/pear/Auth/Container/ADOdb.php
new file mode 100644
index 0000000000..e4ab3eb711
--- /dev/null
+++ b/phpgwapi/inc/adodb/pear/Auth/Container/ADOdb.php
@@ -0,0 +1,436 @@
+
+// | Richard Tango-Lowy $str
";
+ ( !$vardump ) ? ( print_r( $var )) : ( var_dump( $var ));
+ print "
";
+}
+?>
diff --git a/phpgwapi/inc/adodb/pear/readme.Auth.txt b/phpgwapi/inc/adodb/pear/readme.Auth.txt
new file mode 100644
index 0000000000..b6b0c15732
--- /dev/null
+++ b/phpgwapi/inc/adodb/pear/readme.Auth.txt
@@ -0,0 +1,20 @@
+From: Rich Tango-Lowy (richtl#arscognita.com)
+Date: Sat, May 29, 2004 11:20 am
+
+OK, I hacked out an ADOdb container for PEAR-Auth. The error handling's
+a bit of a mess, but all the methods work.
+
+Copy ADOdb.php to your pear/Auth/Container/ directory.
+
+Use the ADOdb container exactly as you would the DB
+container, but specify 'ADOdb' instead of 'DB':
+
+$dsn = "mysql://myuser:mypass@localhost/authdb";
+$a = new Auth("ADOdb", $dsn, "loginFunction");
+
+
+-------------------
+
+John Lim adds:
+
+See http://pear.php.net/manual/en/package.authentication.php
diff --git a/phpgwapi/inc/adodb/perf/perf-db2.inc.php b/phpgwapi/inc/adodb/perf/perf-db2.inc.php
index dbda7f75d9..792fcd84af 100644
--- a/phpgwapi/inc/adodb/perf/perf-db2.inc.php
+++ b/phpgwapi/inc/adodb/perf/perf-db2.inc.php
@@ -1,17 +1,19 @@
array('DATAC',
"select value from v\$parameter where name = 'shared_pool_size'",
- 'shared_pool_size, which holds shared cursors, stored procedures and similar shared structs' ),
+ 'shared_pool_size, which holds shared sql, stored procedures, dict cache and similar shared structs' ),
'java pool size' => array('DATAJ',
"select value from v\$parameter where name = 'java_pool_size'",
'java_pool_size' ),
@@ -104,7 +107,7 @@ AND b.name = 'sorts (memory)'",
"select round((1-bytes/sgasize)*100, 2)
from (select sum(bytes) sgasize from sys.v_\$sgastat) s, sys.v_\$sgastat f
where name = 'free memory' and pool = 'shared pool'",
- 'Percentage of data cache actually in use - too low is bad, too high is worse'),
+ 'Percentage of data cache actually in use - should be over 85%'),
'shared pool utilization ratio' => array('RATIOU',
'select round((sga.bytes/p.value)*100,2)
@@ -120,7 +123,7 @@ AND b.name = 'sorts (memory)'",
'Percentage of large_pool actually in use - too low is bad, too high is worse'),
'sort buffer size' => array('CACHE',
"select value from v\$parameter where name='sort_area_size'",
- 'sort_area_size (per query), uses memory in pga' ),
+ 'max in-mem sort_area_size (per query), uses memory in pga' ),
'pga usage at peak' => array('RATIOU',
'=PGA','Mb utilization at peak transactions (requires Oracle 9i+)'),
@@ -141,7 +144,12 @@ AND b.name = 'sorts (memory)'",
'cursor sharing' => array('CURSOR',
"select value from v\$parameter where name = 'cursor_sharing'",
'Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See cursor_sharing.'),
-
+ /*
+ 'cursor reuse' => array('CURSOR',
+ "select count(*) from (select sql_text_wo_constants, count(*)
+ from t1
+ group by sql_text_wo_constants
+having count(*) > 100)",'These are sql statements that should be using bind variables'),*/
'index cache cost' => array('COST',
"select value from v\$parameter where name = 'optimizer_index_caching'",
'% of indexed data blocks expected in the cache.
diff --git a/phpgwapi/inc/adodb/perf/perf-postgres.inc.php b/phpgwapi/inc/adodb/perf/perf-postgres.inc.php
index ad21adbc1c..b9392b12e8 100644
--- a/phpgwapi/inc/adodb/perf/perf-postgres.inc.php
+++ b/phpgwapi/inc/adodb/perf/perf-postgres.inc.php
@@ -1,18 +1,21 @@
EOF) {
$ref = $rs->fields[0];
$key = $rs->fields[1];
- assert('$ref');
- assert('$key');
+ //assert('$ref');
+ //assert('$key');
$fn($ref, $key);
}
$rs->Close();
diff --git a/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php b/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php
index 93fa88e820..3323e03b1a 100644
--- a/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php
+++ b/phpgwapi/inc/adodb/session/old/adodb-cryptsession.php
@@ -1,6 +1,6 @@
Connect($pdo_connection_string,'','') || die("CONNECT FAILED");
+echo "Execute\n";
+
+
+
+//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+$rs = $DB->Execute("select * from products where productid<3");
+echo "e=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n";
+
+
+//print_r(get_class_methods($DB->_stmt));
+
+if (!$rs) die("NO RS");
+echo "FETCH\n";
+$cnt = 0;
+while (!$rs->EOF) {
+ print_r($rs->fields);
+ $rs->MoveNext();
+ if ($cnt++ > 1000) break;
+}
+
+echo "
--------------------------------------------------------
\n\n\n";
+
+$stmt = $DB->PrepareStmt("select * from products");
+$rs = $stmt->Execute();
+echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n";
+while ($arr = $rs->FetchRow()) {
+ print_r($arr);
+}
+die("DONE\n");
+
+?>
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/tests/test-datadict.php b/phpgwapi/inc/adodb/tests/test-datadict.php
index a25f2a62fb..3aa7d3bd6f 100644
--- a/phpgwapi/inc/adodb/tests/test-datadict.php
+++ b/phpgwapi/inc/adodb/tests/test-datadict.php
@@ -1,7 +1,7 @@
$dbType";
+print_r( $sql );
+print "
\n";
+
+$db2->debug=1;
+
+$db2->Execute($sql[0]);
?>
\ No newline at end of file
diff --git a/phpgwapi/inc/adodb/tests/test.php b/phpgwapi/inc/adodb/tests/test.php
index b163089eb7..472eeb7c1c 100644
--- a/phpgwapi/inc/adodb/tests/test.php
+++ b/phpgwapi/inc/adodb/tests/test.php
@@ -1,12 +1,12 @@
Execute("drop table adodb_logsql");
if ((rand()%3) == 0) @$db->Execute("delete from adodb_logsql");
$db->debug=1;
@@ -121,9 +122,8 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
if ($tt == 0) echo '
$db->Time failed';
else echo "
db->Time: ".date('d-m-Y H:i:s',$tt);
echo '
';
-
-
-
+
+ echo "Date=",$db->UserDate('2002-04-07'),'
';
print "date1 (1969-02-20) = ".$db->DBDate('1969-2-20');
print "
date1 (1999-02-20) = ".$db->DBDate('1999-2-20');
print "
date1.1 1999 = ".$db->DBDate("'1999'");
@@ -243,7 +243,7 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
if (1) {
print "
Testing MetaIndexes
"; - $a = $db->MetaIndexes('ADOXYZ',true); + + $a = $db->MetaIndexes(('ADOXYZ'),true); if ($a===false) print "MetaIndexes not supported"; else { print "Indexes of ADOXYZ:
";
- foreach($a as $v) {print_r($v); echo "
";}
+ adodb_pr($a);
echo "";
}
print "
Testing MetaPrimaryKeys
"; @@ -375,7 +376,7 @@ GO rs2html($rs); /* - Test out params - works in 4.2.3 but not 4.3.0???: + Test out params - works in 4.2.3 and 4.3.3 but not 4.3.0: CREATE PROCEDURE at_date_interval @days INTEGER, @@ -577,7 +578,7 @@ END adodb; if (!is_object($rs)) { print_r($rs); err("Update should return object"); - } + } if (!$rs) err("Update generated error"); $nrows = $db->Affected_Rows(); @@ -585,6 +586,15 @@ END adodb; else if ($nrows != $cnt) print "Affected_Rows() Error: $nrows returned (should be 50)
"; else print "Affected_Rows() passed
"; } + + + $array = array('zid'=>1,'zdate'=>date('Y-m-d',time())); + $id = $db->GetOne("select id from ADOXYZ + where id=".$db->Param('zid')." and created>=".$db->Param('ZDATE')."", + $array); + if ($id != 1) Err("Bad bind; id=$id"); + else echo "Error in Execute of SELECT with random
"; } $val = $db->GetOne("select count(*) from ADOXYZ"); if ($val == 50) print "GetOne returns ok
"; @@ -679,10 +689,17 @@ END adodb; print "FETCH_MODE = ASSOC: Should get 1, Caroline
"; $rs = &$db->SelectLimit('select id,firstname from ADOXYZ order by id',2); if ($rs && !$rs->EOF) { - if ($rs->fields['id'] != 1) {Err("Error 1"); print_r($rs->fields);}; - if (trim($rs->fields['firstname']) != 'Caroline') {Err("Error 2"); print_r($rs->fields);}; + if (ADODB_ASSOC_CASE == 2) { + $id = 'ID'; + $fname = 'FIRSTNAME'; + }else { + $id = 'id'; + $fname = 'firstname'; + } + if ($rs->fields[$id] != 1) {Err("Error 1"); print_r($rs->fields);}; + if (trim($rs->fields[$fname]) != 'Caroline') {Err("Error 2"); print_r($rs->fields);}; $rs->MoveNext(); - if ($rs->fields['id'] != 2) {Err("Error 3"); print_r($rs->fields);}; + if ($rs->fields[$id] != 2) {Err("Error 3"); print_r($rs->fields);}; $rs->MoveNext(); if (!$rs->EOF) Err("Error EOF"); else if (is_array($rs->fields) || $rs->fields) { @@ -884,18 +901,22 @@ END adodb; print "Testing GetAssoc() "; $savecrecs = $ADODB_COUNTRECS; $ADODB_COUNTRECS = false; - $rs = &$db->Execute("select distinct lastname,firstname from ADOXYZ"); + //$arr = $db->GetArray("select lastname,firstname from ADOXYZ"); + //print_r($arr); + print ""; - rs2tabout($rs); - print ""; - + if (PHP_VERSION < 5) { + print "
"; + rs2tabout($rs); + print ""; + } //print " CacheFlush "; //$db->CacheFlush(); @@ -1248,7 +1270,7 @@ END adodb; if (!$date) Err("Bad sysDate"); else { $ds = $db->UserDate($date,"d m Y"); - if ($ds != date("d m Y")) Err("Bad UserDate: ".$ds); + if ($ds != date("d m Y")) Err("Bad UserDate: ".$ds.' expected='.date("d m Y")); else echo "Passed UserDate: $ds
";
}
$db->debug=1;
@@ -1356,7 +1378,7 @@ END adodb;
$conn = NewADOConnection($db->databaseType);
$conn->raiseErrorFn = 'adodb_test_err';
- @$conn->Connect('abc');
+ @$conn->PConnect('abc');
if ($TESTERRS == 2) print "raiseErrorFn tests passed
";
else print "raiseErrorFn tests failed ($TESTERRS)
";
@@ -1398,7 +1420,7 @@ global $TESTERRS,$ERRNO;
//--------------------------------------------------------------------------------------
-set_time_limit(240); // increase timeout
+@set_time_limit(240); // increase timeout
include("../tohtml.inc.php");
include("../adodb.inc.php");
@@ -1418,7 +1440,7 @@ if ( @$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
CheckWS('firebird');
CheckWS('sybase');
- CheckWS('informix');
+ if (!ini_get('safe_mode')) CheckWS('informix');
CheckWS('ado_mssql');
CheckWS('ado_access');
@@ -1429,6 +1451,7 @@ if ( @$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
CheckWS('db2');
CheckWS('access');
CheckWS('odbc_mssql');
+ CheckWS('firebird15');
//
CheckWS('oracle');
CheckWS('proxy');
@@ -1463,9 +1486,8 @@ Test GetInsertSQL/GetUpdateSQL
Perf Monitor
- -vers=",ADOConnection::Version(); include_once('../adodb-time.inc.php'); adodb_date_test(); diff --git a/phpgwapi/inc/adodb/tests/test2.php b/phpgwapi/inc/adodb/tests/test2.php index 8d177b9600..52a2771bac 100644 --- a/phpgwapi/inc/adodb/tests/test2.php +++ b/phpgwapi/inc/adodb/tests/test2.php @@ -8,7 +8,7 @@
Connecting $db->databaseType..."; if (@$db->PConnect("localhost:d:\\firebird\\10\\examples\\employee.gdb", "sysdba", "masterkey", "")) @@ -151,6 +152,21 @@ if (!empty($testmysql)) { // MYSQL } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'"; } else { print "Error in using Cursor Variables 1
"; } - print "