<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
$ADODB_INCLUDED_CSV = 1;\r
\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
/**\r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license.\r
Whenever there is any discrepancy between the two licenses,\r
the BSD license will take precedence.\r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
$ADODB_INCLUDED_LIB = 1;\r
\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
Please note, this class is entirely unsupported, \r
and no free support requests except for bug reports\r
will be entertained by the author.\r
- \r
- My company also sells a commercial pagination \r
- object at http://phplens.com/ with much more \r
- functionality, including search, create, edit,\r
- delete records. \r
+\r
*/\r
class ADODB_Pager {\r
var $id; // unique id for pager (defaults to 'adodb')\r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
\r
if (!empty($conn->_logsql)) {\r
$conn->_logsql = false; // disable logsql error simulation\r
+ $dbT = $conn->databaseType;\r
\r
$a0 = split(' ',$t0);\r
$a0 = (float)$a0[1]+(float)$a0[0];\r
if (!$rs) {\r
$errM = $conn->ErrorMsg();\r
$errN = $conn->ErrorNo();\r
+ $conn->lastInsID = 0;\r
$tracer = substr('ERROR: '.htmlspecialchars($errM),0,250);\r
} else {\r
$tracer = '';\r
$errM = '';\r
$errN = 0;\r
+ $conn->lastInsID = $conn->Insert_ID();\r
+ \r
}\r
if (isset($HTTP_SERVER_VARS['HTTP_HOST'])) {\r
$tracer .= '<br>'.$HTTP_SERVER_VARS['HTTP_HOST'];\r
\r
$saved = $conn->debug;\r
$conn->debug = 0;\r
- $dbT = $conn->databaseType;\r
+ \r
if ($conn->dataProvider == 'oci8' && $dbT != 'oci8po') {\r
$isql = "insert into adodb_logsql values($conn->sysTimeStamp,:b,:c,:d,:e,:f)";\r
} else if ($dbT == 'odbc_mssql' || $dbT == 'informix') {\r
<?php\r
/*\r
- V3.92 2 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
--- /dev/null
+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;
+ }
--- /dev/null
+<!--
+ IE 6 makes the page to wide with the following doctype. I accept
+ standards if they help me, not if they make anything even harder!
+//-->
+<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
+<!--NewPage-->
+<HTML>
+<HEAD>
+ <!-- Generated by PhpDoc date: 'Sat, 3 May 2003 13:13:37 -0400' -->
+ <TITLE>Docs for page adodb-xmlschema.php</TITLE>
+<LINK REL ='stylesheet' TYPE='text/css' HREF='../media/stylesheet.css' TITLE='Style'>
+</HEAD>
+<BODY BGCOLOR='white'>
+<a name="top"><!-- --></a><h3><SPAN class="type">File:</SPAN> Program_Root/adodb-xmlschema.php<HR>
+</h3>
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">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.</div>
+<UL>
+ <LI><b>copyright:</b> <CODE>Copyright © 2003 ars Cognita Inc., all rights reserved</CODE></LI>
+ <LI><b>version:</b> <CODE>$revision: $</CODE></LI>
+ <LI><b>author:</b> <CODE>Richard Tango-Lowy</CODE></LI>
+ </UL>
+Classes in this file:
+<dl>
+<dt></dt>
+ <dd>Creates a table object in ADOdb's datadict format</dd>
+<dt></dt>
+ <dd>Creates an index object in ADOdb's datadict format</dd>
+<dt></dt>
+ <dd>Creates the SQL to execute a list of provided SQL queries</dd>
+<dt><a href="../xmlschema/adoSchema.html">adoSchema</a></dt>
+ <dd>Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</dd>
+</dl>
+<hr>
+<!-- =========== INCLUDE SUMMARY =========== -->
+<A NAME='include_summary'><!-- --></A>
+<H3>Include Statements Summary</H3>
+
+<UL>
+ <LI><CODE><A HREF="#_adodb_inc_php">include</A></CODE> = <CODE class="varsummarydefault">"adodb.inc.php"</CODE>
+ <BR>Include the main ADODB library
+ </UL>
+<hr>
+<!-- =========== GLOBAL VARIABLE SUMMARY =========== -->
+<A NAME='global_summary'><!-- --></A>
+<H3>Global Variable Summary</H3>
+
+<UL>
+ </UL>
+
+<hr>
+<!-- =========== CONSTANT SUMMARY =========== -->
+<A NAME='constant_summary'><!-- --></A>
+<H3>Constant Summary</H3>
+
+<UL>
+ </UL>
+<hr>
+<!-- =========== FUNCTION SUMMARY =========== -->
+<A NAME='function_summary'><!-- --></A>
+<H3>Function Summary</H3>
+
+<UL>
+ </UL>
+<hr>
+<!-- ============ INCLUDE DETAIL =========== -->
+
+<A NAME='include_detail'></A>
+<H3>Include Statements Detail</H3>
+
+<UL>
+ <A NAME="_adodb_inc_php"><!-- --></A>
+ <LI><SPAN class="code">include file:</SPAN> = <CODE class="varsummarydefault">"adodb.inc.php"</CODE> [line <span class="linenumber">31</span>]<br />
+ <BR><BR>
+ <!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Include the main ADODB library</div>
+<UL>
+ </UL>
+ </UL>
+<hr>
+<!-- ============ GLOBAL VARIABLE DETAIL =========== -->
+
+<A NAME='global_detail'></A>
+<H3>Global Variable Detail</H3>
+
+<UL>
+ </UL>
+<hr>
+<!-- ============ CONSTANT DETAIL =========== -->
+
+<A NAME='constant_detail'></A>
+<H3>Constant Detail</H3>
+
+<UL>
+ </UL>
+<hr>
+<!-- ============ FUNCTION DETAIL =========== -->
+
+<A NAME='function_detail'></A>
+<H3>Function Detail</H3>
+
+<UL>
+</UL>
+<hr>
+ <div id="credit">
+ <hr>
+ Documention generated on Sat, 3 May 2003 13:13:37 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
+ </div>
+</body>
+</html>
+</HTML>
\ No newline at end of file
--- /dev/null
+<!--
+ IE 6 makes the page to wide with the following doctype. I accept
+ standards if they help me, not if they make anything even harder!
+//-->
+<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
+<!--NewPage-->
+<HTML>
+<HEAD>
+ <!-- Generated by PhpDoc date: 'Sat, 3 May 2003 13:13:37 -0400' -->
+ <TITLE>Docs For Class adoSchema</TITLE>
+<LINK REL ='stylesheet' TYPE='text/css' HREF='../media/stylesheet.css' TITLE='Style'>
+</HEAD>
+<BODY BGCOLOR='white'>
+<a name="top"><!-- --></a><!-- Start of Class Data -->
+<H3>
+ <SPAN class="type">Class</SPAN> adoSchema
+ <HR>
+</H3>
+[line <span class="linenumber">379</span>]<br />
+<pre>
+</pre>
+<SPAN class="type">Location:</SPAN> Program_Root/adodb-xmlschema.php
+<hr>
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</div>
+<div class="desc"><p>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.</p></div>
+<UL>
+ </UL>
+<hr>
+<!-- =========== VAR SUMMARY =========== -->
+<A NAME='var_summary'><!-- --></A>
+<H3>Class Variable Summary</H3>
+
+<UL>
+ <!-- =========== Summary =========== -->
+ <LI><CODE><a href="../xmlschema/adoSchema.html#var$dbconn">$dbconn</a></CODE> = <CODE class="varsummarydefault"></CODE>
+ <BR>
+
+ <!-- =========== Summary =========== -->
+ <LI><CODE><a href="../xmlschema/adoSchema.html#var$dbType">$dbType</a></CODE> = <CODE class="varsummarydefault"></CODE>
+ <BR>
+
+ <!-- =========== Summary =========== -->
+ <LI><CODE><a href="../xmlschema/adoSchema.html#var$dict">$dict</a></CODE> = <CODE class="varsummarydefault"></CODE>
+ <BR>
+
+ <!-- =========== Summary =========== -->
+ <LI><CODE><a href="../xmlschema/adoSchema.html#var$sqlArray">$sqlArray</a></CODE> = <CODE class="varsummarydefault"></CODE>
+ <BR>
+
+ <!-- =========== Summary =========== -->
+ <LI><CODE><a href="../xmlschema/adoSchema.html#var$xmlParser">$xmlParser</a></CODE> = <CODE class="varsummarydefault"></CODE>
+ <BR>
+
+ </UL>
+<hr>
+<!-- =========== INHERITED VAR SUMMARY =========== -->
+<A NAME='inheritedvar_summary'><!-- --></A>
+<H3>Inherited Class Variable Summary</H3>
+
+
+<hr>
+<!-- =========== METHOD SUMMARY =========== -->
+<A NAME='method_summary'><!-- --></A>
+<H3>Method Summary</H3>
+
+<UL>
+ <!-- =========== Summary =========== -->
+ <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodadoSchema'>void adoSchema()</A></CODE>
+ <BR>Constructor.
+ <!-- =========== Summary =========== -->
+ <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodDestroy'>void Destroy()</A></CODE>
+ <BR>Destructor
+ <!-- =========== Summary =========== -->
+ <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodExecuteSchema'>integer ExecuteSchema()</A></CODE>
+ <BR>Loads a schema into the database
+ <!-- =========== Summary =========== -->
+ <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodParseSchema'>array ParseSchema()</A></CODE>
+ <BR>Loads and parses an XML file
+ </UL>
+
+<!-- =========== INHERITED METHOD SUMMARY =========== -->
+<A NAME='methods_inherited'><!-- --></A>
+<H3>Inherited Method Summary</H3>
+
+<hr>
+<!-- ============ METHOD DETAIL =========== -->
+
+<A NAME='method_detail'></A>
+<H3>Method Detail</H3>
+
+<UL>
+<A NAME='methodadoSchema'><!-- --></A>
+
+<LI><SPAN class="code">Constructor void adoSchema()</SPAN> [line <span class="linenumber">441</span>]
+<BR><BR>
+<SPAN class="type">Usage:</SPAN> <SPAN class="code">adoSchema(
+object
+$dbconn)</SPAN>
+<BR><BR>
+
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Constructor.</div>
+<div class="desc"><p>Initializes the xmlschema object</p></div>
+ <H4>Parameters</H4>
+ <UL>
+ <LI><SPAN class="code">object $dbconn</SPAN> - ADOdb connection object
+ </UL>
+
+ <H4>Info</H4>
+ <UL>
+ </UL>
+ <p class="top">[ <a href="#top">Top</a> ]</p>
+<BR>
+<A NAME='methodDestroy'><!-- --></A>
+
+<LI><SPAN class="code">void Destroy()</SPAN> [line <span class="linenumber">725</span>]
+<BR><BR>
+<SPAN class="type">Usage:</SPAN> <SPAN class="code">Destroy(
+)</SPAN>
+<BR><BR>
+
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Destructor</div>
+
+ <H4>Info</H4>
+ <UL>
+ </UL>
+ <p class="top">[ <a href="#top">Top</a> ]</p>
+<BR>
+<A NAME='methodExecuteSchema'><!-- --></A>
+
+<LI><SPAN class="code">integer ExecuteSchema()</SPAN> [line <span class="linenumber">504</span>]
+<BR><BR>
+<SPAN class="type">Usage:</SPAN> <SPAN class="code">ExecuteSchema(
+array
+$sqlArray, [boolean
+$continueOnErr = TRUE])</SPAN>
+<BR><BR>
+
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Loads a schema into the database</div>
+<div class="desc"><p>Accepts an array of SQL queries generated by the parser and executes them.</p></div>
+ <H4>Parameters</H4>
+ <UL>
+ <LI><SPAN class="code">array $sqlArray</SPAN> - Array of SQL statements
+ <LI><SPAN class="code">boolean $continueOnErr</SPAN> - Don't fail out if an error is encountered
+ </UL>
+
+ <H4>Info</H4>
+ <UL>
+ <LI><B>return</B>: <CODE>0 if failed, 1 if errors, 2 if successful</CODE>
+ </UL>
+ <p class="top">[ <a href="#top">Top</a> ]</p>
+<BR>
+<A NAME='methodParseSchema'><!-- --></A>
+
+<LI><SPAN class="code">array ParseSchema()</SPAN> [line <span class="linenumber">465</span>]
+<BR><BR>
+<SPAN class="type">Usage:</SPAN> <SPAN class="code">ParseSchema(
+string
+$file)</SPAN>
+<BR><BR>
+
+<!-- ========== Info from phpDoc block ========= -->
+<div class="sdesc">Loads and parses an XML file</div>
+<div class="desc"><p>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.</p></div>
+ <H4>Parameters</H4>
+ <UL>
+ <LI><SPAN class="code">string $file</SPAN> - XML file
+ </UL>
+
+ <H4>Info</H4>
+ <UL>
+ <LI><B>return</B>: <CODE>Array of SQL queries, ready to execute</CODE>
+ </UL>
+ <p class="top">[ <a href="#top">Top</a> ]</p>
+<BR>
+</UL>
+<hr>
+<!-- ============ VARIABLE DETAIL =========== -->
+
+<A NAME='variable_detail'></A>
+
+<H3>Variable Detail</H3>
+
+<UL>
+<A NAME="var$dbconn"><!-- --></A>
+<LI><SPAN class="code">$dbconn</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">394</span>]</LI>
+<LI><b>Data type:</b> <CODE class="varsummarydefault">ADOdb</CODE></LI>
+<!-- ========== Info from phpDoc block ========= -->
+<UL>
+ <LI><b>var:</b> <CODE>connection object</CODE></LI>
+ </UL>
+<BR>
+<A NAME="var$dbType"><!-- --></A>
+<LI><SPAN class="code">$dbType</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">399</span>]</LI>
+<LI><b>Data type:</b> <CODE class="varsummarydefault">string</CODE></LI>
+<!-- ========== Info from phpDoc block ========= -->
+<UL>
+ <LI><b>var:</b> <CODE>Database type (platform)</CODE></LI>
+ </UL>
+<BR>
+<A NAME="var$dict"><!-- --></A>
+<LI><SPAN class="code">$dict</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">404</span>]</LI>
+<LI><b>Data type:</b> <CODE class="varsummarydefault">ADOdb</CODE></LI>
+<!-- ========== Info from phpDoc block ========= -->
+<UL>
+ <LI><b>var:</b> <CODE>Data Dictionary</CODE></LI>
+ </UL>
+<BR>
+<A NAME="var$sqlArray"><!-- --></A>
+<LI><SPAN class="code">$sqlArray</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">384</span>]</LI>
+<LI><b>Data type:</b> <CODE class="varsummarydefault">array</CODE></LI>
+<!-- ========== Info from phpDoc block ========= -->
+<UL>
+ <LI><b>var:</b> <CODE>Array containing SQL queries to generate all objects</CODE></LI>
+ </UL>
+<BR>
+<A NAME="var$xmlParser"><!-- --></A>
+<LI><SPAN class="code">$xmlParser</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">389</span>]</LI>
+<LI><b>Data type:</b> <CODE class="varsummarydefault">XML</CODE></LI>
+<!-- ========== Info from phpDoc block ========= -->
+<UL>
+ <LI><b>var:</b> <CODE>Parser object</CODE></LI>
+ </UL>
+<BR>
+</UL>
+<hr>
+ <div id="credit">
+ <hr>
+ Documention generated on Sat, 3 May 2003 13:13:37 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
+ </div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<H1>adodb-xmlschema</H1>
+<P>Written by <a href="mailto:richtl@arscognita.com">Richard Tango-Lowy</a>.</P>
+<P>For more information, contact <a href="richtl@arscognita.com">richtl@arscognita.com</a>
+or visit our site at <a href="http://www.arscognita.com">www.arscognita.com</a>.</P>
+<P>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.)
+
+<H2>Introduction</H2>
+<P><B>adodb-xmlschema</B> is a class that allows the user to quickly and easily
+build a database on any ADOdb-supported platform using a simple XML format.</P>
+<P>This library is dual-licensed under a BSD-style license and under the <B><a href="http://opensource.org/licenses/lgpl-license.php">GNU Lesser Public License</a></B>.
+See the <B>LICENSE</B> file for more information.</P>
+
+<H2>Features</H2><UL>
+ <LI>Darned easy to install
+ <LI>Quickly to create schemas that build on any platform supported by ADODB.</UL>
+
+<H2>Installation</H2>
+<P>To install adodb-xmlschema, simply copy the <tt>adodb-xmlschema.php</tt> file into your
+<B>ADODB</B> directory.</P>
+
+<H2>Quick Start</H2>
+<P>First, create an XML database schema. Let's call it "schema.xml:"</P><PRE>
+<?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>
+</PRE><P>Create a new database using the appropriate tool for your platform.
+Executing the following PHP code will create the a <i>mytable</i> and <i>myindex</i>
+in the database and insert two rows into <i>mytable</i>. </P><PRE>
+// 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 = <B>new adoSchema</B>( $db );
+
+// Build the SQL array
+$sql = $schema-><B>ParseSchema</B>( "schema.xml" );
+
+// Execute the SQL on the database
+$result = $schema-><B>ExecuteSchema</B>( $sql );
+
+// Finally, clean up after the XML parser
+// (PHP won't do this for you!)
+$schema-><B>Destroy</B>();
+</PRE>
+
+<H2>XML Schema Format:</H2>
+<P>(See <a href="../xmlschema.dtd">ADOdb_schema.dtd</a> for the full specification)</P>
+<PRE>
+<?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>
+ ... <i>more fields</i>
+ </table>
+ ... <i>more tables</i>
+
+ <index name="indexname" platform="platform1|platform2|...">
+ <descr>Optional description</descr>
+ <col>fieldname</col>
+ ... <i>more columns</i>
+ </index>
+ ... <i>more indices</i>
+
+ <sql platform="platform1|platform2|...">
+ <descr>Optional description</descr>
+ <query platform="platform1|platform2|...">SQL query</query>
+ ... <i>more queries</i>
+ </sql>
+ ... <i>more SQL</i>
+ </schema>
+</PRE>
+<HR>
+<H2>Thanks</H2>
+<P>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.</P>
+<P>And to the kind folks at <a href="http://phpdoc.org">PHP Documentor</a>. Cool tool.</P>
+<P>And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)</P>
+<HR>
+<address>If you have any questions or comments, please email them to me at
+<a href="mailto:richtl@arscognita.com">richtl@arscognita.com</a>.</address>
+
+<P><TT>$Id$</TT></P>
\ No newline at end of file
/**\r
\mainpage \r
\r
- @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim\@natsoft.com.my). All rights reserved.\r
+ @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim\@natsoft.com.my). All rights reserved.\r
\r
Released under both BSD license and Lesser GPL library license. You can choose which license\r
you prefer.\r
/**\r
* ADODB version as a string.\r
*/\r
- $ADODB_vers = 'V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';\r
+ $ADODB_vers = 'V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';\r
\r
/**\r
* Determines whether recordset->RecordCount() is used. \r
var $metaTablesSQL = '';\r
var $uniqueOrderBy = false; /// All order by columns have to be unique\r
var $emptyDate = ' ';\r
+ var $emptyTimeStamp = ' ';\r
+ var $lastInsID = false;\r
//--\r
var $hasInsertID = false; /// supports autoincrement ID?\r
var $hasAffectedRows = false; /// supports affected rows for update/delete?\r
if (!$array_2d) $inputarr = array($inputarr);\r
while(list(,$arr) = each($inputarr)) {\r
$sql = ''; $i = 0;\r
- foreach($arr as $v) {\r
+ reset($arr);\r
+ while(list(,$v) = each($arr)) {\r
$sql .= $sqlarr[$i];\r
// from Ron Baldwin <ron.baldwin@sourceprose.com>\r
// Only quote string types \r
*/ \r
function Insert_ID()\r
{\r
- if ($this->hasInsertID) return $this->_insertid();\r
- if ($this->debug) ADOConnection::outp( '<p>Insert_ID error</p>');\r
- return false;\r
+ if ($this->_logsql && $this->lastInsID) return $this->lastInsID;\r
+ if ($this->hasInsertID) return $this->_insertid();\r
+ if ($this->debug) ADOConnection::outp( '<p>Insert_ID error</p>');\r
+ return false;\r
}\r
\r
\r
function UnixTimeStamp($v)\r
{\r
if (!preg_match( \r
- "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]+(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", \r
+ "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]*(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", \r
($v), $rr)) return false;\r
\r
if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0;\r
\r
}\r
\r
+ /**\r
+ *\r
+ * @param v is the character timestamp in YYYY-MM-DD hh:mm:ss format\r
+ * @param fmt is the format to apply to it, using date()\r
+ *\r
+ * @return a timestamp formated as user desires\r
+ */\r
+ function UserTimeStamp($v,$fmt='Y-m-d H:i:s')\r
+ {\r
+ if (is_numeric($v)) return adodb_date($fmt,$v);\r
+ $tt = $this->UnixTimeStamp($v);\r
+ // $tt == -1 if pre TIMESTAMP_FIRST_YEAR\r
+ if (($tt === false || $tt == -1) && $v != false) return $v;\r
+ if ($tt == 0) return $this->emptyTimeStamp;\r
+ return adodb_date($fmt,$tt);\r
+ }\r
+ \r
\r
/**\r
* Correctly quotes a string so that all strings are escaped. We prefix and append\r
*/\r
function UserTimeStamp($v,$fmt='Y-m-d H:i:s')\r
{\r
+ if (is_numeric($v)) return adodb_date($fmt,$v);\r
$tt = $this->UnixTimeStamp($v);\r
// $tt == -1 if pre TIMESTAMP_FIRST_YEAR\r
if (($tt === false || $tt == -1) && $v != false) return $v;\r
- if ($tt == 0) return $this->emptyTimeStamp;\r
+ if ($tt === 0) return $this->emptyTimeStamp;\r
return adodb_date($fmt,$tt);\r
}\r
\r
{\r
\r
if (!preg_match( \r
- "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]+(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", \r
+ "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ ,-]*(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", \r
($v), $rr)) return false;\r
if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0;\r
\r
}\r
\r
$record = array();\r
- foreach($this->bind as $k => $v) {\r
+ reset($this->bind);\r
+ while(list($k,$v) = each($this->bind)) {\r
+ //echo " $k $v, ";\r
+ //foreach($this->bind as $k => $v) {\r
$record[$k] = $this->fields[$v];\r
}\r
\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
function _IndexSQL($idxname, $tabname, $flds, $idxoptions)\r
{\r
//if (isset($idxoptions['REPLACE'])) $sql[] = "DROP INDEX IF EXISTS $idxname";\r
+ if (isset($idxoptions['REPLACE'])) $sql[] = "DROP INDEX $idxname ON $tabname";\r
if (isset($idxoptions['FULLTEXT'])) $unique = ' FULLTEXT';\r
else if (isset($idxoptions['UNIQUE'])) $unique = ' UNIQUE';\r
else $unique = '';\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/**\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<body bgcolor="#FFFFFF">\r
\r
<h2>ADOdb Library for PHP</h2>\r
-<p>V4.00 20 Oct 2003 (c) 2000-2003 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>)</p>\r
+<p>V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com)</p>\r
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This \r
means you can use it in compiled proprietary and commercial products.</font></p>\r
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>\r
<a href="#executecursor">ExecuteCursor</a> \r
(oci8 only)<br>\r
Generates SQL strings: <a href="#getupdatesql">GetUpdateSQL</a> <a href="#getinsertsql">GetInsertSQL</a> \r
- <a href="#ifnull">IfNull</a> <a href="#concat">Concat</a> <a href="#qstr"></a><a href="#param">Param</a> \r
+ <a href="#concat">Concat</a> <a href="#ifnull">IfNull</a> <a href="#substr">substr</a> <a href="#qstr"></a><a href="#param">Param</a> \r
<a href="#prepare"></a><a href="#OffsetDate">OffsetDate</a> <a href="#SQLDate">SQLDate</a> \r
<a href="#dbdate">DBDate</a> <a href="#dbtimestamp"></a> <a href="#dbtimestamp">DBTimeStamp</a><br>\r
Blobs: <a href="#updateblob">UpdateBlob</a> <a href="#updateclob">UpdateClob</a> \r
<a href="#begintrans">BeginTrans</a> <a href="#committrans">CommitTrans</a> \r
<a href="#rollbacktrans">RollbackTrans</a> <br>\r
Fetching Data: </font> <font size="2"><a href="#setfetchmode">SetFetchMode</a><br>\r
- Strings: <a href="#concat">concat</a> <a href="#qstr">qstr</a> <a href="#quote">quote</a><br>\r
+ Strings: <a href="#concat">concat</a> <a href="#qstr">qstr</a> <a href="#quote">quote</a> <a href="#substr">substr</a><br>\r
Dates: <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a href="#unixdate">UnixDate</a> \r
<a href="#unixtimestamp">UnixTimeStamp</a> <a href="#OffsetDate">OffsetDate</a> \r
<a href="#SQLDate">SQLDate</a> <br>\r
</font><font size="2">Deprecated: <a href="#bind">Bind</a> <a href="#blankrecordset">BlankRecordSet</a></font><br>\r
<a href="#adorecordSet"><b><br>\r
ADORecordSet</b></a><br>\r
- <font size="2">Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a> \r
+ <font size="2">\r
+ Returns one field: <a href="#fields">Fields</a><br>\r
+ Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a> \r
<a href="#fetchobject">FetchObject</a> <a href="#fetchnextobject">FetchNextObject</a> \r
- <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a><br>\r
+ <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a>\r
+ <a href="#getrowassoc">GetRowAssoc</a> <br>\r
Returns all rows:<a href="#getarray">GetArray</a> <a href="#getrows">GetRows</a> \r
<a href="#getassoc">GetAssoc</a><br>\r
Scrolling:<a href="#move">Move</a> <a href="#movenext">MoveNext</a> <a href="#movefirst">MoveFirst</a> \r
<a href="#nextrecordset">NextRecordSet</a><br>\r
Field Info:<a href="#fieldcount">FieldCount</a> <a href="#fetchfield">FetchField</a> \r
<a href="#metatype">MetaType</a><br>\r
- Cleanup: <a href="#rsclose">Close</a></font> <font size="2"><br>\r
- Deprecated: <a href="#getrowassoc">GetRowAssoc</a> <a href="#fields">Fields</a></font> \r
+ Cleanup: <a href="#rsclose">Close</a></font> <font size="2"></font> \r
<p><font size="2"><a href="#rs2html"><b>rs2html</b></a> <a href="#exrs2html">example</a></font><br>\r
<a href="#adodiff">Differences between ADOdb and ADO</a><br>\r
<a href="#driverguide"><b>Database Driver Guide<br>\r
the function that checks whether a $field is null for the given database, and \r
if null, change the value returned to $nullReplacementValue. Eg.</p>\r
<pre>$sql = <font color="#993300">'SELECT '</font>.$db->IfNull('name', <font color="#993300">"'- unknown -'"</font>).<font color="#993300"> ' FROM table'</font>;</pre>\r
+<p><b>substr<a name="substr"></a></b></p>\r
+<p>This is not a function, but a property. Some databases have "substr" and others "substring"\r
+as the function to retrieve a sub-string. To use this property:\r
+<pre>\r
+ $sql = <font color="#993300">"SELECT "</font>.$db->substr.<font color="#993300">"(field, $offset, $length) from table"</font>;\r
+ $rs = $db->Execute($sql);\r
+</pre>\r
+<p>For all databases, the 1st parameter of <i>substr</i> is the field, the 2nd is the\r
+offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.\r
<p><b>Param<a name="param"></a>($name )</b></p>\r
<p>Generates a bind placeholder portably. For most databases, the bind placeholder \r
is "?". However some databases use named bind parameters such as Oracle, eg \r
<p>Internally calls Move(RecordCount()-1). Note that some databases do not support \r
this function.</p>\r
<p><b>GetRowAssoc</b><a name="getrowassoc"></a>($toUpper=true)</p>\r
-<p>The above function is no longer the prefered way of getting associative arrays. \r
- Use the <a href=#adodb_fetch_mode>$ADODB_FETCH_MODE</a> variable instead. </p>\r
<p>Returns an associative array containing the current row. The keys to the array \r
are the column names. The column names are upper-cased for easy access. To get \r
the next row, you will still need to call MoveNext(). </p>\r
<p>Returns true if at last page (1-based). Requires PageExecute()/CachePageExecute() \r
to be called. See <a href=#ex8>Example 8</a>.</p>\r
<p><b>Fields</b><a name="fields"></a>(<b>$colname</b>)</p>\r
-<p>This function is deprecated. Use <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> \r
- instead. </p>\r
-<p>Some database extensions (eg. MySQL) return arrays that are both associative \r
- and indexed if you use the native extensions. GetRowAssoc() does not return \r
- arrays that combine associative and indexed elements. Returns the value of the \r
+<p>Returns the value of the \r
associated column $<b>colname</b> for the current row. The column name is case-insensitive.</p>\r
+<p>This is a convenience function. For higher performance, use <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a>. </p>\r
<p><b>FetchRow</b><a name="fetchrow"></a>()</p>\r
</font> \r
<p><font color="#000000">Returns array containing current row, or false if EOF. \r
PHP</a>. </p>\r
</font> \r
<h2>Change Log<a name="Changes"></a><a name="changelog"></a></h2>\r
-<p><b>4.00 ?? 2003 </b>\r
+<p><b>4.01 23 Oct 2003 </b>\r
+<p>Informix ErrorNo() fixed.\r
+<p>Modified PostgreSQL _fixblobs to use list/each instead of foreach.\r
+<p>Modified several places to use list/each, including GetRowAssoc().\r
+<p>Fixed insert_id() incorrectly generated when logsql() enabled.\r
+<p>Added UserTimeStamp() to connection class.\r
+<p><b>4.00 20 Oct 2003 </b>\r
<p>Upgraded adodb-xmlschema to 1 Oct 2003 snapshot.\r
<p>Fix to rs2html warning message. Thx to Filo.\r
<p>Fix for odbc_mssql/mssql SQLDate(), hours was wrong.\r
<p>ChangeTableSQL contributed by Florian Buzin. \r
<p>The odbc_mssql driver now sets CONCAT_NULL_YIELDS_NULL OFF for compat with \r
mssql driver. \r
-<p><b>3.50 19 May 2003</b></p>\r
-<p>Fixed mssql compat with FreeTDS. FreeTDS does not implement mssql_fetch_assoc(). \r
-<p>Merged back connection and recordset code into adodb.inc.php. \r
-<p>ADOdb sessions using oracle clobs contributed by achim.gosse#ddd.de. See adodb-session-clob.php. \r
-<p>Added /s modifier to preg_match everywhere, which ensures that regex does not \r
- stop at /n. Thx Pao-Hsi Huang. \r
-<p>Fixed error in metacolumns() for mssql. \r
-<p>Added time format support for SQLDate. \r
-<p>Image => B added to metatype. \r
-<p>MetaType now checks empty($this->blobSize) instead of empty($this). \r
-<p>Datadict has beta support for informix, sybase (mapped to mssql), db2 and generic \r
- (which is a fudge). \r
-<p>BlobEncode for postgresql uses pg_escape_bytea, if available. Needed for compat \r
- with 7.3. \r
-<p>Added $ADODB_LANG, to support multiple languages in MetaErrorMsg(). \r
-<p>Datadict can now parse table definition as declarative text. \r
-<p>For DataDict, oci8 autoincrement trigger missing semi-colon. Fixed. \r
-<p>For DataDict, when REPLACE flag enabled, drop sequence in datadict for autoincrement \r
- field in postgres and oci8.s \r
-<p>Postgresql defaults to template1 database if no database defined in connect/pconnect. \r
-<p>We now clear _resultid in postgresql if query fails. \r
-<p><b>3.40 19 May 2003</b></p>\r
-<p>Added insert_id for odbc_mssql. \r
-<p>Modified postgresql UpdateBlobFile() because it did not work in safe mode. \r
-<p>Now connection object is passed to raiseErrorFn as last parameter. Needed by \r
- StartTrans(). \r
-<p>Added StartTrans() and CompleteTrans(). It is recommended that you do not modify \r
- transOff, but use the above functions. \r
-<p>oci8po now obeys ADODB_ASSOC_CASE settings. \r
-<p>Added virtualized error codes, using PEAR DB equivalents. Requires you to manually \r
- include adodb-error.inc.php yourself, with MetaError() and MetaErrorMsg($errno). \r
-<p>GetRowAssoc for mysql and pgsql were flawed. Fix by Ross Smith. \r
-<p>Added to datadict types I1, I2, I4 and I8. Changed datadict type 'T' to map \r
- to timestamp instead of datetime for postgresql. \r
-<p>Error handling in ExecuteSQLArray(), adodb-datadict.inc.php did not work. \r
-<p>We now auto-quote postgresql connection parameters when building connection \r
- string. \r
-<p>Added session expiry notification. \r
-<p>We now test with odbc mysql - made some changes to odbc recordset constructor. \r
-<p>MetaColumns now special cases access and other databases for odbc. \r
-<p><b>3.31 17 March 2003</b></p>\r
-<p>Added row checking for _fetch in postgres. \r
-<p>Added Interval type to MetaType for postgres. \r
-<p>Remapped postgres driver to call postgres7 driver internally. \r
-<p>Adorecordset_array::getarray() did not return array when nRows >= 0. \r
-<p>Postgresql: at times, no error message returned by pg_result_error() but error \r
- message returned in pg_last_error(). Recoded again. \r
-<p>Interbase blob's now use chunking for updateblob. \r
-<p>Move() did not set EOF correctly. Reported by Jorma T. \r
-<p>We properly support mysql timestamp fields when we are creating mysql tables \r
- using the data-dict interface. \r
-<p>Table regex includes backticks character now. \r
-<p><b>3.30 3 March 2003</b></p>\r
-<p>Added $ADODB_EXTENSION and $ADODB_COMPAT_FETCH constant. \r
-<p>Made blank1stItem configurable using syntax "value:text" in GetMenu/GetMenu2. \r
- Thx to Gabriel Birke. \r
-<p>Previously ADOdb differed from the Microsoft standard because it did not define \r
- what to set $this->fields when EOF was reached. Now at EOF, ADOdb sets $this->fields \r
- to false for all databases, which is consist with Microsoft's implementation. \r
- Postgresql and mysql have always worked this way (in 3.11 and earlier). If you \r
- are experiencing compatibility problems (and you are not using postgresql nor \r
- mysql) on upgrading to 3.30, try setting the global variables $ADODB_COUNTRECS \r
- = true (which is the default) and $ADODB_FETCH_COMPAT = true (this is a new \r
- global variable). \r
-<p>We now check both pg_result_error and pg_last_error as sometimes pg_result_error \r
- does not display anything. Iman Mayes \r
-<p> We no longer check for magic quotes gpc in Quote(). \r
-<p> Misc fixes for table creation in adodb-datadict.inc.php. Thx to iamsure. \r
-<p> Time calculations use adodb_time library for all negative timestamps due to \r
- problems in Red Hat 7.3 or later. Formerly, only did this for Windows. \r
-<p> In mssqlpo, we now check if $sql in _query is a string before we change || \r
- to +. This is to support prepared stmts. \r
-<p> Move() and MoveLast() internals changed to support to support EOF and $this->fields \r
- change. \r
-<p> Added ADODB_FETCH_BOTH support to mssql. Thx to Angel Fradejas afradejas#mediafusion.es \r
-<p> We now check if link resource exists before we run mysql_escape_string in \r
- qstr(). \r
-<p> Before we flock in csv code, we check that it is not a http url. \r
-<p><b>3.20 17 Feb 2003</b></p>\r
-<p>Added new Data Dictionary classes for creating tables and indexes. Warning \r
- - this is very much alpha quality code. The API can still change. See adodb/tests/test-datadict.php \r
- for more info. \r
-<p>We now ignore $ADODB_COUNTRECS for mysql, because PHP truncates incomplete \r
- recordsets when mysql_unbuffered_query() is called a second time. \r
-<p>Now postgresql works correctly when $ADODB_COUNTRECS = false. \r
-<p>Changed _adodb_getcount to properly support SELECT DISTINCT. \r
-<p>Discovered that $ADODB_COUNTRECS=true has some problems with prepared queries \r
- - suspect PHP bug. \r
-<p>Now GetOne and GetRow run in $ADODB_COUNTRECS=false mode for better performance. \r
-<p>Added support for mysql_real_escape_string() and pg_escape_string() in qstr(). \r
-<p>Added an intermediate variable for mysql _fetch() and MoveNext() to store fields, \r
- to prevent overwriting field array with boolean when mysql_fetch_array() returns \r
- false. \r
-<p>Made arrays for getinsertsql and getupdatesql case-insensitive. Suggested by \r
- Tim Uckun" tim#diligence.com \r
-<p><b>3.11 11 Feb 2003</b></p>\r
-<p>Added check for ADODB_NEVER_PERSIST constant in PConnect(). If defined, then \r
- PConnect() will actually call non-persistent Connect(). \r
-<p>Modified interbase to properly work with Prepare(). \r
-<p>Added $this->ibase_timefmt to allow you to change the date and time format. \r
-<p>Added support for $input_array parameter in CacheFlush(). \r
-<p>Added experimental support for dbx, which was then removed when i found that \r
- it was slower than using native calls. \r
-<p>Added MetaPrimaryKeys for mssql and ibase/firebird. \r
-<p>Added new $trim parameter to GetCol and CacheGetCol \r
-<p>Uses updated adodb-time.inc.php 0.06. \r
-<p><b>3.10 27 Jan 2003</b> \r
-<p>Added adodb_date(), adodb_getdate(), adodb_mktime() and adodb-time.inc.php. \r
-<p>For interbase, added code to handle unlimited number of bind parameters. From \r
- Daniel Hasan daniel#hasan.cl. \r
-<p>Added BlobDecode and UpdateBlob for informix. Thx to Fernando Ortiz. \r
-<p>Added constant ADODB_WINDOWS. If defined, means that running on Windows. \r
-<p>Added constant ADODB_PHPVER which stores php version as a hex num. Removed \r
- $ADODB_PHPVER variable. \r
-<p>Felho Bacsi reported a minor white-space regular expression problem in GetInsertSQL. \r
-<p>Modified ADO to use variant to store _affectedRows \r
-<p>Changed ibase to use base class Replace(). Modified base class Replace() to \r
- support ibase. \r
-<p>Changed odbc to auto-detect when 0 records returned is wrong due to bad odbc \r
- drivers. \r
-<p>Changed mssql to use datetimeconvert ini setting only when 4.30 or later (does \r
- not work in 4.23). \r
-<p>ExecuteCursor($stmt, $cursorname, $params) now accepts a new $params array \r
- of additional bind parameters -- William Lovaton walovaton#yahoo.com.mx. \r
-<p>Added support for sybase_unbuffered_query if ADODB_COUNTRECS == false. Thx \r
- to chuck may. \r
-<p>Fixed FetchNextObj() bug. Thx to Jorma Tuomainen. \r
-<p>We now use SCOPE_IDENTITY() instead of @@IDENTITY for mssql - thx to marchesini#eside.it \r
-<p>Changed postgresql movenext logic to prevent illegal row number from being \r
- passed to pg_fetch_array(). \r
-<p>Postgresql initrs bug found by "Bogdan RIPA" bripa#interakt.ro $f1 accidentally \r
- named $f \r
-<p><b>3.00 6 Jan 2003</b> \r
-<p>Fixed adodb-pear.inc.php syntax error. \r
-<p>Improved _adodb_getcount() to use SELECT COUNT(*) FROM ($sql) for languages \r
- that accept it. \r
-<p>Fixed _adodb_getcount() caching error. \r
-<p>Added sql to retrive table and column info for odbc_mssql. \r
-<p><strong>2.91 3 Jan 2003</strong> \r
-<p>Revised PHP version checking to use $ADODB_PHPVER with legal values 0x4000, \r
- 0x4050, 0x4200, 0x4300. \r
-<p>Added support for bytea fields and oid blobs in postgres by allowing BlobDecode() \r
- to detect and convert non-oid fields. Also added BlobEncode to postgres when \r
- you want to encode oid blobs. \r
-<p>Added blobEncodeType property for connections to inform phpLens what encoding \r
- method to use for blobs. \r
-<p>Added BlobDecode() and BlobEncode() to base ADOConnection class. \r
-<p>Added umask() to _gencachename() when creating directories. \r
-<p>Added charPage for ado drivers, so you can set the code page. \r
-<pre>\r
-$conn->charPage = CP_UTF8;\r
-$conn->Connect($dsn);\r
-</pre>\r
-<p>Modified _seek in mysql to check for num rows=0. \r
-<p>Added to metatypes new informix types for IDS 9.30. Thx Fernando Ortiz. \r
-<p>_maxrecordcount returned in CachePageExecute $rsreturn \r
-<p>Fixed sybase cacheselectlimit( ) problems \r
-<p>MetaColumns() max_length should use precision for types X and C for ms access. \r
- Fixed. \r
-<p>Speedup of odbc non-SELECT sql statements. \r
-<p>Added support in MetaColumns for Wide Char types for ODBC. We halve max_length \r
- if unicode/wide char. \r
-<p>Added 'B' to types handled by GetUpdateSQL/GetInsertSQL. \r
-<p>Fixed warning message in oci8 driver with $persist variable when using PConnect. \r
-<p><b>2.90 11 Dec 2002</b> \r
-<p>Mssql and mssqlpo and oci8po now support ADODB_ASSOC_CASE. \r
-<p>Now MetaType() can accept a field object as the first parameter. \r
-<p>New $arr = $db->ServerInfo( ) function. Returns $arr['description'] which \r
- is the string description, and $arr['version']. \r
-<p>PostgreSQL and MSSQL speedups for insert/updates. \r
-<p> Implemented new SetFetchMode() that removes the need to use $ADODB_FETCH_MODE. \r
- Each connection has independant fetchMode. \r
-<p>ADODB_ASSOC_CASE now defaults to 2, use native defaults. This is because we \r
- would break backward compat for too many applications otherwise. \r
-<p>Patched encrypted sessions to use replace() \r
-<p>The qstr function supports quoting of nulls when escape character is \ \r
-<p>Rewrote bits and pieces of session code to check for time synch and improve \r
- reliability. \r
-<p>Added property ADOConnection::hasTransactions = true/false; \r
-<p>Added CreateSequence and DropSequence functions \r
-<p>Found misplaced MoveNext() in adodb-postgres.inc.php. Fixed. \r
-<p>Sybase SelectLimit not reliable because 'set rowcount' not cached - fixed. \r
-<p>Moved ADOConnection to adodb-connection.inc.php and ADORecordSet to adodb-recordset.inc.php. \r
- This allows us to use doxygen to generate documentation. Doxygen doesn't like \r
- the classes in the main adodb.inc.php file for some mysterious reason. \r
-<p><b>2.50, 14 Nov 2002</b> \r
-<p>Added transOff and transCnt properties for disabling (transOff = true) and \r
- tracking transaction status (transCnt>0). \r
-<p>Added inputarray handling into _adodb_pageexecute_all_rows - "Ross Smith" RossSmith#bnw.com. \r
-<p>Fixed postgresql inconsistencies in date handling. \r
-<p>Added support for mssql_fetch_assoc. \r
-<p>Fixed $ADODB_FETCH_MODE bug in odbc MetaTables() and MetaPrimaryKeys(). \r
-<p>Accidentally declared UnixDate() twice, making adodb incompatible with php \r
- 4.3.0. Fixed. \r
-<p>Fixed pager problems with some databases that returned -1 for _currentRow on \r
- MoveLast() by switching to MoveNext() in adodb-lib.inc.php. \r
-<p>Also fixed uninited $discard in adodb-lib.inc.php. \r
-<p><b>2.43, 25 Oct 2002</b></p>\r
-Added ADODB_ASSOC_CASE constant to better support ibase and odbc field names. \r
-<p>Added support for NConnect() for oracle OCINLogin. \r
-<p>Fixed NumCols() bug. \r
-<p>Changed session handler to use Replace() on write. \r
-<p>Fixed oci8 SelectLimit aggregate function bug again. \r
-<p>Rewrote pivoting code. \r
-<p><b>2.42, 4 Oct 2002</b></p>\r
-<p>Fixed ibase_fetch() problem with nulls. Also interbase now does automatic blob \r
- decoding, and is backward compatible. Suggested by Heinz Hombergs heinz#hhombergs.de. \r
-<p>Fixed postgresql MoveNext() problems when called repeatedly after EOF. Also \r
- suggested by Heinz Hombergs. \r
-<p>PageExecute() does not rewrite queries if SELECT DISTINCT is used. Requested \r
- by hans#velum.net \r
-<p>Added additional fixes to oci8 SelectLimit handling with aggregate functions \r
- - thx to Christian Bugge for reporting the problem. \r
-<p><b>2.41, 2 Oct 2002</b></p>\r
-<p>Fixed ADODB_COUNTRECS bug in odbc. Thx to Joshua Zoshi jzoshi#hotmail.com. \r
-<p>Increased buffers for adodb-csvlib.inc.php for extremely long sql from 8192 \r
- to 32000. \r
-<p>Revised pivottable.inc.php code. Added better support for aggregate fields. \r
-<p>Fixed mysql text/blob types problem in MetaTypes base class - thx to horacio \r
- degiorgi. \r
-<p>Added SQLDate($fmt,$date) function, which allows an sql date format string \r
- to be generated - useful for group by's. \r
-<p>Fixed bug in oci8 SelectLimit when offset>100. \r
-<p><b>2.40 4 Sept 2002</b></p>\r
-<p>Added new NLS_DATE_FORMAT property to oci8. Suggested by Laurent NAVARRO ln#altidev.com \r
-<p>Now use bind parameters in oci8 selectlimit for better performance. \r
-<p>Fixed interbase replaceQuote for dialect != 1. Thx to "BEGUIN Pierre-Henri \r
- - INFOCOB" phb#infocob.com. \r
-<p>Added white-space check to QA. \r
-<p>Changed unixtimestamp to support fractional seconds (we always round down/floor \r
- the seconds). Thanks to beezly#beezly.org.uk. \r
-<p>Now you can set the trigger_error type your own user-defined type in adodb-errorhandler.inc.php. \r
- Suggested by Claudio Bustos clbustos#entelchile.net. \r
-<p>Added recordset filters with rsfilter.inc.php. \r
-<p>$conn->_rs2rs does not create a new recordset when it detects it is of type \r
- array. Some trickery there as there seems to be a bug in Zend Engine \r
-<p>Added render_pagelinks to adodb-pager.inc.php. Code by "Pablo Costa" pablo#cbsp.com.br. \r
-<p>MetaType() speedup in adodb.inc.php by using hashing instead of switch. Best \r
- performance if constant arrays are supported, as they are in PHP5. \r
-<p>adodb-session.php now updates only the expiry date if the crc32 check indicates \r
- that the data has not been modified. \r
<hr>\r
<p><strong>0.10 Sept 9 2000</strong> First release \r
<h3><strong>Old changelog history moved to <a href=old-changelog.htm>old-changelog.htm</a>. \r
<body bgcolor="#FFFFFF">\r
\r
<h2>ADOdb Data Dictionary Library for PHP</h2>\r
-<p> V4.00 20 Oct 2003 (c) 2000-2003 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>)</p>\r
+<p> V4.01 23 Oct 2003 (c) 2000-2003 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>)</p>\r
<p><font size=1>This software is dual licensed using BSD-Style and LGPL. This \r
means you can use it in compiled proprietary and commercial products.</font></p>\r
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?dd=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?dd=1>Other Docs</a>\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
+\r
+<html>\r
+<head>\r
+ <title>ADOdb Performance Monitoring Library</title>\r
+</head>\r
+\r
+<body>\r
+<h3>The ADOdb Performance Monitoring Library</h3>\r
+<p>V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my)</p>\r
+<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This \r
+ means you can use it in compiled proprietary and commercial products.</font></p>\r
+ <p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?perf=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?perf=1>Other Docs</a>\r
+<h3>Introduction</h3>\r
+<p>This module, part of the ADOdb package, provides both CLI and HTML interfaces \r
+ for viewing key performance indicators of your database. This is very useful \r
+ because web apps such as the popular phpMyAdmin currently do not provide effective \r
+ database health monitoring tools. The module provides the following: \r
+<ul>\r
+ <li>A quick health check of your database server using <code>$perf->HealthCheck()</code> \r
+ or <code>$perf->HealthCheckCLI()</code>. \r
+ <li>User interface for performance monitoring, <code>$perf->UI()</code>. \r
+ This UI displays: \r
+ <ul>\r
+ <li>the health check, </li>\r
+ <li>all SQL logged and their query plans, </li>\r
+ <li>a list of all tables in the current database</li>\r
+ <li>an interface to continiously poll the server for key performance indicators \r
+ such as CPU, Hit Ratio, Disk I/O</li>\r
+ </ul>\r
+ <li>Gives you an API to build database monitoring tools for a server farm, for \r
+ example calling <code>$perf->DBParameter('data cache hit ratio')</code> returns \r
+ this very important statistic in a database independant manner. \r
+</ul>\r
+<p>ADOdb also has the ability to log all SQL executed, using <a href=docs-adodb.htm#logsql>LogSQL</a>. \r
+ All SQL logged can be analyzed through the performance monitor <a href=#ui>UI</a>. \r
+ In the <i>View SQL</i> mode, we categorize the SQL into 3 types:\r
+<ul>\r
+ <li><b>Suspicious SQL</b>: queries with high average execution times, and are potential \r
+ candidates for rewriting</li>\r
+ <li><b>Expensive SQL</b>: queries with high total execution times (#executions * avg \r
+ execution time). Optimizing these queries will reduce your database server \r
+ load.</li>\r
+ <li><b>Invalid SQL</b>: queries that generate errors.</li>\r
+</ul>\r
+<p>Each query is hyperlinked to a description of the query plan, and every PHP \r
+ script that executed that query is also shown.</p>\r
+<p>Please note that the information presented is a very basic database health \r
+ check, and does not provide a complete overview of database performance. Although \r
+ some attempt has been made to make it work across multiple databases in the \r
+ same way, it is impossible to do so. For the health check, we do try to display \r
+ the following key database parameters for all drivers:</p>\r
+<ul>\r
+ <li><b>data cache size</b> - The amount of memory allocated to the cache.</li>\r
+ <li><b>data cache hit ratio</b> - A measure of how effective the cache is, as a percentage. \r
+ The higher, the better.</li>\r
+ <li><b>current connections</b> - The number of sessions currently connected to the \r
+ database. </li>\r
+</ul>\r
+<p>You will need to connect to the database as an administrator to view most of \r
+ the parameters. </p>\r
+<p>Code improvements as very welcome, particularly adding new database parameters \r
+ and automated tuning hints.</p><a name=usage></a>\r
+<h3>Usage</h3>\r
+<p>Currently, the following drivers: <em>mysql</em>, <em>postgres</em>, <em>oci8</em>, \r
+ <em>mssql</em>, <i>informix</i> and <em>db2</em> are supported. To create a \r
+ new performance monitor, call NewPerfMonitor( ) as demonstrated below: </p>\r
+<pre>\r
+<?php\r
+include_once('adodb.inc.php');\r
+session_start(); <font color="#006600"># session variables required for monitoring</font>\r
+$conn = ADONewConnection($driver);\r
+$conn->Connect($server,$user,$pwd,$db);\r
+$perf =& NewPerfMonitor($conn);\r
+$perf->UI($pollsecs=5);<font color="#006600"></font>\r
+?>\r
+</pre>\r
+<p>It is also possible to retrieve a single database parameter:</p>\r
+<pre>$size = $perf->DBParameter('data cache size');\r
+</pre>\r
+<p>\r
+Thx to Fernando Ortiz for the informix module. \r
+<h3>Methods</h3><a name=ui></a>\r
+<p><font face="Courier New, Courier, mono">function <b>UI($pollsecs=5)</b></font></p>\r
+<p>Creates a web-based user interface for performance monitoring. When you click on Poll, \r
+server statistics will be displayed every $pollsecs seconds. See <a href="#usage">Usage</a> \r
+ above. Sample output follows below:</p>\r
+\r
+<table border=1 width=100% bgcolor=lightyellow><tr>\r
+ <td> <b><a href=http://php.weblogs.com/adodb?perf=1>ADOdb</a> Performance \r
+ Monitor</b> for localhost, db=test<br>\r
+ <font size=-1>PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) \r
+ 3.2 20020927 (prerelease)</font></tr>\r
+ <tr><td>\r
+ <a href=#>Performance Stats</a> <a href=#>View SQL</a>\r
+ <a href=#>View Tables</a> <a href=#>Poll Stats</a></tr></table><table border=1 bgcolor=white><tr><td colspan=3><h3>postgres7</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> </td></tr><tr><td>statistics collector</td><td>TRUE</td><td>Value must be TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i> and <i>stats_block_level</i> must be set to true in postgresql.conf)</td></tr>\r
+<tr><td>data cache hit ratio</td><td>99.7967555299239</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data reads</td><td>125</td><td> </td></tr>\r
+<tr><td>data writes</td><td>21.78125000000000000</td><td>Count of inserts/updates/deletes * coef</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> </td></tr><tr><td>data cache buffers</td><td>640</td><td>Number of cache buffers. <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic>Tuning</a></td></tr>\r
+<tr><td>cache blocksize</td><td>8192</td><td>(estimate)</td></tr>\r
+<tr><td>data cache size</td><td>5M</td><td> </td></tr>\r
+<tr><td>operating system cache size</td><td>80M</td><td>(effective cache size)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Usage</i> </td></tr><tr><td>sort buffer size</td><td>1M</td><td>Size of sort buffer (per query)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> </td></tr><tr><td>current connections</td><td>0</td><td> </td></tr>\r
+<tr><td>max connections</td><td>32</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> </td></tr><tr><td>rollback buffers</td><td>8</td><td>WAL buffers</td></tr>\r
+<tr><td>random page cost</td><td>4</td><td>Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a></td></tr>\r
+</table>\r
+<p><font face="Courier New, Courier, mono">function <b>HealthCheck</b>()</font></p> \r
+<p>Returns database health check parameters as a HTML table. You will need to \r
+ echo or print the output of this function,</p>\r
+<p><font face="Courier New, Courier, mono">function <b>HealthCheckCLI</b>()</font></p>\r
+<p>Returns database health check parameters formatted for a command line interface. \r
+ You will need to echo or print the output of this function. Sample output for \r
+ mysql:</p>\r
+<pre>\r
+-- Ratios -- \r
+ MyISAM cache hit ratio => 56.5635738832 \r
+ InnoDB cache hit ratio => 0 \r
+ sql cache hit ratio => 0 \r
+ -- IO -- \r
+ data reads => 2622 \r
+ data writes => 2415.5 \r
+ -- Data Cache -- \r
+ MyISAM data cache size => 512K \r
+ BDB data cache size => 8388600\r
+ InnoDB data cache size => 8M\r
+ -- Memory Pools -- \r
+ read buffer size => 131072 \r
+ sort buffer size => 65528 \r
+ table cache => 4 \r
+ -- Connections -- \r
+ current connections => 3\r
+ max connections => 100</pre>\r
+<p><font face="Courier New, Courier, mono">function <b>Poll</b>($pollSecs=5) \r
+ </font> \r
+<p> Run in infinite loop, displaying the following information every $pollSecs. \r
+ This will not work properly if output buffering is enabled. \r
+ In the example below, $pollSecs=3:\r
+<pre>\r
+Accumulating statistics...\r
+ Time WS-CPU% Hit% Sess Reads/s Writes/s\r
+11:08:30 0.7 56.56 1 0.0000 0.0000\r
+11:08:33 1.8 56.56 2 0.0000 0.0000\r
+11:08:36 11.1 56.55 3 2.5000 0.0000\r
+11:08:39 9.8 56.55 2 3.1121 0.0000\r
+11:08:42 2.8 56.55 1 0.0000 0.0000\r
+11:08:45 7.4 56.55 2 0.0000 1.5000\r
+</pre>\r
+<p><b>WS-CPU%</b> is the Web Server CPU load of the server that PHP is running \r
+ from (eg. the database client), and not the database. The <b>Hit%</b> is the \r
+ data cache hit ratio. <b>Sess</b> is the current number of sessions connected \r
+ to the database. If you are using persistent connections, this should not change \r
+ much. The <b>Reads/s</b> and <b>Writes/s</b> are synthetic values to give the \r
+ viewer a rough guide to I/O, and are not to be taken literally. \r
+<p><font face="Courier New, Courier, mono">function <b>SuspiciousSQL</b>($numsql=10)</font></p>\r
+<p>Returns SQL which have high average execution times as a HTML table. Each sql statement\r
+is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL.\r
+<p> The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when\r
+$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using <a href=docs-adodb.htm#logsql>$conn->LogSQL</a>.\r
+<p>For Oracle, Ixora Suspicious SQL returns a list of SQL statements that are most cache intensive as a HTML table. \r
+ These are data intensive SQL statements that could benefit most from tuning. \r
+ \r
+<p><font face="Courier New, Courier, mono">function <b>ExpensiveSQL</b>($numsql=10)</font></p>\r
+<p>Returns SQL whose total execution time (avg time * #executions) is high as a HTML table. Each sql statement\r
+is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL.\r
+<p> The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when\r
+$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using <a href=docs-adodb.htm#logsql>$conn->LogSQL</a>.\r
+\r
+<p>For Oracle, Ixora Expensive SQL returns a list of SQL statements that are taking the most CPU load \r
+when run.\r
+<p><font face="Courier New, Courier, mono">function <b>InvalidSQL</b>($numsql=10)</font></p>\r
+<p>Returns a list of invalid SQL as an HTML table.\r
+<p>Data is taken from the adodb_logsql table, where the sql statements are logged when\r
+$connection->LogSQL(true) is enabled.\r
+<p><font face="Courier New, Courier, mono">function <b>Tables</b>($orderby=1)</font></p>\r
+<p>Returns information on all tables in a database, with the first two fields \r
+ containing the table name and table size, the remaining fields depend on the \r
+ database driver. If $orderby is set to 1, it will sort by name. If $orderby \r
+ is set to 2, then it will sort by table size. Some database drivers (mssql and \r
+ mysql) will ignore the $orderby clause. For postgresql, the information is up-to-date \r
+ since the last <i>vacuum</i>. Not supported currently for db2.</p>\r
+<h3>Raw Functions</h3>\r
+<p>Raw functions return values without any formatting.</p>\r
+<p><font face="Courier New, Courier, mono">function <b>DBParameter</b>($paramname)</font></p>\r
+<p>Returns the value of a database parameter, such as $this->DBParameter("data \r
+ cache size").</p>\r
+<p><font face="Courier New, Courier, mono">function <b>CPULoad</b>()</font></p>\r
+<p>Returns the CPU load of the database client (NOT THE SERVER) as a percentage. \r
+ Only works for Linux and Windows. For Windows, WMI must be available.</p>\r
+<h3>Format of $settings Property</h3>\r
+<p> To create new database parameters, you need to understand $settings. The $settings \r
+ data structure is an associative array. Each element of the array defines a \r
+ database parameter. The key is the name of the database parameter. If no key is defined,\r
+ then it is assumed to be a section break, and the value is the name of the section break.\r
+ If this is too confusing, looking at the source code will help a lot!</p>\r
+<p> Each database parameter is itself an array consisting of the following elements:</p>\r
+<ol start="0">\r
+ <li> Category code, used to group related db parameters. If the category code is 'HIDE', then\r
+the database parameter is not shown when HTML() is called. <br>\r
+ </li>\r
+ <li> either \r
+ <ol type="a">\r
+ <li>sql string to retrieve value, eg. "select value from v\$parameter where \r
+ name='db_block_size'", </li>\r
+ <li>array holding sql string and field to look for, e.g. array('show variables','table_cache'); \r
+ optional 3rd parameter is the $rs->fields[$index] to use (otherwise \r
+ $index=1), and optional 4th parameter is a constant to multiply the result \r
+ with (typically 100 for percentage calculations),</li>\r
+ <li>a string prefixed by =, then a PHP method of the class is invoked, e.g. \r
+ to invoke $this->GetIndexValue(), set this array element to '=GetIndexValue', \r
+ <br>\r
+ </li>\r
+ </ol>\r
+ </li>\r
+ <li> Description of database parameter. If description begins with an =, then \r
+ it is interpreted as a method call, just as in (1c) above, taking one parameter, \r
+ the current value. E.g. '=GetIndexDescription' will invoke $this->GetIndexDescription($val). \r
+ This is useful for generating tuning suggestions. For an example, see WarnCacheRatio().</li>\r
+</ol>\r
+<p>Example from MySQL, table_cache database parameter:</p>\r
+<pre>'table cache' => array('CACHE', # category code\r
+ array("show variables", 'table_cache'), # array (type 1b)\r
+ 'Number of tables to keep open'), # description</pre>\r
+<h3>Example Health Check Output</h3>\r
+<p><a href="#db2">db2</a> <a href=#informix>informix</a> <a href="#mysql">mysql</a> <a href="#mssql">mssql</a> \r
+ <a href="#oci8">oci8</a> <a href="#postgres">postgres</a></p>\r
+<p><a name=db2></a></p>\r
+<table border=1 bgcolor=white>\r
+ <tr> \r
+ <td colspan=3> <h3>db2</h3></td>\r
+ </tr>\r
+ <tr> \r
+ <td><b>Parameter</b></td>\r
+ <td><b>Value</b></td>\r
+ <td><b>Description</b></td>\r
+ </tr>\r
+ <tr bgcolor=#F0F0F0> \r
+ <td colspan=3><i>Ratios</i> </td>\r
+ </tr>\r
+ <tr bgcolor=#FFFFFF> \r
+ <td>data cache hit ratio</td>\r
+ <td>0 </td>\r
+ <td> </td>\r
+ </tr>\r
+ <tr bgcolor=#F0F0F0>\r
+ <td colspan=3><i>Data Cache</i></td>\r
+ </tr>\r
+ <tr bgcolor=#FFFFFF> \r
+ <td>data cache buffers</td>\r
+ <td>250 </td>\r
+ <td>See <a href=http://www7b.boulder.ibm.com/dmdd/library/techarticle/anshum/0107anshum.html#bufferpoolsize>tuning \r
+ reference</a>.</td>\r
+ </tr>\r
+ <tr bgcolor=#FFFFFF> \r
+ <td>cache blocksize</td>\r
+ <td>4096 </td>\r
+ <td> </td>\r
+ </tr>\r
+ <tr bgcolor=#FFFFFF> \r
+ <td>data cache size</td>\r
+ <td>1000K </td>\r
+ <td> </td>\r
+ </tr>\r
+ <tr bgcolor=#F0F0F0> \r
+ <td colspan=3><i>Connections</i></td>\r
+ </tr>\r
+ <tr bgcolor=#FFFFFF> \r
+ <td>current connections</td>\r
+ <td>2 </td>\r
+ <td> </td>\r
+ </tr>\r
+</table>\r
+<p> <p>\r
+<a name=informix></a>\r
+<table border=1 bgcolor=white><tr><td\r
+colspan=3><h3>informix</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Val\r
+ue</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td\r
+colspan=3><i>Ratios</i> </td></tr><tr><td>data cache hit\r
+ratio</td><td>95.89</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data\r
+reads</td><td>1883884</td><td>Page reads</td></tr>\r
+<tr><td>data writes</td><td>1716724</td><td>Page writes</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i>\r
+ </td></tr><tr><td>current connections</td><td>263.0</td><td>Number of\r
+sessions</td></tr>\r
+</table>\r
+\r
+\r
+<p> </p>\r
+<p><a name=mysql id="mysql"></a></p><table border=1 bgcolor=white><tr><td colspan=3><h3>mysql</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> </td></tr><tr><td>MyISAM cache hit ratio</td><td>56.5658301822</td><td><font color=red><b>Cache ratio should be at least 90%</b></font></td></tr>\r
+<tr><td>InnoDB cache hit ratio</td><td>0</td><td><font color=red><b>Cache ratio should be at least 90%</b></font></td></tr>\r
+<tr><td>sql cache hit ratio</td><td>0</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data reads</td><td>2622</td><td>Number of selects (Key_reads is not accurate)</td></tr>\r
+<tr><td>data writes</td><td>2415.5</td><td>Number of inserts/updates/deletes * coef (Key_writes is not accurate)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> </td></tr><tr><td>MyISAM data cache size</td><td>512K</td><td> </td></tr>\r
+<tr><td>BDB data cache size</td><td>8388600</td><td> </td></tr>\r
+<tr><td>InnoDB data cache size</td><td>8M</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> </td></tr><tr><td>read buffer size</td><td>131072</td><td>(per session)</td></tr>\r
+<tr><td>sort buffer size</td><td>65528</td><td>Size of sort buffer (per session)</td></tr>\r
+<tr><td>table cache</td><td>4</td><td>Number of tables to keep open</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> </td></tr><tr><td>current connections</td><td>3</td><td> </td></tr>\r
+<tr><td>max connections</td><td>100</td><td> </td></tr>\r
+</table>\r
+<p> </p>\r
+<p><a name=mssql id="mssql"></a></p>\r
+\r
+<table border=1 bgcolor=white><tr><td colspan=3><h3>mssql</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> </td></tr><tr><td>data cache hit ratio</td><td>99.9999694824</td><td> </td></tr>\r
+<tr><td>prepared sql hit ratio</td><td>99.7738579828</td><td> </td></tr>\r
+<tr><td>adhoc sql hit ratio</td><td>98.4540169133</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data reads</td><td>2858</td><td> </td></tr>\r
+<tr><td>data writes</td><td>1438</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> </td></tr><tr><td>data cache size</td><td>4362</td><td>in K</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> </td></tr><tr><td>current connections</td><td>14</td><td> </td></tr>\r
+<tr><td>max connections</td><td>32767</td><td> </td></tr>\r
+</table>\r
+\r
+<p> </p>\r
+<p><a name=oci8 id="oci8"></a></p>\r
+<table border=1 bgcolor=white><tr><td colspan=3><h3>oci8</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> </td></tr><tr><td>data cache hit ratio</td><td>96.98</td><td> </td></tr>\r
+<tr><td>sql cache hit ratio</td><td>99.96</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data reads</td><td>842938</td><td> </td></tr>\r
+<tr><td>data writes</td><td>16852</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> </td></tr><tr><td>data cache buffers</td><td>3072</td><td>Number of cache buffers</td></tr>\r
+<tr><td>data cache blocksize</td><td>8192</td><td> </td></tr>\r
+<tr><td>data cache size</td><td>48M</td><td>shared_pool_size</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> </td></tr><tr><td>java pool size</td><td>0</td><td>java_pool_size</td></tr>\r
+<tr><td>sort buffer size</td><td>512K</td><td>sort_area_size (per query)</td></tr>\r
+<tr><td>user session buffer size</td><td>8M</td><td>large_pool_size</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> </td></tr><tr><td>current connections</td><td>1</td><td> </td></tr>\r
+<tr><td>max connections</td><td>170</td><td> </td></tr>\r
+<tr><td>data cache utilization ratio</td><td>88.46</td><td>Percentage of data cache actually in use</td></tr>\r
+<tr><td>user cache utilization ratio</td><td>91.76</td><td>Percentage of user cache (large_pool) actually in use</td></tr>\r
+<tr><td>rollback segments</td><td>11</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Transactions</i> </td></tr><tr><td>peak transactions</td><td>24</td><td>Taken from high-water-mark</td></tr>\r
+<tr><td>max transactions</td><td>187</td><td>max transactions / rollback segments < 3.5 (or transactions_per_rollback_segment)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> </td></tr><tr><td>cursor sharing</td><td>EXACT</td><td>Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See <a href=http://www.praetoriate.com/oracle_tips_cursor_sharing.htm>cursor_sharing</a>.</td></tr>\r
+<tr><td>index cache cost</td><td>0</td><td>% of indexed data blocks expected in the cache.\r
+ Recommended is 20-80. Default is 0. See <a href=http://www.dba-oracle.com/oracle_tips_cbo_part1.htm>optimizer_index_caching</a>.</td></tr>\r
+<tr><td>random page cost</td><td>100</td><td>Recommended is 10-50 for TP, and 50 for data warehouses. Default is 100. See <a href=http://www.dba-oracle.com/oracle_tips_cost_adj.htm>optimizer_index_cost_adj</a>. </td></tr>\r
+</table>\r
+<h3>Suspicious SQL</h3>\r
+\r
+<table border=1 bgcolor=white><tr><td><b>LOAD</b></td><td><b>EXECUTES</b></td><td><b>SQL_TEXT</b></td></tr>\r
+<tr><td align=right> .73%</td><td align=right>89</td><td>select 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# </td></tr>\r
+<tr><td align=right> .84%</td><td align=right>3</td><td>select /*+ 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 </td></tr>\r
+<tr><td align=right> 3.95%</td><td align=right>6</td><td>SELECT 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' </td></tr>\r
+<tr><td align=right> 4.50%</td><td align=right>6</td><td>SELECT 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 </td></tr>\r
+<tr><td align=right>57.34%</td><td align=right>9267</td><td>select 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 </td></tr></table>\r
+\r
+<h3>Expensive SQL</h3>\r
+\r
+<table border=1 bgcolor=white><tr><td><b>LOAD</b></td><td><b>EXECUTES</b></td><td><b>SQL_TEXT</b></td></tr>\r
+<tr><td align=right> 5.24%</td><td align=right>1</td><td>select round(sum(bytes)/1048576) from dba_segments </td></tr>\r
+<tr><td align=right> 6.89%</td><td align=right>6</td><td>SELECT 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' </td></tr>\r
+<tr><td align=right> 7.85%</td><td align=right>6</td><td>SELECT 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 </td></tr>\r
+<tr><td align=right>33.69%</td><td align=right>89</td><td>select 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# </td></tr>\r
+<tr><td align=right>36.44%</td><td align=right>89</td><td>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# </td></tr></table>\r
+\r
+<p><a name=postgres id="postgres"></a></p>\r
+\r
+<table border=1 bgcolor=white><tr><td colspan=3><h3>postgres7</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> </td></tr><tr><td>statistics collector</td><td>FALSE</td><td>Must be set to TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i> and <i>stats_block_level</i> must be set to true in postgresql.conf)</td></tr>\r
+<tr><td>data cache hit ratio</td><td>99.9666031916603</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> </td></tr><tr><td>data reads</td><td>15</td><td> </td></tr>\r
+<tr><td>data writes</td><td>0.000000000000000000</td><td>Count of inserts/updates/deletes * coef</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> </td></tr><tr><td>data cache buffers</td><td>1280</td><td>Number of cache buffers. <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic>Tuning</a></td></tr>\r
+<tr><td>cache blocksize</td><td>8192</td><td>(estimate)</td></tr>\r
+<tr><td>data cache size</td><td>10M</td><td> </td></tr>\r
+<tr><td>operating system cache size</td><td>80000K</td><td>(effective cache size)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> </td></tr><tr><td>sort buffer size</td><td>1M</td><td>Size of sort buffer (per query)</td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> </td></tr><tr><td>current connections</td><td>13</td><td> </td></tr>\r
+<tr><td>max connections</td><td>32</td><td> </td></tr>\r
+<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> </td></tr><tr><td>rollback buffers</td><td>8</td><td>WAL buffers</td></tr>\r
+<tr><td>random page cost</td><td>4</td><td>Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a></td></tr>\r
+</table>\r
+\r
+</body>\r
+</html>\r
<body bgcolor="#FFFFFF">\r
<h3>ADODB Session Management Manual</h3>\r
<p>\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my)\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim#natsoft.com.my)\r
<p> <font size=1>This software is dual licensed using BSD-Style and LGPL. This \r
means you can use it in compiled proprietary and commercial products. </font> \r
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/*\r
- @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved. \r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved. \r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/**\r
-* @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+* @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license.\r
* Whenever there is any discrepancy between the two licenses,\r
* the BSD license will take precedence.\r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
Released under both BSD license and Lesser GPL library license.\r
Whenever there is any discrepancy between the two licenses,\r
the BSD license will take precedence.\r
return $this->_errorMsg;\r
}\r
\r
- function ErrorNo() \r
- {\r
- return ifx_error();\r
- }\r
+ function ErrorNo()\r
+ {\r
+ preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse); //!EOS\r
+ if (is_array($parse) && isset($parse[1])) return (int)$parse[1]; \r
+ return 0;\r
+ }\r
\r
\r
function &MetaColumns($table)\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/**\r
-* @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+* @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license.\r
* Whenever there is any discrepancy between the two licenses,\r
* the BSD license will take precedence.\r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
var $clientFlags = 0;\r
var $dbxDriver = 1;\r
var $substr = "substring";\r
+ var $lastInsID = false;\r
\r
function ADODB_mysql() \r
{ \r
<?php\r
\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
\r
- version V4.00 20 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
+ version V4.01 23 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
}\r
\r
if (is_array($inputarr)) {\r
- foreach($inputarr as $k => $v) {\r
+ reset($inputarr);\r
+ while (list($k,$v) = each($inputarr)) {\r
if (is_array($v)) {\r
if (sizeof($v) == 2) // suggested by g.giunta@libero.\r
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);\r
} else {\r
// one statement to bind them all\r
$bindarr = array();\r
- foreach($inputarr as $k => $v) {\r
+ reset($inputarr);\r
+ while(list($k,$v) = each($inputarr)) {\r
$bindarr[$k] = $v;\r
OCIBindByName($stmt,":$k",$bindarr[$k],4000);\r
}\r
if (defined('ADODB_PREFETCH_ROWS')) @OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS);\r
\r
if (is_array($inputarr)) {\r
- foreach($inputarr as $k => $v) {\r
+ reset($inputarr);\r
+ while(list($k,$v) = each($inputarr)) {\r
if (is_array($v)) {\r
if (sizeof($v) == 2) // suggested by g.giunta@libero.\r
OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]);\r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
function _fixblobs()\r
{\r
if ($this->fetchMode == PGSQL_NUM || $this->fetchMode == PGSQL_BOTH) {\r
- foreach($this->_blobArr as $k => $v) {\r
+ reset($this->_blobArr);\r
+ while(list($k,$v) = each($this->_blobArr)) {\r
$this->fields[$k] = ADORecordSet_postgres64::_decode($this->fields[$k]);\r
}\r
}\r
if ($this->fetchMode == PGSQL_ASSOC || $this->fetchMode == PGSQL_BOTH) {\r
- foreach($this->_blobArr as $k => $v) {\r
- if (!isset($this->fields[$v])) {\r
- $this->fields = false;\r
- return;\r
- }\r
+ reset($this->_blobArr);\r
+ while(list($k,$v) = each($this->_blobArr)) {\r
$this->fields[$v] = ADORecordSet_postgres64::_decode($this->fields[$v]);\r
}\r
}\r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights\r
+version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights\r
reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
<?php\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim. All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. See License.txt. \r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<body>\r
<?php \r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<body bgcolor=white>\r
<?php\r
/** \r
- * V4.00 20 Oct 2003 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * V4.01 23 Oct 2003 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/*\r
\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?PHP\r
+\r
+// V4.01 23 Oct 2003\r
+\r
error_reporting(E_ALL);\r
\r
require( "../adodb-xmlschema.inc.php" );\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
\r
if (empty($_GET['nolog'])) {\r
echo "<h3>SQL Logging enabled</h3>";\r
- $db->LogSQL();\r
+ $db->LogSQL();/*\r
+ $sql =\r
+"SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant, \r
+t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage, \r
+t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm \r
+FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4` \r
+ WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic) \r
+ AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0')) \r
+ ORDER BY t1.time DESC";\r
+ $db->SelectLimit($sql);\r
+ echo $db->ErrorMsg();*/\r
}\r
$ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb'));\r
$db->debug = false;\r
else $rs->Close();\r
\r
//if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ");\r
- \r
+ \r
if ($create) {\r
if (false && $db->databaseType == 'ibase') {\r
print "<b>Please create the following table for testing:</b></p>$createtab</p>";\r
$time = $db->DBDate(time());\r
if (empty($HTTP_GET_VARS['hide'])) $db->debug = true;\r
switch($db->databaseType){\r
- default:\r
+ case 'mssqlpo':\r
+ case 'mssql':\r
+ $sqlt = "CREATE TABLE mytable (\r
+ row1 INT IDENTITY(1,1) NOT NULL,\r
+ row2 varchar(16),\r
+ PRIMARY KEY (row1))";\r
+ //$db->debug=1;\r
+ if (!$db->Execute("delete from mytable")) \r
+ $db->Execute($sqlt);\r
+ \r
+ $ok = $db->Execute("insert into mytable (row2) values ('test')");\r
+ $ins_id=$db->Insert_ID();\r
+ echo "Insert ID=";var_dump($ins_id);\r
+ if ($ins_id == 0) Err("Bad Insert_ID()");\r
+ $ins_id2 = $db->GetOne("select row1 from mytable");\r
+ if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2");\r
+ \r
$arr = array(0=>'Caroline',1=>'Miranda');\r
$sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)";\r
break;\r
\r
+ case 'mysql':\r
+ $sqlt = "CREATE TABLE `mytable` (\r
+ `row1` int(11) NOT NULL auto_increment,\r
+ `row2` varchar(16) NOT NULL default '',\r
+ PRIMARY KEY (`row1`),\r
+ KEY `myindex` (`row1`,`row2`)\r
+) ";\r
+ if (!$db->Execute("delete from mytable")) \r
+ $db->Execute($sqlt);\r
+ \r
+ $ok = $db->Execute("insert into mytable (row2) values ('test')");\r
+ $ins_id=$db->Insert_ID();\r
+ echo "Insert ID=";var_dump($ins_id);\r
+ if ($ins_id == 0) Err("Bad Insert_ID()");\r
+ $ins_id2 = $db->GetOne("select row1 from mytable");\r
+ if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2");\r
+ \r
+ default:\r
+ $arr = array(0=>'Caroline',1=>'Miranda');\r
+ $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)";\r
+ break;\r
+ \r
case 'oci8':\r
case 'oci805':\r
$arr = array('first'=>'Caroline','last'=>'Miranda');\r
else $rs->Close();\r
$db->debug = false;\r
$db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+1,'John','Lim',$time)");\r
- echo "Insert ID=";var_dump($db->Insert_ID());\r
+ /*$ins_id=$db->Insert_ID();\r
+ echo "Insert ID=";var_dump($ins_id);*/\r
+ if ($db->databaseType == 'mysql') if ($ins_id == 0) Err('Bad Insert_ID');\r
$db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+2,'Mary','Lamb',$time )");\r
$db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+3,'George','Washington',$time )");\r
$db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+4,'Mr. Alan','Tam',$time )");\r
\r
if ($pear) print "<p>PEAR DB emulation passed.</p>";\r
\r
-\r
+ $rs = $db->SelectLimit("select ".$db->sysDate." from adoxyz",1);\r
+ $date = $rs->fields[0];\r
+ if (!$date) Err("Bad sysDate");\r
+ else {\r
+ $ds = $db->UserDate($date,"d m Y");\r
+ if ($ds != date("d m Y")) Err("Bad UserDate: ".$ds);\r
+ else echo "Passed UserDate: $ds<p>";\r
+ }\r
+ \r
+ $rs = $db->SelectLimit("select ".$db->sysTimeStamp." from adoxyz",1);\r
+ $date = $rs->fields[0];\r
+ if (!$date) Err("Bad sysTimeStamp");\r
+ else {\r
+ $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y");\r
+ if ($ds != date("H \\h\\r\\s-d m Y")) Err("Bad UserTimeStamp: ".$ds);\r
+ else echo "Passed UserTimeStamp: $ds<p>";\r
+ \r
+ $date = 100;\r
+ $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y");\r
+ $ds2 = date("H \\h\\r\\s-d m Y",$date);\r
+ if ($ds != $ds2) Err("Bad UserTimeStamp 2: $ds: $ds2");\r
+ else echo "Passed UserTimeStamp 2: $ds<p>";\r
+ }\r
if ($db->hasTransactions) {\r
//$db->debug=1;\r
echo "<p>Testing StartTrans CompleteTrans</p>";\r
<body>\r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<code>\r
<?php\r
/*\r
- V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<body>\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
\r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
<?php\r
/*\r
- V4.00 20 Oct 2003 \r
+ V4.01 23 Oct 2003 \r
\r
Run multiple copies of this php script at the same time\r
to test unique generation of id's in multiuser mode\r
<?php\r
\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<body>\r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
/* \r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence. \r
<?php\r
\r
/** \r
- * @version V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ * @version V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
* Released under both BSD license and Lesser GPL library license. \r
* Whenever there is any discrepancy between the two licenses, \r
* the BSD license will take precedence. \r
<?php \r
/*\r
-V4.00 20 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
+ V4.01 23 Oct 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
Released under both BSD license and Lesser GPL library license. \r
Whenever there is any discrepancy between the two licenses, \r
the BSD license will take precedence.\r
$s .= "<TR valign=top>\n";\r
\r
for ($i=0; $i < $ncols; $i++) {\r
- $v = ($numoffset)? $rs->fields[$i] : next($rs->fields);\r
+ if ($i===0) $v=($numoffset) ? $rs->fields[0] : reset($rs->fields);\r
+ else $v = ($numoffset) ? $rs->fields[$i] : next($rs->fields);\r
+ \r
$type = $typearr[$i];\r
switch($type) {\r
case 'T':\r