From 93de2fbcb6b0c078ec102e982146f2b7a21fb025 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 25 Oct 2003 05:59:58 +0000 Subject: [PATCH] Updates to ADOdb 4.0.1 - some bug fixes --- lib/adodb/adodb-cryptsession.php | 2 +- lib/adodb/adodb-csvlib.inc.php | 2 +- lib/adodb/adodb-datadict.inc.php | 2 +- lib/adodb/adodb-error.inc.php | 2 +- lib/adodb/adodb-errorhandler.inc.php | 2 +- lib/adodb/adodb-errorpear.inc.php | 2 +- lib/adodb/adodb-lib.inc.php | 2 +- lib/adodb/adodb-pager.inc.php | 8 +- lib/adodb/adodb-pear.inc.php | 2 +- lib/adodb/adodb-perf.inc.php | 8 +- lib/adodb/adodb-session-clob.php | 2 +- lib/adodb/adodb-session.php | 2 +- .../docs/media/bg_left.png | Bin 0 -> 991 bytes .../docs/media/stylesheet.css | 94 +++++ .../docs/xmlschema/_adodb-xmlschema_php.html | 111 +++++ .../docs/xmlschema/adoSchema.html | 235 +++++++++++ .../docs/xmlschema/package_xmlschema.html | 114 ++++++ lib/adodb/adodb.inc.php | 45 ++- lib/adodb/datadict/datadict-access.inc.php | 2 +- lib/adodb/datadict/datadict-db2.inc.php | 2 +- lib/adodb/datadict/datadict-generic.inc.php | 2 +- lib/adodb/datadict/datadict-ibase.inc.php | 2 +- lib/adodb/datadict/datadict-informix.inc.php | 2 +- lib/adodb/datadict/datadict-mssql.inc.php | 2 +- lib/adodb/datadict/datadict-mysql.inc.php | 3 +- lib/adodb/datadict/datadict-oci8.inc.php | 2 +- lib/adodb/datadict/datadict-postgres.inc.php | 2 +- lib/adodb/datadict/datadict-sybase.inc.php | 2 +- lib/adodb/docs-adodb.htm | 283 ++----------- lib/adodb/docs-datadict.htm | 2 +- lib/adodb/docs-perf.htm | 379 ++++++++++++++++++ lib/adodb/docs-session.htm | 2 +- lib/adodb/drivers/adodb-access.inc.php | 2 +- lib/adodb/drivers/adodb-ado.inc.php | 2 +- lib/adodb/drivers/adodb-ado_access.inc.php | 2 +- lib/adodb/drivers/adodb-ado_mssql.inc.php | 2 +- lib/adodb/drivers/adodb-borland_ibase.inc.php | 2 +- lib/adodb/drivers/adodb-csv.inc.php | 2 +- lib/adodb/drivers/adodb-db2.inc.php | 2 +- lib/adodb/drivers/adodb-fbsql.inc.php | 2 +- lib/adodb/drivers/adodb-firebird.inc.php | 2 +- lib/adodb/drivers/adodb-ibase.inc.php | 2 +- lib/adodb/drivers/adodb-informix.inc.php | 2 +- lib/adodb/drivers/adodb-informix72.inc.php | 12 +- lib/adodb/drivers/adodb-mssql.inc.php | 2 +- lib/adodb/drivers/adodb-mssqlpo.inc.php | 2 +- lib/adodb/drivers/adodb-mysql.inc.php | 3 +- lib/adodb/drivers/adodb-mysqlt.inc.php | 2 +- lib/adodb/drivers/adodb-oci8.inc.php | 11 +- lib/adodb/drivers/adodb-oci805.inc.php | 2 +- lib/adodb/drivers/adodb-oci8po.inc.php | 2 +- lib/adodb/drivers/adodb-odbc.inc.php | 2 +- lib/adodb/drivers/adodb-odbc_mssql.inc.php | 2 +- lib/adodb/drivers/adodb-odbc_oracle.inc.php | 2 +- lib/adodb/drivers/adodb-oracle.inc.php | 2 +- lib/adodb/drivers/adodb-postgres.inc.php | 2 +- lib/adodb/drivers/adodb-postgres64.inc.php | 12 +- lib/adodb/drivers/adodb-postgres7.inc.php | 2 +- lib/adodb/drivers/adodb-proxy.inc.php | 2 +- lib/adodb/drivers/adodb-sapdb.inc.php | 2 +- lib/adodb/drivers/adodb-sqlanywhere.inc.php | 2 +- lib/adodb/drivers/adodb-sqlite.inc.php | 2 +- lib/adodb/drivers/adodb-sybase.inc.php | 2 +- lib/adodb/drivers/adodb-vfp.inc.php | 2 +- lib/adodb/perf/perf-db2.inc.php | 2 +- lib/adodb/perf/perf-informix.inc.php | 2 +- lib/adodb/perf/perf-mssql.inc.php | 2 +- lib/adodb/perf/perf-mysql.inc.php | 2 +- lib/adodb/perf/perf-oci8.inc.php | 2 +- lib/adodb/perf/perf-postgres.inc.php | 2 +- lib/adodb/pivottable.inc.php | 2 +- lib/adodb/rsfilter.inc.php | 2 +- lib/adodb/server.php | 2 +- lib/adodb/tests/benchmark.php | 2 +- lib/adodb/tests/client.php | 2 +- lib/adodb/tests/test-datadict.php | 2 +- lib/adodb/tests/test-xmlschema.php | 3 + lib/adodb/tests/test.php | 84 +++- lib/adodb/tests/test2.php | 2 +- lib/adodb/tests/test3.php | 2 +- lib/adodb/tests/test4.php | 2 +- lib/adodb/tests/test5.php | 2 +- lib/adodb/tests/testcache.php | 2 +- lib/adodb/tests/testdatabases.inc.php | 2 +- lib/adodb/tests/testgenid.php | 2 +- lib/adodb/tests/testmssql.php | 2 +- lib/adodb/tests/testoci8.php | 2 +- lib/adodb/tests/testoci8cursor.php | 2 +- lib/adodb/tests/testpaging.php | 2 +- lib/adodb/tests/testpear.php | 2 +- lib/adodb/tests/testsessions.php | 2 +- lib/adodb/toexport.inc.php | 2 +- lib/adodb/tohtml.inc.php | 6 +- 93 files changed, 1186 insertions(+), 375 deletions(-) create mode 100644 lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/bg_left.png create mode 100644 lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css create mode 100644 lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html create mode 100644 lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html create mode 100644 lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html create mode 100644 lib/adodb/docs-perf.htm diff --git a/lib/adodb/adodb-cryptsession.php b/lib/adodb/adodb-cryptsession.php index fb6d2eae16..9292fad28d 100644 --- a/lib/adodb/adodb-cryptsession.php +++ b/lib/adodb/adodb-cryptsession.php @@ -1,6 +1,6 @@ _logsql)) { $conn->_logsql = false; // disable logsql error simulation + $dbT = $conn->databaseType; $a0 = split(' ',$t0); $a0 = (float)$a0[1]+(float)$a0[0]; @@ -51,11 +52,14 @@ global $HTTP_SERVER_VARS; if (!$rs) { $errM = $conn->ErrorMsg(); $errN = $conn->ErrorNo(); + $conn->lastInsID = 0; $tracer = substr('ERROR: '.htmlspecialchars($errM),0,250); } else { $tracer = ''; $errM = ''; $errN = 0; + $conn->lastInsID = $conn->Insert_ID(); + } if (isset($HTTP_SERVER_VARS['HTTP_HOST'])) { $tracer .= '
'.$HTTP_SERVER_VARS['HTTP_HOST']; @@ -83,7 +87,7 @@ global $HTTP_SERVER_VARS; $saved = $conn->debug; $conn->debug = 0; - $dbT = $conn->databaseType; + if ($conn->dataProvider == 'oci8' && $dbT != 'oci8po') { $isql = "insert into adodb_logsql values($conn->sysTimeStamp,:b,:c,:d,:e,:f)"; } else if ($dbT == 'odbc_mssql' || $dbT == 'informix') { diff --git a/lib/adodb/adodb-session-clob.php b/lib/adodb/adodb-session-clob.php index a34cdbe19e..e57162aa49 100644 --- a/lib/adodb/adodb-session-clob.php +++ b/lib/adodb/adodb-session-clob.php @@ -1,6 +1,6 @@ 004R=004l4008;_004mK004C`008P>0026d000+nm#LZ500093 zP)t-sW@cuZnwqn-v(3%T<>lq?@9*&N@c;k+2nYxX2?+`c3JVJh3=9kn4Gj(s4i66x z5D*X%5fKs+5)%^>6ciK{6%`g178e&67#J8C85tTH8XFrM92^`S9UUGX9v>ecARr(i zAt53nA|oRsBqSsyB_$>%CMPE+C@3f?DJd!{Dl021EG#T7EiEoCE-x=HFfcGNF)=bS zGBYzXG&D3dH8nOiHa9mnI5;>tIXOByIy*Z%JUl!-Jv}}?K0iM{KtMo2K|w-7LPJAC zL_|bIMMXwNMn^|SNJvOYNl8jdN=r*iOiWBoO-)WtPESuyP*6}&QBhJ-Qd3h?R8&+| zRaI72R##V7SXfwDSy@_IT3cINTwGjTU0q&YUSD5dU|?WjVPRroVq;@tWMpJzWo2e& zW@l$-XlQ6@X=!R|YHMq2Y;0_8ZEbFDZf|dIaBy&OadC2Ta&vQYbaZreb#-=jc6WDo zczAeud3kzzdV70&e0+R;eSLm@et&;|fPjF3fq{a8f`fyDgoK2Jg@uNOhKGlTh=_=Z ziHVAeii?YjjEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z}m6ev3mY0{8n3$NEnVFiJ znwy)OoSdAUot>VZo}ZteprD|kp`oIpqNAguq@<*!rKP5(rl+T;sHmu^si~@}s;jH3 ztgNi9t*x%EuCK4Ju&}VPv9YqUva_?Zw6wIfwY9dkwzs#pxVX5vxw*Q!y1To(yu7@< zy}iD^zQ4b}z`(%4!NJ19!o$PE#KgqK#l^dCU$jHda$;ryf%FD~k%*@Qq&CSlv z&d<-!(9qD)(b3Y<($mw^)YR0~)z#M4*4Nk9*x1lt)=I7_<=;-L_>FMg~>g((4?Ck9A?d|UF?(gsK@bK{Q z@$vHV^7Hfa^z`)g_4W4l_V@Sq`1ttw`T6?#`uqF){QUg={r&#_{{R2~S)`U9#OW3a7QjtQaqa%$bp483yj(wg6&a8J+;-H-G>d&hZ8iU;yp^5?Wzh>{S2& N002ovPDHLkV1nfw*(d-2 literal 0 HcmV?d00001 diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css new file mode 100644 index 0000000000..506c90ff86 --- /dev/null +++ b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css @@ -0,0 +1,94 @@ +BODY, DIV, SPAN, PRE, CODE, TD, TH + { + line-height : 140%; + font-size : 10pt; + } + +A { + text-decoration : none; + } + +A:link { + color : #336699; + } + +A:visited { + color : #003366; + } + +A:active, A:hover { + color : #6699CC; + } + +A:hover { + text-decoration : underline; + } + +SPAN.type { + color : #336699; + font-size : xx-small; + font-weight : normal; + } + +PRE { + background-color : #EEEEEE; + padding : 10px; + border-width : 1px; + border-color : #336699; + border-style : solid; + } + +HR { + color : #336699; + background-color : #336699; + border-width : 0px; + height : 1px; + filter : Alpha (opacity=100,finishopacity=0,style=1); + } + +DIV.sdesc { + font-weight : bold; + background-color : #EEEEEE; + padding : 10px; + border-width : 1px; + border-color : #336699; + border-style : solid; + } + +DIV.desc { + font-family : monospace; + background-color : #EEEEEE; + padding : 10px; + border-width : 1px; + border-color : #336699; + border-style : solid; + } + +SPAN.code { + font-family : monospace; + } + +CODE.varsummarydefault { + padding : 1px; + border-width : 1px; + border-style : dashed; + border-color : #336699; + } + +UL.tute { + margin: 0px; + padding: 0px; + padding-left: 5px; + } + +LI.tute { + line-height : 140%; + font-size : 10pt; + text-indent: -15px; + padding-bottom: 2px; + padding-left: 14px; + } + +.small { + font-size : 9pt; + } diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html new file mode 100644 index 0000000000..d36aaa0d02 --- /dev/null +++ b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html @@ -0,0 +1,111 @@ + + + + + + + Docs for page adodb-xmlschema.php + + + +

File: Program_Root/adodb-xmlschema.php
+

+ +
xmlschema is a class that allows the user to quickly and easily build a database on any ADOdb-supported platform using a simple XML schema.
+
    +
  • copyright: Copyright © 2003 ars Cognita Inc., all rights reserved
  • +
  • version: $revision: $
  • +
  • author: Richard Tango-Lowy
  • +
+Classes in this file: +
+
+
Creates a table object in ADOdb's datadict format
+
+
Creates an index object in ADOdb's datadict format
+
+
Creates the SQL to execute a list of provided SQL queries
+
adoSchema
+
Loads and parses an XML file, creating an array of "ready-to-run" SQL statements
+
+
+ + +

Include Statements Summary

+ +
    +
  • include = "adodb.inc.php" +
    Include the main ADODB library +
+
+ + +

Global Variable Summary

+ +
    +
+ +
+ + +

Constant Summary

+ +
    +
+
+ + +

Function Summary

+ +
    +
+
+ + + +

Include Statements Detail

+ +
    + +
  • include file: = "adodb.inc.php" [line 31]
    +

    + +
    Include the main ADODB library
    +
      +
    +
+
+ + + +

Global Variable Detail

+ +
    +
+
+ + + +

Constant Detail

+ +
    +
+
+ + + +

Function Detail

+ +
    +
+
+
+
+ Documention generated on Sat, 3 May 2003 13:13:37 -0400 by phpDocumentor 1.2.0rc1 +
+ + + \ No newline at end of file diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html new file mode 100644 index 0000000000..055efcc5e9 --- /dev/null +++ b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html @@ -0,0 +1,235 @@ + + + + + + + Docs For Class adoSchema + + + + +

+ Class adoSchema +
+

+[line 379]
+
+
+Location: Program_Root/adodb-xmlschema.php +
+ +
Loads and parses an XML file, creating an array of "ready-to-run" SQL statements
+

This class is used to load and parse the XML file, to create an array of SQL statements that can be used to build a database, and to build the database using the SQL array.

+
    +
+
+ + +

Class Variable Summary

+ + +
+ + +

Inherited Class Variable Summary

+ + +
+ + +

Method Summary

+ + + + + +

Inherited Method Summary

+ +
+ + + +

Method Detail

+ +
    + + +
  • Constructor void adoSchema() [line 441] +

    +Usage: adoSchema( +object +$dbconn) +

    + + +
    Constructor.
    +

    Initializes the xmlschema object

    +

    Parameters

    +
      +
    • object $dbconn - ADOdb connection object +
    + +

    Info

    +
      +
    +

    [ Top ]

    +
    + + +
  • void Destroy() [line 725] +

    +Usage: Destroy( +) +

    + + +
    Destructor
    + +

    Info

    +
      +
    +

    [ Top ]

    +
    + + +
  • integer ExecuteSchema() [line 504] +

    +Usage: ExecuteSchema( +array +$sqlArray, [boolean +$continueOnErr = TRUE]) +

    + + +
    Loads a schema into the database
    +

    Accepts an array of SQL queries generated by the parser and executes them.

    +

    Parameters

    +
      +
    • array $sqlArray - Array of SQL statements +
    • boolean $continueOnErr - Don't fail out if an error is encountered +
    + +

    Info

    +
      +
    • return: 0 if failed, 1 if errors, 2 if successful +
    +

    [ Top ]

    +
    + + +
  • array ParseSchema() [line 465] +

    +Usage: ParseSchema( +string +$file) +

    + + +
    Loads and parses an XML file
    +

    This method accepts a path to an xmlschema-compliant XML file, loads it, parses it, and uses it to create the SQL to generate the objects described by the XML file.

    +

    Parameters

    +
      +
    • string $file - XML file +
    + +

    Info

    +
      +
    • return: Array of SQL queries, ready to execute +
    +

    [ Top ]

    +
    +
+
+ + + + +

Variable Detail

+ +
    + +
  • $dbconn = [line 394]
  • +
  • Data type: ADOdb
  • + +
      +
    • var: connection object
    • +
    +
    + +
  • $dbType = [line 399]
  • +
  • Data type: string
  • + +
      +
    • var: Database type (platform)
    • +
    +
    + +
  • $dict = [line 404]
  • +
  • Data type: ADOdb
  • + +
      +
    • var: Data Dictionary
    • +
    +
    + +
  • $sqlArray = [line 384]
  • +
  • Data type: array
  • + +
      +
    • var: Array containing SQL queries to generate all objects
    • +
    +
    + +
  • $xmlParser = [line 389]
  • +
  • Data type: XML
  • + +
      +
    • var: Parser object
    • +
    +
    +
+
+
+
+ Documention generated on Sat, 3 May 2003 13:13:37 -0400 by phpDocumentor 1.2.0rc1 +
+ + \ No newline at end of file diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html new file mode 100644 index 0000000000..3b434bfbf7 --- /dev/null +++ b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html @@ -0,0 +1,114 @@ +

adodb-xmlschema

+

Written by Richard Tango-Lowy.

+

For more information, contact richtl@arscognita.com +or visit our site at www.arscognita.com.

+

At the moment, you should report bugs by mailing them to me. (If I can't convince John to +make this part of ADODB :-), I'll create a project for it on SourceForge.) + +

Introduction

+

adodb-xmlschema is a class that allows the user to quickly and easily +build a database on any ADOdb-supported platform using a simple XML format.

+

This library is dual-licensed under a BSD-style license and under the GNU Lesser Public License. +See the LICENSE file for more information.

+ +

Features

    +
  • Darned easy to install +
  • Quickly to create schemas that build on any platform supported by ADODB.
+ +

Installation

+

To install adodb-xmlschema, simply copy the adodb-xmlschema.php file into your +ADODB directory.

+ +

Quick Start

+

First, create an XML database schema. Let's call it "schema.xml:"

+<?xml version="1.0"?>
+<schema>
+  <table name="mytable">
+    <field name="row1" type="I">
+      <descr>An integer row that's a primary key and autoincrements</descr>
+      <KEY/>
+      <AUTOINCREMENT/>
+    </field>
+    <field name="row2" type="C" size="16">
+      <descr>A 16 character varchar row that can't be null</descr>
+      <NOTNULL/>
+    </field>
+  </table>
+  <index name="myindex" table="mytable">
+    <col>row1</col>
+    <col>row2</col>
+  </index>
+  <sql>
+    <descr>SQL to be executed only on specific platforms</descr>
+    <query platform="postgres|postgres7">
+      insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
+    </query>
+    <query platform="mysql">
+      insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
+    </query>
+  </sql>
+</schema>
+

Create a new database using the appropriate tool for your platform. +Executing the following PHP code will create the a mytable and myindex +in the database and insert two rows into mytable.

				
+// To build the schema, start by creating a normal ADOdb connection:
+$db->NewADOConnection( 'mysql' );
+$db->Connect( ... );
+
+// Create the schema object and build the query array.
+$schema = new adoSchema( $db );
+
+// Build the SQL array
+$sql = $schema->ParseSchema( "schema.xml" );
+
+// Execute the SQL on the database
+$result = $schema->ExecuteSchema( $sql );
+
+// Finally, clean up after the XML parser
+// (PHP won't do this for you!)
+$schema->Destroy();
+
+ +

XML Schema Format:

+

(See ADOdb_schema.dtd for the full specification)

+
+<?xml version="1.0"?>
+<schema>
+  <table name="tablename" platform="platform1|platform2|...">
+    <descr>Optional description</descr>
+    <field name="fieldname" type="datadict_type" size="size">
+      <KEY/>
+      <NOTNULL/>
+      <AUTOINCREMENT/>
+      <DEFAULT value="value"/>
+    </field>
+	... more fields
+  </table>
+  ... more tables
+  
+  <index name="indexname" platform="platform1|platform2|...">
+    <descr>Optional description</descr>
+    <col>fieldname</col>
+    ... more columns
+  </index>
+  ... more indices
+  
+  <sql platform="platform1|platform2|...">
+    <descr>Optional description</descr>
+    <query platform="platform1|platform2|...">SQL query</query>
+    ... more queries
+  </sql>
+  ... more SQL
+  </schema>
+
+
+

Thanks

+

Thanks to John Lim for giving us ADODB, and for the hard work that keeps it on top of things. +And particulary for the datadict code that made xmlschema possible.

+

And to the kind folks at PHP Documentor. Cool tool.

+

And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)

+
+
If you have any questions or comments, please email them to me at +richtl@arscognita.com.
+ +

$Id$

\ No newline at end of file diff --git a/lib/adodb/adodb.inc.php b/lib/adodb/adodb.inc.php index b43546eb0b..4f40b6a2af 100644 --- a/lib/adodb/adodb.inc.php +++ b/lib/adodb/adodb.inc.php @@ -14,7 +14,7 @@ /** \mainpage - @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim\@natsoft.com.my). All rights reserved. + @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim\@natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. You can choose which license you prefer. @@ -148,7 +148,7 @@ /** * ADODB version as a string. */ - $ADODB_vers = 'V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; + $ADODB_vers = 'V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; /** * Determines whether recordset->RecordCount() is used. @@ -228,6 +228,8 @@ var $metaTablesSQL = ''; var $uniqueOrderBy = false; /// All order by columns have to be unique var $emptyDate = ' '; + var $emptyTimeStamp = ' '; + var $lastInsID = false; //-- var $hasInsertID = false; /// supports autoincrement ID? var $hasAffectedRows = false; /// supports affected rows for update/delete? @@ -719,7 +721,8 @@ if (!$array_2d) $inputarr = array($inputarr); while(list(,$arr) = each($inputarr)) { $sql = ''; $i = 0; - foreach($arr as $v) { + reset($arr); + while(list(,$v) = each($arr)) { $sql .= $sqlarr[$i]; // from Ron Baldwin // Only quote string types @@ -897,9 +900,10 @@ */ function Insert_ID() { - if ($this->hasInsertID) return $this->_insertid(); - if ($this->debug) ADOConnection::outp( '

Insert_ID error

'); - return false; + if ($this->_logsql && $this->lastInsID) return $this->lastInsID; + if ($this->hasInsertID) return $this->_insertid(); + if ($this->debug) ADOConnection::outp( '

Insert_ID error

'); + return false; } @@ -2076,7 +2080,7 @@ function UnixTimeStamp($v) { if (!preg_match( - "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]+(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", + "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]*(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", ($v), $rr)) return false; if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0; @@ -2110,6 +2114,23 @@ } + /** + * + * @param v is the character timestamp in YYYY-MM-DD hh:mm:ss format + * @param fmt is the format to apply to it, using date() + * + * @return a timestamp formated as user desires + */ + function UserTimeStamp($v,$fmt='Y-m-d H:i:s') + { + if (is_numeric($v)) return adodb_date($fmt,$v); + $tt = $this->UnixTimeStamp($v); + // $tt == -1 if pre TIMESTAMP_FIRST_YEAR + if (($tt === false || $tt == -1) && $v != false) return $v; + if ($tt == 0) return $this->emptyTimeStamp; + return adodb_date($fmt,$tt); + } + /** * Correctly quotes a string so that all strings are escaped. We prefix and append @@ -2513,10 +2534,11 @@ */ function UserTimeStamp($v,$fmt='Y-m-d H:i:s') { + if (is_numeric($v)) return adodb_date($fmt,$v); $tt = $this->UnixTimeStamp($v); // $tt == -1 if pre TIMESTAMP_FIRST_YEAR if (($tt === false || $tt == -1) && $v != false) return $v; - if ($tt == 0) return $this->emptyTimeStamp; + if ($tt === 0) return $this->emptyTimeStamp; return adodb_date($fmt,$tt); } @@ -2566,7 +2588,7 @@ { if (!preg_match( - "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]+(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", + "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]*(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", ($v), $rr)) return false; if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0; @@ -2776,7 +2798,10 @@ } $record = array(); - foreach($this->bind as $k => $v) { + reset($this->bind); + while(list($k,$v) = each($this->bind)) { + //echo " $k $v, "; + //foreach($this->bind as $k => $v) { $record[$k] = $this->fields[$v]; } diff --git a/lib/adodb/datadict/datadict-access.inc.php b/lib/adodb/datadict/datadict-access.inc.php index dc3f0abd00..39ba17da1e 100644 --- a/lib/adodb/datadict/datadict-access.inc.php +++ b/lib/adodb/datadict/datadict-access.inc.php @@ -1,7 +1,7 @@

ADOdb Library for PHP

-

V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my)

+

V4.01 23 Oct 2003 (c) 2000-2003 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 @@ -65,7 +65,7 @@                ExecuteCursor (oci8 only)
Generates SQL strings: GetUpdateSQL GetInsertSQL - IfNull Concat Param + Concat IfNull substr Param OffsetDate SQLDate DBDate DBTimeStamp
Blobs: UpdateBlob UpdateClob @@ -78,7 +78,7 @@ BeginTrans CommitTrans RollbackTrans
Fetching Data: SetFetchMode
- Strings: concat qstr quote
+ Strings: concat qstr quote substr
Dates: DBDate DBTimeStamp UnixDate UnixTimeStamp OffsetDate SQLDate
@@ -96,9 +96,12 @@
Deprecated: Bind BlankRecordSet

ADORecordSet

- Returns one row:FetchRow FetchInto + + Returns one field: Fields
+ Returns one row:FetchRow FetchInto FetchObject FetchNextObject - FetchObj FetchNextObj
+ FetchObj FetchNextObj + GetRowAssoc
Returns all rows:GetArray GetRows GetAssoc
Scrolling:Move MoveNext MoveFirst @@ -112,8 +115,7 @@ NextRecordSet
Field Info:FieldCount FetchField MetaType
- Cleanup: Close

- Deprecated: GetRowAssoc Fields
+ Cleanup: Close

rs2html  example
Differences between ADOdb and ADO
Database Driver Guide
@@ -2057,6 +2059,15 @@ for ($i=0; $i < $max; $i++)
$DB->Execute( the function that checks whether a $field is null for the given database, and if null, change the value returned to $nullReplacementValue. Eg.

$sql = 'SELECT '.$db->IfNull('name', "'- unknown -'"). ' FROM table';
+

substr

+

This is not a function, but a property. Some databases have "substr" and others "substring" +as the function to retrieve a sub-string. To use this property: +

+  $sql = "SELECT ".$db->substr."(field, $offset, $length) from table";
+  $rs = $db->Execute($sql);
+
+

For all databases, the 1st parameter of substr is the field, the 2nd is the +offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.

Param($name )

Generates a bind placeholder portably. For most databases, the bind placeholder is "?". However some databases use named bind parameters such as Oracle, eg @@ -2525,8 +2536,6 @@ if ($rs)

Internally calls Move(RecordCount()-1). Note that some databases do not support this function.

GetRowAssoc($toUpper=true)

-

The above function is no longer the prefered way of getting associative arrays. - Use the $ADODB_FETCH_MODE variable instead.

Returns an associative array containing the current row. The keys to the array are the column names. The column names are upper-cased for easy access. To get the next row, you will still need to call MoveNext().

@@ -2548,12 +2557,9 @@ if ($rs)

Returns true if at last page (1-based). Requires PageExecute()/CachePageExecute() to be called. See Example 8.

Fields($colname)

-

This function is deprecated. Use $ADODB_FETCH_MODE - instead.

-

Some database extensions (eg. MySQL) return arrays that are both associative - and indexed if you use the native extensions. GetRowAssoc() does not return - arrays that combine associative and indexed elements. Returns the value of the +

Returns the value of the associated column $colname for the current row. The column name is case-insensitive.

+

This is a convenience function. For higher performance, use $ADODB_FETCH_MODE.

FetchRow()

Returns array containing current row, or false if EOF. @@ -2777,7 +2783,13 @@ $rs = $conn->Execute PHP.

Change Log

-

4.00 ?? 2003 +

4.01 23 Oct 2003 +

Informix ErrorNo() fixed. +

Modified PostgreSQL _fixblobs to use list/each instead of foreach. +

Modified several places to use list/each, including GetRowAssoc(). +

Fixed insert_id() incorrectly generated when logsql() enabled. +

Added UserTimeStamp() to connection class. +

4.00 20 Oct 2003

Upgraded adodb-xmlschema to 1 Oct 2003 snapshot.

Fix to rs2html warning message. Thx to Filo.

Fix for odbc_mssql/mssql SQLDate(), hours was wrong. @@ -2918,247 +2930,6 @@ which call sql, etc.

ChangeTableSQL contributed by Florian Buzin.

The odbc_mssql driver now sets CONCAT_NULL_YIELDS_NULL OFF for compat with mssql driver. -

3.50 19 May 2003

-

Fixed mssql compat with FreeTDS. FreeTDS does not implement mssql_fetch_assoc(). -

Merged back connection and recordset code into adodb.inc.php. -

ADOdb sessions using oracle clobs contributed by achim.gosse#ddd.de. See adodb-session-clob.php. -

Added /s modifier to preg_match everywhere, which ensures that regex does not - stop at /n. Thx Pao-Hsi Huang. -

Fixed error in metacolumns() for mssql. -

Added time format support for SQLDate. -

Image => B added to metatype. -

MetaType now checks empty($this->blobSize) instead of empty($this). -

Datadict has beta support for informix, sybase (mapped to mssql), db2 and generic - (which is a fudge). -

BlobEncode for postgresql uses pg_escape_bytea, if available. Needed for compat - with 7.3. -

Added $ADODB_LANG, to support multiple languages in MetaErrorMsg(). -

Datadict can now parse table definition as declarative text. -

For DataDict, oci8 autoincrement trigger missing semi-colon. Fixed. -

For DataDict, when REPLACE flag enabled, drop sequence in datadict for autoincrement - field in postgres and oci8.s -

Postgresql defaults to template1 database if no database defined in connect/pconnect. -

We now clear _resultid in postgresql if query fails. -

3.40 19 May 2003

-

Added insert_id for odbc_mssql. -

Modified postgresql UpdateBlobFile() because it did not work in safe mode. -

Now connection object is passed to raiseErrorFn as last parameter. Needed by - StartTrans(). -

Added StartTrans() and CompleteTrans(). It is recommended that you do not modify - transOff, but use the above functions. -

oci8po now obeys ADODB_ASSOC_CASE settings. -

Added virtualized error codes, using PEAR DB equivalents. Requires you to manually - include adodb-error.inc.php yourself, with MetaError() and MetaErrorMsg($errno). -

GetRowAssoc for mysql and pgsql were flawed. Fix by Ross Smith. -

Added to datadict types I1, I2, I4 and I8. Changed datadict type 'T' to map - to timestamp instead of datetime for postgresql. -

Error handling in ExecuteSQLArray(), adodb-datadict.inc.php did not work. -

We now auto-quote postgresql connection parameters when building connection - string. -

Added session expiry notification. -

We now test with odbc mysql - made some changes to odbc recordset constructor. -

MetaColumns now special cases access and other databases for odbc. -

3.31 17 March 2003

-

Added row checking for _fetch in postgres. -

Added Interval type to MetaType for postgres. -

Remapped postgres driver to call postgres7 driver internally. -

Adorecordset_array::getarray() did not return array when nRows >= 0. -

Postgresql: at times, no error message returned by pg_result_error() but error - message returned in pg_last_error(). Recoded again. -

Interbase blob's now use chunking for updateblob. -

Move() did not set EOF correctly. Reported by Jorma T. -

We properly support mysql timestamp fields when we are creating mysql tables - using the data-dict interface. -

Table regex includes backticks character now. -

3.30 3 March 2003

-

Added $ADODB_EXTENSION and $ADODB_COMPAT_FETCH constant. -

Made blank1stItem configurable using syntax "value:text" in GetMenu/GetMenu2. - Thx to Gabriel Birke. -

Previously ADOdb differed from the Microsoft standard because it did not define - what to set $this->fields when EOF was reached. Now at EOF, ADOdb sets $this->fields - to false for all databases, which is consist with Microsoft's implementation. - Postgresql and mysql have always worked this way (in 3.11 and earlier). If you - are experiencing compatibility problems (and you are not using postgresql nor - mysql) on upgrading to 3.30, try setting the global variables $ADODB_COUNTRECS - = true (which is the default) and $ADODB_FETCH_COMPAT = true (this is a new - global variable). -

We now check both pg_result_error and pg_last_error as sometimes pg_result_error - does not display anything. Iman Mayes -

We no longer check for magic quotes gpc in Quote(). -

Misc fixes for table creation in adodb-datadict.inc.php. Thx to iamsure. -

Time calculations use adodb_time library for all negative timestamps due to - problems in Red Hat 7.3 or later. Formerly, only did this for Windows. -

In mssqlpo, we now check if $sql in _query is a string before we change || - to +. This is to support prepared stmts. -

Move() and MoveLast() internals changed to support to support EOF and $this->fields - change. -

Added ADODB_FETCH_BOTH support to mssql. Thx to Angel Fradejas afradejas#mediafusion.es -

We now check if link resource exists before we run mysql_escape_string in - qstr(). -

Before we flock in csv code, we check that it is not a http url. -

3.20 17 Feb 2003

-

Added new Data Dictionary classes for creating tables and indexes. Warning - - this is very much alpha quality code. The API can still change. See adodb/tests/test-datadict.php - for more info. -

We now ignore $ADODB_COUNTRECS for mysql, because PHP truncates incomplete - recordsets when mysql_unbuffered_query() is called a second time. -

Now postgresql works correctly when $ADODB_COUNTRECS = false. -

Changed _adodb_getcount to properly support SELECT DISTINCT. -

Discovered that $ADODB_COUNTRECS=true has some problems with prepared queries - - suspect PHP bug. -

Now GetOne and GetRow run in $ADODB_COUNTRECS=false mode for better performance. -

Added support for mysql_real_escape_string() and pg_escape_string() in qstr(). -

Added an intermediate variable for mysql _fetch() and MoveNext() to store fields, - to prevent overwriting field array with boolean when mysql_fetch_array() returns - false. -

Made arrays for getinsertsql and getupdatesql case-insensitive. Suggested by - Tim Uckun" tim#diligence.com -

3.11 11 Feb 2003

-

Added check for ADODB_NEVER_PERSIST constant in PConnect(). If defined, then - PConnect() will actually call non-persistent Connect(). -

Modified interbase to properly work with Prepare(). -

Added $this->ibase_timefmt to allow you to change the date and time format. -

Added support for $input_array parameter in CacheFlush(). -

Added experimental support for dbx, which was then removed when i found that - it was slower than using native calls. -

Added MetaPrimaryKeys for mssql and ibase/firebird. -

Added new $trim parameter to GetCol and CacheGetCol -

Uses updated adodb-time.inc.php 0.06. -

3.10 27 Jan 2003 -

Added adodb_date(), adodb_getdate(), adodb_mktime() and adodb-time.inc.php. -

For interbase, added code to handle unlimited number of bind parameters. From - Daniel Hasan daniel#hasan.cl. -

Added BlobDecode and UpdateBlob for informix. Thx to Fernando Ortiz. -

Added constant ADODB_WINDOWS. If defined, means that running on Windows. -

Added constant ADODB_PHPVER which stores php version as a hex num. Removed - $ADODB_PHPVER variable. -

Felho Bacsi reported a minor white-space regular expression problem in GetInsertSQL. -

Modified ADO to use variant to store _affectedRows -

Changed ibase to use base class Replace(). Modified base class Replace() to - support ibase. -

Changed odbc to auto-detect when 0 records returned is wrong due to bad odbc - drivers. -

Changed mssql to use datetimeconvert ini setting only when 4.30 or later (does - not work in 4.23). -

ExecuteCursor($stmt, $cursorname, $params) now accepts a new $params array - of additional bind parameters -- William Lovaton walovaton#yahoo.com.mx. -

Added support for sybase_unbuffered_query if ADODB_COUNTRECS == false. Thx - to chuck may. -

Fixed FetchNextObj() bug. Thx to Jorma Tuomainen. -

We now use SCOPE_IDENTITY() instead of @@IDENTITY for mssql - thx to marchesini#eside.it -

Changed postgresql movenext logic to prevent illegal row number from being - passed to pg_fetch_array(). -

Postgresql initrs bug found by "Bogdan RIPA" bripa#interakt.ro $f1 accidentally - named $f -

3.00 6 Jan 2003 -

Fixed adodb-pear.inc.php syntax error. -

Improved _adodb_getcount() to use SELECT COUNT(*) FROM ($sql) for languages - that accept it. -

Fixed _adodb_getcount() caching error. -

Added sql to retrive table and column info for odbc_mssql. -

2.91 3 Jan 2003 -

Revised PHP version checking to use $ADODB_PHPVER with legal values 0x4000, - 0x4050, 0x4200, 0x4300. -

Added support for bytea fields and oid blobs in postgres by allowing BlobDecode() - to detect and convert non-oid fields. Also added BlobEncode to postgres when - you want to encode oid blobs. -

Added blobEncodeType property for connections to inform phpLens what encoding - method to use for blobs. -

Added BlobDecode() and BlobEncode() to base ADOConnection class. -

Added umask() to _gencachename() when creating directories. -

Added charPage for ado drivers, so you can set the code page. -

-$conn->charPage = CP_UTF8;
-$conn->Connect($dsn);
-
-

Modified _seek in mysql to check for num rows=0. -

Added to metatypes new informix types for IDS 9.30. Thx Fernando Ortiz. -

_maxrecordcount returned in CachePageExecute $rsreturn -

Fixed sybase cacheselectlimit( ) problems -

MetaColumns() max_length should use precision for types X and C for ms access. - Fixed. -

Speedup of odbc non-SELECT sql statements. -

Added support in MetaColumns for Wide Char types for ODBC. We halve max_length - if unicode/wide char. -

Added 'B' to types handled by GetUpdateSQL/GetInsertSQL. -

Fixed warning message in oci8 driver with $persist variable when using PConnect. -

2.90 11 Dec 2002 -

Mssql and mssqlpo and oci8po now support ADODB_ASSOC_CASE. -

Now MetaType() can accept a field object as the first parameter. -

New $arr = $db->ServerInfo( ) function. Returns $arr['description'] which - is the string description, and $arr['version']. -

PostgreSQL and MSSQL speedups for insert/updates. -

Implemented new SetFetchMode() that removes the need to use $ADODB_FETCH_MODE. - Each connection has independant fetchMode. -

ADODB_ASSOC_CASE now defaults to 2, use native defaults. This is because we - would break backward compat for too many applications otherwise. -

Patched encrypted sessions to use replace() -

The qstr function supports quoting of nulls when escape character is \ -

Rewrote bits and pieces of session code to check for time synch and improve - reliability. -

Added property ADOConnection::hasTransactions = true/false; -

Added CreateSequence and DropSequence functions -

Found misplaced MoveNext() in adodb-postgres.inc.php. Fixed. -

Sybase SelectLimit not reliable because 'set rowcount' not cached - fixed. -

Moved ADOConnection to adodb-connection.inc.php and ADORecordSet to adodb-recordset.inc.php. - This allows us to use doxygen to generate documentation. Doxygen doesn't like - the classes in the main adodb.inc.php file for some mysterious reason. -

2.50, 14 Nov 2002 -

Added transOff and transCnt properties for disabling (transOff = true) and - tracking transaction status (transCnt>0). -

Added inputarray handling into _adodb_pageexecute_all_rows - "Ross Smith" RossSmith#bnw.com. -

Fixed postgresql inconsistencies in date handling. -

Added support for mssql_fetch_assoc. -

Fixed $ADODB_FETCH_MODE bug in odbc MetaTables() and MetaPrimaryKeys(). -

Accidentally declared UnixDate() twice, making adodb incompatible with php - 4.3.0. Fixed. -

Fixed pager problems with some databases that returned -1 for _currentRow on - MoveLast() by switching to MoveNext() in adodb-lib.inc.php. -

Also fixed uninited $discard in adodb-lib.inc.php. -

2.43, 25 Oct 2002

-Added ADODB_ASSOC_CASE constant to better support ibase and odbc field names. -

Added support for NConnect() for oracle OCINLogin. -

Fixed NumCols() bug. -

Changed session handler to use Replace() on write. -

Fixed oci8 SelectLimit aggregate function bug again. -

Rewrote pivoting code. -

2.42, 4 Oct 2002

-

Fixed ibase_fetch() problem with nulls. Also interbase now does automatic blob - decoding, and is backward compatible. Suggested by Heinz Hombergs heinz#hhombergs.de. -

Fixed postgresql MoveNext() problems when called repeatedly after EOF. Also - suggested by Heinz Hombergs. -

PageExecute() does not rewrite queries if SELECT DISTINCT is used. Requested - by hans#velum.net -

Added additional fixes to oci8 SelectLimit handling with aggregate functions - - thx to Christian Bugge for reporting the problem. -

2.41, 2 Oct 2002

-

Fixed ADODB_COUNTRECS bug in odbc. Thx to Joshua Zoshi jzoshi#hotmail.com. -

Increased buffers for adodb-csvlib.inc.php for extremely long sql from 8192 - to 32000. -

Revised pivottable.inc.php code. Added better support for aggregate fields. -

Fixed mysql text/blob types problem in MetaTypes base class - thx to horacio - degiorgi. -

Added SQLDate($fmt,$date) function, which allows an sql date format string - to be generated - useful for group by's. -

Fixed bug in oci8 SelectLimit when offset>100. -

2.40 4 Sept 2002

-

Added new NLS_DATE_FORMAT property to oci8. Suggested by Laurent NAVARRO ln#altidev.com -

Now use bind parameters in oci8 selectlimit for better performance. -

Fixed interbase replaceQuote for dialect != 1. Thx to "BEGUIN Pierre-Henri - - INFOCOB" phb#infocob.com. -

Added white-space check to QA. -

Changed unixtimestamp to support fractional seconds (we always round down/floor - the seconds). Thanks to beezly#beezly.org.uk. -

Now you can set the trigger_error type your own user-defined type in adodb-errorhandler.inc.php. - Suggested by Claudio Bustos clbustos#entelchile.net. -

Added recordset filters with rsfilter.inc.php. -

$conn->_rs2rs does not create a new recordset when it detects it is of type - array. Some trickery there as there seems to be a bug in Zend Engine -

Added render_pagelinks to adodb-pager.inc.php. Code by "Pablo Costa" pablo#cbsp.com.br. -

MetaType() speedup in adodb.inc.php by using hashing instead of switch. Best - performance if constant arrays are supported, as they are in PHP5. -

adodb-session.php now updates only the expiry date if the crc32 check indicates - that the data has not been modified.


0.10 Sept 9 2000 First release

Old changelog history moved to old-changelog.htm. diff --git a/lib/adodb/docs-datadict.htm b/lib/adodb/docs-datadict.htm index bb53dc847d..6840245a36 100644 --- a/lib/adodb/docs-datadict.htm +++ b/lib/adodb/docs-datadict.htm @@ -11,7 +11,7 @@

ADOdb Data Dictionary Library for PHP

-

V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my)

+

V4.01 23 Oct 2003 (c) 2000-2003 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 diff --git a/lib/adodb/docs-perf.htm b/lib/adodb/docs-perf.htm new file mode 100644 index 0000000000..05c909cf9a --- /dev/null +++ b/lib/adodb/docs-perf.htm @@ -0,0 +1,379 @@ + + + + + ADOdb Performance Monitoring Library + + + +

The ADOdb Performance Monitoring Library

+

V4.01 23 Oct 2003 (c) 2000-2003 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 +

Introduction

+

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 + because web apps such as the popular phpMyAdmin currently do not provide effective + database health monitoring tools. The module provides the following: +

    +
  • A quick health check of your database server using $perf->HealthCheck() + or $perf->HealthCheckCLI(). +
  • User interface for performance monitoring, $perf->UI(). + This UI displays: +
      +
    • the health check,
    • +
    • all SQL logged and their query plans,
    • +
    • a list of all tables in the current database
    • +
    • an interface to continiously poll the server for key performance indicators + such as CPU, Hit Ratio, Disk I/O
    • +
    +
  • Gives you an API to build database monitoring tools for a server farm, for + example calling $perf->DBParameter('data cache hit ratio') returns + this very important statistic in a database independant manner. +
+

ADOdb also has the ability to log all SQL executed, using LogSQL. + All SQL logged can be analyzed through the performance monitor UI. + In the View SQL mode, we categorize the SQL into 3 types: +

    +
  • Suspicious SQL: queries with high average execution times, and are potential + candidates for rewriting
  • +
  • Expensive SQL: queries with high total execution times (#executions * avg + execution time). Optimizing these queries will reduce your database server + load.
  • +
  • Invalid SQL: queries that generate errors.
  • +
+

Each query is hyperlinked to a description of the query plan, and every PHP + script that executed that query is also shown.

+

Please note that the information presented is a very basic database health + check, and does not provide a complete overview of database performance. Although + some attempt has been made to make it work across multiple databases in the + same way, it is impossible to do so. For the health check, we do try to display + the following key database parameters for all drivers:

+
    +
  • data cache size - The amount of memory allocated to the cache.
  • +
  • data cache hit ratio - A measure of how effective the cache is, as a percentage. + The higher, the better.
  • +
  • current connections - The number of sessions currently connected to the + database.
  • +
+

You will need to connect to the database as an administrator to view most of + the parameters.

+

Code improvements as very welcome, particularly adding new database parameters + and automated tuning hints.

+

Usage

+

Currently, the following drivers: mysql, postgres, oci8, + mssql, informix and db2 are supported. To create a + new performance monitor, call NewPerfMonitor( ) as demonstrated below:

+
+<?php
+include_once('adodb.inc.php');
+session_start(); # session variables required for monitoring
+$conn = ADONewConnection($driver);
+$conn->Connect($server,$user,$pwd,$db);
+$perf =& NewPerfMonitor($conn);
+$perf->UI($pollsecs=5);
+?>
+
+

It is also possible to retrieve a single database parameter:

+
$size = $perf->DBParameter('data cache size');
+
+

+Thx to Fernando Ortiz for the informix module. +

Methods

+

function UI($pollsecs=5)

+

Creates a web-based user interface for performance monitoring. When you click on Poll, +server statistics will be displayed every $pollsecs seconds. See Usage + above. Sample output follows below:

+ + + +
ADOdb Performance + Monitor for localhost, db=test
+ PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) + 3.2 20020927 (prerelease)
+ Performance Stats   View SQL +   View Tables   Poll Stats
+ + + + + + + + + + + + +

postgres7

ParameterValueDescription
Ratios  
statistics collectorTRUEValue must be TRUE to enable hit ratio statistics (stats_start_collector,stats_row_level and stats_block_level must be set to true in postgresql.conf)
data cache hit ratio99.7967555299239 
IO  
data reads125 
data writes21.78125000000000000Count of inserts/updates/deletes * coef
Data Cache  
data cache buffers640Number of cache buffers. Tuning
cache blocksize8192(estimate)
data cache size5M 
operating system cache size80M(effective cache size)
Memory Usage  
sort buffer size1MSize of sort buffer (per query)
Connections  
current connections0 
max connections32 
Parameters  
rollback buffers8WAL buffers
random page cost4Cost of doing a seek (default=4). See random_page_cost
+

function HealthCheck()

+

Returns database health check parameters as a HTML table. You will need to + echo or print the output of this function,

+

function HealthCheckCLI()

+

Returns database health check parameters formatted for a command line interface. + You will need to echo or print the output of this function. Sample output for + mysql:

+
+-- Ratios -- 
+          MyISAM cache hit ratio => 56.5635738832 
+          InnoDB cache hit ratio => 0 
+             sql cache hit ratio => 0 
+ -- IO -- 
+                      data reads => 2622 
+                     data writes => 2415.5 
+ -- Data Cache -- 
+          MyISAM data cache size => 512K 
+             BDB data cache size => 8388600
+          InnoDB data cache size => 8M
+ -- Memory Pools -- 
+                read buffer size => 131072 
+                sort buffer size => 65528 
+                     table cache => 4 
+ -- Connections -- 
+             current connections => 3
+                 max connections => 100
+

function Poll($pollSecs=5) + +

Run in infinite loop, displaying the following information every $pollSecs. + This will not work properly if output buffering is enabled. + In the example below, $pollSecs=3: +

+Accumulating statistics...
+ Time   WS-CPU%   Hit%   Sess        Reads/s          Writes/s
+11:08:30    0.7  56.56      1         0.0000            0.0000
+11:08:33    1.8  56.56      2         0.0000            0.0000
+11:08:36   11.1  56.55      3         2.5000            0.0000
+11:08:39    9.8  56.55      2         3.1121            0.0000
+11:08:42    2.8  56.55      1         0.0000            0.0000
+11:08:45    7.4  56.55      2         0.0000            1.5000
+
+

WS-CPU% is the Web Server CPU load of the server that PHP is running + from (eg. the database client), and not the database. The Hit% is the + data cache hit ratio. Sess is the current number of sessions connected + to the database. If you are using persistent connections, this should not change + much. The Reads/s and Writes/s are synthetic values to give the + viewer a rough guide to I/O, and are not to be taken literally. +

function SuspiciousSQL($numsql=10)

+

Returns SQL which have high average execution times as a HTML table. Each sql statement +is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL. +

The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when +$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using $conn->LogSQL. +

For Oracle, Ixora Suspicious SQL returns a list of SQL statements that are most cache intensive as a HTML table. + These are data intensive SQL statements that could benefit most from tuning. + +

function ExpensiveSQL($numsql=10)

+

Returns SQL whose total execution time (avg time * #executions) is high as a HTML table. Each sql statement +is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL. +

The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when +$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using $conn->LogSQL. + +

For Oracle, Ixora Expensive SQL returns a list of SQL statements that are taking the most CPU load +when run. +

function InvalidSQL($numsql=10)

+

Returns a list of invalid SQL as an HTML table. +

Data is taken from the adodb_logsql table, where the sql statements are logged when +$connection->LogSQL(true) is enabled. +

function Tables($orderby=1)

+

Returns information on all tables in a database, with the first two fields + containing the table name and table size, the remaining fields depend on the + database driver. If $orderby is set to 1, it will sort by name. If $orderby + is set to 2, then it will sort by table size. Some database drivers (mssql and + mysql) will ignore the $orderby clause. For postgresql, the information is up-to-date + since the last vacuum. Not supported currently for db2.

+

Raw Functions

+

Raw functions return values without any formatting.

+

function DBParameter($paramname)

+

Returns the value of a database parameter, such as $this->DBParameter("data + cache size").

+

function CPULoad()

+

Returns the CPU load of the database client (NOT THE SERVER) as a percentage. + Only works for Linux and Windows. For Windows, WMI must be available.

+

Format of $settings Property

+

To create new database parameters, you need to understand $settings. The $settings + data structure is an associative array. Each element of the array defines a + database parameter. The key is the name of the database parameter. If no key is defined, + then it is assumed to be a section break, and the value is the name of the section break. + If this is too confusing, looking at the source code will help a lot!

+

Each database parameter is itself an array consisting of the following elements:

+
    +
  1. Category code, used to group related db parameters. If the category code is 'HIDE', then +the database parameter is not shown when HTML() is called.
    +
  2. +
  3. either +
      +
    1. sql string to retrieve value, eg. "select value from v\$parameter where + name='db_block_size'",
    2. +
    3. array holding sql string and field to look for, e.g. array('show variables','table_cache'); + optional 3rd parameter is the $rs->fields[$index] to use (otherwise + $index=1), and optional 4th parameter is a constant to multiply the result + with (typically 100 for percentage calculations),
    4. +
    5. a string prefixed by =, then a PHP method of the class is invoked, e.g. + to invoke $this->GetIndexValue(), set this array element to '=GetIndexValue', +
      +
    6. +
    +
  4. +
  5. Description of database parameter. If description begins with an =, then + it is interpreted as a method call, just as in (1c) above, taking one parameter, + the current value. E.g. '=GetIndexDescription' will invoke $this->GetIndexDescription($val). + This is useful for generating tuning suggestions. For an example, see WarnCacheRatio().
  6. +
+

Example from MySQL, table_cache database parameter:

+
'table cache' => array('CACHE',            # category code
+   array("show variables", 'table_cache'), # array (type 1b)
+   'Number of tables to keep open'),       # description
+

Example Health Check Output

+

db2 informix mysql mssql + oci8 postgres

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

db2

ParameterValueDescription
Ratios  
data cache hit ratio0    
Data Cache
data cache buffers250   See tuning + reference.
cache blocksize4096    
data cache size1000K    
Connections
current connections2    
+

 

+ + + + + +

informix

ParameterVal +ueDescription
Ratios  
data cache hit +ratio95.89 
IO  
data +reads1883884Page reads
data writes1716724Page writes
Connections
current connections263.0Number of +sessions
+ + +

 

+

+ + + + + + + + + + + + +

mysql

ParameterValueDescription
Ratios  
MyISAM cache hit ratio56.5658301822Cache ratio should be at least 90%
InnoDB cache hit ratio0Cache ratio should be at least 90%
sql cache hit ratio0 
IO  
data reads2622Number of selects (Key_reads is not accurate)
data writes2415.5Number of inserts/updates/deletes * coef (Key_writes is not accurate)
Data Cache  
MyISAM data cache size512K 
BDB data cache size8388600 
InnoDB data cache size8M 
Memory Pools  
read buffer size131072(per session)
sort buffer size65528Size of sort buffer (per session)
table cache4Number of tables to keep open
Connections  
current connections3 
max connections100 
+

 

+

+ + + + + + + + + +

mssql

ParameterValueDescription
Ratios  
data cache hit ratio99.9999694824 
prepared sql hit ratio99.7738579828 
adhoc sql hit ratio98.4540169133 
IO  
data reads2858 
data writes1438 
Data Cache  
data cache size4362in K
Connections  
current connections14 
max connections32767 
+ +

 

+

+ + + + + + + + + + + + + + + + + + + + +

oci8

ParameterValueDescription
Ratios  
data cache hit ratio96.98 
sql cache hit ratio99.96 
IO  
data reads842938 
data writes16852 
Data Cache  
data cache buffers3072Number of cache buffers
data cache blocksize8192 
data cache size48Mshared_pool_size
Memory Pools  
java pool size0java_pool_size
sort buffer size512Ksort_area_size (per query)
user session buffer size8Mlarge_pool_size
Connections  
current connections1 
max connections170 
data cache utilization ratio88.46Percentage of data cache actually in use
user cache utilization ratio91.76Percentage of user cache (large_pool) actually in use
rollback segments11 
Transactions  
peak transactions24Taken from high-water-mark
max transactions187max transactions / rollback segments < 3.5 (or transactions_per_rollback_segment)
Parameters  
cursor sharingEXACTCursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See cursor_sharing.
index cache cost0% of indexed data blocks expected in the cache. + Recommended is 20-80. Default is 0. See optimizer_index_caching.
random page cost100Recommended is 10-50 for TP, and 50 for data warehouses. Default is 100. See optimizer_index_cost_adj.
+

Suspicious SQL

+ + + + + + +
LOADEXECUTESSQL_TEXT
.73%89select u.name, o.name, t.spare1, t.pctfree$ from sys.obj$ o, sys.user$ u, sys.tab$ t where (bitand(t.trigflag, 1048576) = 1048576) and o.obj#=t.obj# and o.owner# = u.user# select i.obj#, i.flags, u.name, o.name from sys.obj$ o, sys.user$ u, sys.ind$ i where (bitand(i.flags, 256) = 256 or bitand(i.flags, 512) = 512) and (not((i.type# = 9) and bitand(i.flags,8) = 8)) and o.obj#=i.obj# and o.owner# = u.user#
.84%3select /*+ RULE */ distinct tabs.table_name, tabs.owner , partitioned, iot_type , TEMPORARY, table_type, table_type_owner from DBA_ALL_TABLES tabs where tabs.owner = :own
3.95%6SELECT round(count(1)*avg(buf.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.buffer_pool = buf.name and buf.name = 'DEFAULT'
4.50%6SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.tablespace_name = tsp.tablespace_name
57.34%9267select t.schema, t.name, t.flags, q.name from system.aq$_queue_tables t, sys.aq$_queue_table_affinities aft, system.aq$_queues q where aft.table_objno = t.objno and aft.owner_instance = :1 and q.table_objno = t.objno and q.usage = 0 and bitand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft.table_objno skip locked
+ +

Expensive SQL

+ + + + + + +
LOADEXECUTESSQL_TEXT
5.24%1select round(sum(bytes)/1048576) from dba_segments
6.89%6SELECT round(count(1)*avg(buf.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.buffer_pool = buf.name and buf.name = 'DEFAULT'
7.85%6SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.tablespace_name = tsp.tablespace_name
33.69%89select u.name, o.name, t.spare1, t.pctfree$ from sys.obj$ o, sys.user$ u, sys.tab$ t where (bitand(t.trigflag, 1048576) = 1048576) and o.obj#=t.obj# and o.owner# = u.user#
36.44%89select i.obj#, i.flags, u.name, o.name from sys.obj$ o, sys.user$ u, sys.ind$ i where (bitand(i.flags, 256) = 256 or bitand(i.flags, 512) = 512) and (not((i.type# = 9) and bitand(i.flags,8) = 8)) and o.obj#=i.obj# and o.owner# = u.user#
+ +

+ + + + + + + + + + + + + + +

postgres7

ParameterValueDescription
Ratios  
statistics collectorFALSEMust be set to TRUE to enable hit ratio statistics (stats_start_collector,stats_row_level and stats_block_level must be set to true in postgresql.conf)
data cache hit ratio99.9666031916603 
IO  
data reads15 
data writes0.000000000000000000Count of inserts/updates/deletes * coef
Data Cache  
data cache buffers1280Number of cache buffers. Tuning
cache blocksize8192(estimate)
data cache size10M 
operating system cache size80000K(effective cache size)
Memory Pools  
sort buffer size1MSize of sort buffer (per query)
Connections  
current connections13 
max connections32 
Parameters  
rollback buffers8WAL buffers
random page cost4Cost of doing a seek (default=4). See random_page_cost
+ + + diff --git a/lib/adodb/docs-session.htm b/lib/adodb/docs-session.htm index 790317f181..16ca8cdc5f 100644 --- a/lib/adodb/docs-session.htm +++ b/lib/adodb/docs-session.htm @@ -11,7 +11,7 @@

ADODB Session Management Manual

-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my) +V4.01 23 Oct 2003 (c) 2000-2003 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 diff --git a/lib/adodb/drivers/adodb-access.inc.php b/lib/adodb/drivers/adodb-access.inc.php index 609a91881d..e1078ee5d9 100644 --- a/lib/adodb/drivers/adodb-access.inc.php +++ b/lib/adodb/drivers/adodb-access.inc.php @@ -1,6 +1,6 @@ _errorMsg; } - function ErrorNo() - { - return ifx_error(); - } + function ErrorNo() + { + preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse); //!EOS + if (is_array($parse) && isset($parse[1])) return (int)$parse[1]; + return 0; + } function &MetaColumns($table) diff --git a/lib/adodb/drivers/adodb-mssql.inc.php b/lib/adodb/drivers/adodb-mssql.inc.php index 9f543cb9cd..69fa7d4fb8 100644 --- a/lib/adodb/drivers/adodb-mssql.inc.php +++ b/lib/adodb/drivers/adodb-mssql.inc.php @@ -1,6 +1,6 @@ $v) { + reset($inputarr); + while (list($k,$v) = each($inputarr)) { if (is_array($v)) { if (sizeof($v) == 2) // suggested by g.giunta@libero. OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]); @@ -746,7 +747,8 @@ NATSOFT.DOMAIN = } else { // one statement to bind them all $bindarr = array(); - foreach($inputarr as $k => $v) { + reset($inputarr); + while(list($k,$v) = each($inputarr)) { $bindarr[$k] = $v; OCIBindByName($stmt,":$k",$bindarr[$k],4000); } @@ -763,7 +765,8 @@ NATSOFT.DOMAIN = if (defined('ADODB_PREFETCH_ROWS')) @OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS); if (is_array($inputarr)) { - foreach($inputarr as $k => $v) { + reset($inputarr); + while(list($k,$v) = each($inputarr)) { if (is_array($v)) { if (sizeof($v) == 2) // suggested by g.giunta@libero. OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]); diff --git a/lib/adodb/drivers/adodb-oci805.inc.php b/lib/adodb/drivers/adodb-oci805.inc.php index d93dd80454..704de4175c 100644 --- a/lib/adodb/drivers/adodb-oci805.inc.php +++ b/lib/adodb/drivers/adodb-oci805.inc.php @@ -1,6 +1,6 @@ fetchMode == PGSQL_NUM || $this->fetchMode == PGSQL_BOTH) { - foreach($this->_blobArr as $k => $v) { + reset($this->_blobArr); + while(list($k,$v) = each($this->_blobArr)) { $this->fields[$k] = ADORecordSet_postgres64::_decode($this->fields[$k]); } } if ($this->fetchMode == PGSQL_ASSOC || $this->fetchMode == PGSQL_BOTH) { - foreach($this->_blobArr as $k => $v) { - if (!isset($this->fields[$v])) { - $this->fields = false; - return; - } + reset($this->_blobArr); + while(list($k,$v) = each($this->_blobArr)) { $this->fields[$v] = ADORecordSet_postgres64::_decode($this->fields[$v]); } } diff --git a/lib/adodb/drivers/adodb-postgres7.inc.php b/lib/adodb/drivers/adodb-postgres7.inc.php index 00edb2e31d..8e923eefd3 100644 --- a/lib/adodb/drivers/adodb-postgres7.inc.php +++ b/lib/adodb/drivers/adodb-postgres7.inc.php @@ -1,6 +1,6 @@ SQL Logging enabled

"; - $db->LogSQL(); + $db->LogSQL();/* + $sql = +"SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant, +t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage, +t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm +FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4` + WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic) + AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0')) + ORDER BY t1.time DESC"; + $db->SelectLimit($sql); + echo $db->ErrorMsg();*/ } $ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb')); $db->debug = false; @@ -140,7 +150,7 @@ GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COU else $rs->Close(); //if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ"); - + if ($create) { if (false && $db->databaseType == 'ibase') { print "Please create the following table for testing:

$createtab

"; @@ -448,11 +458,49 @@ END adodb; $time = $db->DBDate(time()); if (empty($HTTP_GET_VARS['hide'])) $db->debug = true; switch($db->databaseType){ - default: + case 'mssqlpo': + case 'mssql': + $sqlt = "CREATE TABLE mytable ( + row1 INT IDENTITY(1,1) NOT NULL, + row2 varchar(16), + PRIMARY KEY (row1))"; + //$db->debug=1; + if (!$db->Execute("delete from mytable")) + $db->Execute($sqlt); + + $ok = $db->Execute("insert into mytable (row2) values ('test')"); + $ins_id=$db->Insert_ID(); + echo "Insert ID=";var_dump($ins_id); + if ($ins_id == 0) Err("Bad Insert_ID()"); + $ins_id2 = $db->GetOne("select row1 from mytable"); + if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2"); + $arr = array(0=>'Caroline',1=>'Miranda'); $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)"; break; + case 'mysql': + $sqlt = "CREATE TABLE `mytable` ( + `row1` int(11) NOT NULL auto_increment, + `row2` varchar(16) NOT NULL default '', + PRIMARY KEY (`row1`), + KEY `myindex` (`row1`,`row2`) +) "; + if (!$db->Execute("delete from mytable")) + $db->Execute($sqlt); + + $ok = $db->Execute("insert into mytable (row2) values ('test')"); + $ins_id=$db->Insert_ID(); + echo "Insert ID=";var_dump($ins_id); + if ($ins_id == 0) Err("Bad Insert_ID()"); + $ins_id2 = $db->GetOne("select row1 from mytable"); + if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2"); + + default: + $arr = array(0=>'Caroline',1=>'Miranda'); + $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)"; + break; + case 'oci8': case 'oci805': $arr = array('first'=>'Caroline','last'=>'Miranda'); @@ -469,7 +517,9 @@ END adodb; else $rs->Close(); $db->debug = false; $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+1,'John','Lim',$time)"); - echo "Insert ID=";var_dump($db->Insert_ID()); + /*$ins_id=$db->Insert_ID(); + echo "Insert ID=";var_dump($ins_id);*/ + if ($db->databaseType == 'mysql') if ($ins_id == 0) Err('Bad Insert_ID'); $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+2,'Mary','Lamb',$time )"); $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+3,'George','Washington',$time )"); $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+4,'Mr. Alan','Tam',$time )"); @@ -1147,7 +1197,29 @@ END adodb; if ($pear) print "

PEAR DB emulation passed.

"; - + $rs = $db->SelectLimit("select ".$db->sysDate." from adoxyz",1); + $date = $rs->fields[0]; + if (!$date) Err("Bad sysDate"); + else { + $ds = $db->UserDate($date,"d m Y"); + if ($ds != date("d m Y")) Err("Bad UserDate: ".$ds); + else echo "Passed UserDate: $ds

"; + } + + $rs = $db->SelectLimit("select ".$db->sysTimeStamp." from adoxyz",1); + $date = $rs->fields[0]; + if (!$date) Err("Bad sysTimeStamp"); + else { + $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y"); + if ($ds != date("H \\h\\r\\s-d m Y")) Err("Bad UserTimeStamp: ".$ds); + else echo "Passed UserTimeStamp: $ds

"; + + $date = 100; + $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y"); + $ds2 = date("H \\h\\r\\s-d m Y",$date); + if ($ds != $ds2) Err("Bad UserTimeStamp 2: $ds: $ds2"); + else echo "Passed UserTimeStamp 2: $ds

"; + } if ($db->hasTransactions) { //$db->debug=1; echo "

Testing StartTrans CompleteTrans

"; diff --git a/lib/adodb/tests/test2.php b/lib/adodb/tests/test2.php index c6492807fc..266fdd8259 100644 --- a/lib/adodb/tests/test2.php +++ b/lib/adodb/tests/test2.php @@ -8,7 +8,7 @@ \n"; for ($i=0; $i < $ncols; $i++) { - $v = ($numoffset)? $rs->fields[$i] : next($rs->fields); + if ($i===0) $v=($numoffset) ? $rs->fields[0] : reset($rs->fields); + else $v = ($numoffset) ? $rs->fields[$i] : next($rs->fields); + $type = $typearr[$i]; switch($type) { case 'T': -- 2.39.5