Update of /cvsroot/mantisbt/mantisbt/core/adodb/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23600/tests
Modified Files:
benchmark.php client.php pdo.php test-datadict.php
test-perf.php test-pgblob.php test-php5.php test-xmlschema.php
test.php test2.php test3.php test4.php test5.php
test_rs_array.php testcache.php testdatabases.inc.php
testgenid.php testmssql.php testoci8.php testoci8cursor.php
testpaging.php testpear.php testsessions.php time.php
Log Message:
updating adodb to v4.60 (#5171)
Index: test_rs_array.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test_rs_array.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_rs_array.php 29 Nov 2004 23:03:54 -0000 1.1
+++ test_rs_array.php 27 Jan 2005 14:43:47 -0000 1.2
@@ -1,47 +1,47 @@
-<?php
-
-include_once('../adodb.inc.php');
-$rs = new ADORecordSet_array();
-
-$array = array(
-array ('Name', 'Age'),
-array ('John', '12'),
-array ('Jill', '8'),
-array ('Bill', '49')
-);
-
-$typearr = array('C','I');
-
-
-$rs->InitArray($array,$typearr);
-
-while (!$rs->EOF) {
- print_r($rs->fields);echo "<br>";
- $rs->MoveNext();
-}
-
-echo "<hr> 1 Seek<br>";
-$rs->Move(1);
-while (!$rs->EOF) {
- print_r($rs->fields);echo "<br>";
- $rs->MoveNext();
-}
-
-echo "<hr> 2 Seek<br>";
-$rs->Move(2);
-while (!$rs->EOF) {
- print_r($rs->fields);echo "<br>";
- $rs->MoveNext();
-}
-
-echo "<hr> 3 Seek<br>";
-$rs->Move(3);
-while (!$rs->EOF) {
- print_r($rs->fields);echo "<br>";
- $rs->MoveNext();
-}
-
-
-
-die();
+<?php
+
+include_once('../adodb.inc.php');
+$rs = new ADORecordSet_array();
+
+$array = array(
+array ('Name', 'Age'),
+array ('John', '12'),
+array ('Jill', '8'),
+array ('Bill', '49')
+);
+
+$typearr = array('C','I');
+
+
+$rs->InitArray($array,$typearr);
+
+while (!$rs->EOF) {
+ print_r($rs->fields);echo "<br>";
+ $rs->MoveNext();
+}
+
+echo "<hr> 1 Seek<br>";
+$rs->Move(1);
+while (!$rs->EOF) {
+ print_r($rs->fields);echo "<br>";
+ $rs->MoveNext();
+}
+
+echo "<hr> 2 Seek<br>";
+$rs->Move(2);
+while (!$rs->EOF) {
+ print_r($rs->fields);echo "<br>";
+ $rs->MoveNext();
+}
+
+echo "<hr> 3 Seek<br>";
+$rs->Move(3);
+while (!$rs->EOF) {
+ print_r($rs->fields);echo "<br>";
+ $rs->MoveNext();
+}
+
+
+
+die();
?>
\ No newline at end of file
Index: testsessions.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testsessions.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testsessions.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testsessions.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,73 +1,73 @@
-<?php
-
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-function NotifyExpire($ref,$key)
-{
- print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
-}
-
-//-------------------------------------------------------------------
-
-
-#### CONNECTION
-if (1) {
- $ADODB_SESSION_DRIVER='oci8';
- $ADODB_SESSION_CONNECT='';
- $ADODB_SESSION_USER ='scott';
- $ADODB_SESSION_PWD ='natsoft';
- $ADODB_SESSION_DB ='';
-} else {
- $ADODB_SESSION_DRIVER='mysql';
- $ADODB_SESSION_CONNECT='localhost';
- $ADODB_SESSION_USER ='root';
- $ADODB_SESSION_PWD ='';
- $ADODB_SESSION_DB ='xphplens_2';
-}
-
-### TURN DEBUGGING ON
- $ADODB_SESS_DEBUG = true;
-
-
-#### SETUP NOTIFICATION
- $USER = 'JLIM'.rand();
- $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
-
-
-#### INIT
- ob_start();
- error_reporting(E_ALL);
- include('../session/adodb-cryptsession.php');
- session_start();
-
-
-### SETUP SESSION VARIABLES
- $HTTP_SESSION_VARS['MONKEY'] = array('1','abc',44.41);
- if (!isset($HTTP_GET_VARS['nochange'])) @$HTTP_SESSION_VARS['AVAR'] +=
1;
-
-
-### START DISPLAY
- print "<h3>PHP ".PHP_VERSION."</h3>";
- print
"<p><b>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</b></p>";
-
- print "<hr> <b>Cookies</b>: ";
- print_r($HTTP_COOKIE_VARS);
-
-### RANDOMLY PERFORM Garbage Collection
- if (rand() % 10 == 0) {
-
- print "<hr><p><b>Garbage Collection</b></p>";
- adodb_sess_gc(10);
-
- print "<p>Random session destroy</p>";
- session_destroy();
- }
+<?php
+
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+function NotifyExpire($ref,$key)
+{
+ print "<p><b>Notify Expiring=$ref, sessionkey=$key</b></p>";
+}
+
+//-------------------------------------------------------------------
+
+
+#### CONNECTION
+if (1) {
+ $ADODB_SESSION_DRIVER='oci8';
+ $ADODB_SESSION_CONNECT='';
+ $ADODB_SESSION_USER ='scott';
+ $ADODB_SESSION_PWD ='natsoft';
+ $ADODB_SESSION_DB ='';
+} else {
+ $ADODB_SESSION_DRIVER='mysql';
+ $ADODB_SESSION_CONNECT='localhost';
+ $ADODB_SESSION_USER ='root';
+ $ADODB_SESSION_PWD ='';
+ $ADODB_SESSION_DB ='xphplens_2';
+}
+
+### TURN DEBUGGING ON
+ $ADODB_SESS_DEBUG = true;
+
+
+#### SETUP NOTIFICATION
+ $USER = 'JLIM'.rand();
+ $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
+
+
+#### INIT
+ ob_start();
+ error_reporting(E_ALL);
+ include('../session/adodb-cryptsession.php');
+ session_start();
+
+
+### SETUP SESSION VARIABLES
+ $HTTP_SESSION_VARS['MONKEY'] = array('1','abc',44.41);
+ if (!isset($HTTP_GET_VARS['nochange'])) @$HTTP_SESSION_VARS['AVAR'] +=
1;
+
+
+### START DISPLAY
+ print "<h3>PHP ".PHP_VERSION."</h3>";
+ print
"<p><b>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</b></p>";
+
+ print "<hr> <b>Cookies</b>: ";
+ print_r($HTTP_COOKIE_VARS);
+
+### RANDOMLY PERFORM Garbage Collection
+ if (rand() % 10 == 0) {
+
+ print "<hr><p><b>Garbage Collection</b></p>";
+ adodb_sess_gc(10);
+
+ print "<p>Random session destroy</p>";
+ session_destroy();
+ }
?>
\ No newline at end of file
Index: test-pgblob.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test-pgblob.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test-pgblob.php 29 Nov 2004 23:03:53 -0000 1.1
+++ test-pgblob.php 27 Jan 2005 14:43:47 -0000 1.2
@@ -1,88 +1,88 @@
-<?php
-
-function getmicrotime()
-{
- $t = microtime();
- $t = explode(' ',$t);
- return (float)$t[1]+ (float)$t[0];
-}
-
-function doloop()
-{
-global $db,$MAX;
-
- $sql = "select id,firstname,lastname from adoxyz where
- firstname not like ? and lastname not like ? and id=?";
- $offset = 0;
- /*$sql = "select * from juris9.employee join juris9.emp_perf_plan on
epp_empkey = emp_id
- where emp_name not like ? and emp_name not like ? and
emp_id=28000+?";
- $offset = 28000;*/
- for ($i=1; $i <= $MAX; $i++) {
- $db->Param(false);
- $x = (rand() % 10) + 1;
- $db->debug= ($i==1);
- $id = $db->GetOne($sql,
- array('Z%','Z%',$x));
- if($id != $offset+$x) {
- print "<p>Error at $x";
- break;
- }
- }
-}
-
-include_once('../adodb.inc.php');
-$db = NewADOConnection('postgres7');
-$db->PConnect('localhost','tester','test','test') || die("failed connection");
-
-$enc =
"GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D";
-$val = rawurldecode($enc);
-
-$MAX = 1000;
-
-adodb_pr($db->ServerInfo());
-
-echo "<h4>Testing PREPARE/EXECUTE PLAN</h4>";
-
-
-$db->_bindInputArray = true; // requires postgresql 7.3+ and ability to modify
database
-$t = getmicrotime();
-doloop();
-echo '<p>',$MAX,' times, with plan=',getmicrotime() - $t,'</p>';
-
-
-$db->_bindInputArray = false;
-$t = getmicrotime();
-doloop();
-echo '<p>',$MAX,' times, no plan=',getmicrotime() - $t,'</p>';
-
-
-
-echo "<h4>Testing UPDATEBLOB</h4>";
-$db->debug=1;
-
-### TEST BEGINS
-
-$db->Execute("insert into photos (id,name) values(9999,'dot.gif')");
-$db->UpdateBlob('photos','photo',$val,'id=9999');
-$v = $db->GetOne('select photo from photos where id=9999');
-
-
-### CLEANUP
-
-$db->Execute("delete from photos where id=9999");
-
-### VALIDATION
-
-if ($v !== $val) echo "<b>*** ERROR: Inserted value does not match downloaded
val<b>";
-else echo "<b>*** OK: Passed</b>";
-
-echo "<pre>";
-echo "INSERTED: ", $enc;
-echo "<hr>";
-echo"RETURNED: ", rawurlencode($v);
-echo "<hr><p>";
-echo "INSERTED: ", $val;
-echo "<hr>";
-echo "RETURNED: ", $v;
-
+<?php
+
+function getmicrotime()
+{
+ $t = microtime();
+ $t = explode(' ',$t);
+ return (float)$t[1]+ (float)$t[0];
+}
+
+function doloop()
+{
+global $db,$MAX;
+
+ $sql = "select id,firstname,lastname from adoxyz where
+ firstname not like ? and lastname not like ? and id=?";
+ $offset = 0;
+ /*$sql = "select * from juris9.employee join juris9.emp_perf_plan on
epp_empkey = emp_id
+ where emp_name not like ? and emp_name not like ? and
emp_id=28000+?";
+ $offset = 28000;*/
+ for ($i=1; $i <= $MAX; $i++) {
+ $db->Param(false);
+ $x = (rand() % 10) + 1;
+ $db->debug= ($i==1);
+ $id = $db->GetOne($sql,
+ array('Z%','Z%',$x));
+ if($id != $offset+$x) {
+ print "<p>Error at $x";
+ break;
+ }
+ }
+}
+
+include_once('../adodb.inc.php');
+$db = NewADOConnection('postgres7');
+$db->PConnect('localhost','tester','test','test') || die("failed connection");
+
+$enc =
"GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D";
+$val = rawurldecode($enc);
+
+$MAX = 1000;
+
+adodb_pr($db->ServerInfo());
+
+echo "<h4>Testing PREPARE/EXECUTE PLAN</h4>";
+
+
+$db->_bindInputArray = true; // requires postgresql 7.3+ and ability to modify
database
+$t = getmicrotime();
+doloop();
+echo '<p>',$MAX,' times, with plan=',getmicrotime() - $t,'</p>';
+
+
+$db->_bindInputArray = false;
+$t = getmicrotime();
+doloop();
+echo '<p>',$MAX,' times, no plan=',getmicrotime() - $t,'</p>';
+
+
+
+echo "<h4>Testing UPDATEBLOB</h4>";
+$db->debug=1;
+
+### TEST BEGINS
+
+$db->Execute("insert into photos (id,name) values(9999,'dot.gif')");
+$db->UpdateBlob('photos','photo',$val,'id=9999');
+$v = $db->GetOne('select photo from photos where id=9999');
+
+
+### CLEANUP
+
+$db->Execute("delete from photos where id=9999");
+
+### VALIDATION
+
+if ($v !== $val) echo "<b>*** ERROR: Inserted value does not match downloaded
val<b>";
+else echo "<b>*** OK: Passed</b>";
+
+echo "<pre>";
+echo "INSERTED: ", $enc;
+echo "<hr>";
+echo"RETURNED: ", rawurlencode($v);
+echo "<hr><p>";
+echo "INSERTED: ", $val;
+echo "<hr>";
+echo "RETURNED: ", $v;
+
?>
\ No newline at end of file
Index: testoci8cursor.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testoci8cursor.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testoci8cursor.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testoci8cursor.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,111 +1,111 @@
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-/*
- Test for Oracle Variable Cursors, which are treated as ADOdb recordsets.
-
- We have 2 examples. The first shows us using the Parameter statement.
- The second shows us using the new ExecuteCursor($sql, $cursorName)
- function.
-
-------------------------------------------------------------------
--- TEST PACKAGE YOU NEED TO INSTALL ON ORACLE - run from sql*plus
-------------------------------------------------------------------
-
-
--- TEST PACKAGE
-CREATE OR REPLACE PACKAGE adodb AS
-TYPE TabType IS REF CURSOR RETURN tab%ROWTYPE;
-PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar);
-PROCEDURE data_out(input IN varchar, output OUT varchar);
-
-procedure myproc (p1 in number, p2 out number);
-END adodb;
-/
-
-CREATE OR REPLACE PACKAGE BODY adodb AS
-PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar) IS
- BEGIN
- OPEN tabcursor FOR SELECT * FROM tab where tname like
tablenames;
- END open_tab;
-
-PROCEDURE data_out(input IN varchar, output OUT varchar) IS
- BEGIN
- output := 'Cinta Hati '||input;
- END;
-
-procedure myproc (p1 in number, p2 out number) as
-begin
-p2 := p1;
-end;
-END adodb;
-/
-
-------------------------------------------------------------------
--- END PACKAGE
-------------------------------------------------------------------
-
-*/
-
-include('../adodb.inc.php');
-include('../tohtml.inc.php');
-
- error_reporting(E_ALL);
- $db = ADONewConnection('oci8');
- $db->PConnect('','scott','natsoft');
- $db->debug = 99;
-
-
-/*
-*/
-
- define('MYNUM',5);
-
-
- $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;");
-
- if ($rs && !$rs->EOF) {
- print "Test 1 RowCount: ".$rs->RecordCount()."<p>";
- } else {
- print "<b>Error in using Cursor Variables 1</b><p>";
- }
-
- print "<h4>Testing Stored Procedures for oci8</h4>";
-
- $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;');
- $db->OutParameter($stid, $myov, 'myov');
- $db->Execute($stid);
- if ($myov != MYNUM) print "<p><b>Error with myproc</b></p>";
-
-
- $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true);
- $a1 = 'Malaysia';
- //$a2 = ''; # a2 doesn't even need to be defined!
- $db->InParameter($stmt,$a1,'a1');
- $db->OutParameter($stmt,$a2,'a2');
- $rs = $db->Execute($stmt);
- if ($rs) {
- if ($a2 !== 'Cinta Hati Malaysia') print "<b>Stored Procedure
Error: a2 = $a2</b><p>";
- else echo "OK: a2=$a2<p>";
- } else {
- print "<b>Error in using Stored Procedure IN/Out
Variables</b><p>";
- }
-
-
- $tname = 'A%';
-
- $stmt = $db->PrepareSP('select * from tab where tname like :tablename');
- $db->Parameter($stmt,$tname,'tablename');
- $rs = $db->Execute($stmt);
- rs2html($rs);
-
-
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+/*
+ Test for Oracle Variable Cursors, which are treated as ADOdb recordsets.
+
+ We have 2 examples. The first shows us using the Parameter statement.
+ The second shows us using the new ExecuteCursor($sql, $cursorName)
+ function.
+
+------------------------------------------------------------------
+-- TEST PACKAGE YOU NEED TO INSTALL ON ORACLE - run from sql*plus
+------------------------------------------------------------------
+
+
+-- TEST PACKAGE
+CREATE OR REPLACE PACKAGE adodb AS
+TYPE TabType IS REF CURSOR RETURN tab%ROWTYPE;
+PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar);
+PROCEDURE data_out(input IN varchar, output OUT varchar);
+
+procedure myproc (p1 in number, p2 out number);
+END adodb;
+/
+
+CREATE OR REPLACE PACKAGE BODY adodb AS
+PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames in varchar) IS
+ BEGIN
+ OPEN tabcursor FOR SELECT * FROM tab where tname like
tablenames;
+ END open_tab;
+
+PROCEDURE data_out(input IN varchar, output OUT varchar) IS
+ BEGIN
+ output := 'Cinta Hati '||input;
+ END;
+
+procedure myproc (p1 in number, p2 out number) as
+begin
+p2 := p1;
+end;
+END adodb;
+/
+
+------------------------------------------------------------------
+-- END PACKAGE
+------------------------------------------------------------------
+
+*/
+
+include('../adodb.inc.php');
+include('../tohtml.inc.php');
+
+ error_reporting(E_ALL);
+ $db = ADONewConnection('oci8');
+ $db->PConnect('','scott','natsoft');
+ $db->debug = 99;
+
+
+/*
+*/
+
+ define('MYNUM',5);
+
+
+ $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;");
+
+ if ($rs && !$rs->EOF) {
+ print "Test 1 RowCount: ".$rs->RecordCount()."<p>";
+ } else {
+ print "<b>Error in using Cursor Variables 1</b><p>";
+ }
+
+ print "<h4>Testing Stored Procedures for oci8</h4>";
+
+ $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;');
+ $db->OutParameter($stid, $myov, 'myov');
+ $db->Execute($stid);
+ if ($myov != MYNUM) print "<p><b>Error with myproc</b></p>";
+
+
+ $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true);
+ $a1 = 'Malaysia';
+ //$a2 = ''; # a2 doesn't even need to be defined!
+ $db->InParameter($stmt,$a1,'a1');
+ $db->OutParameter($stmt,$a2,'a2');
+ $rs = $db->Execute($stmt);
+ if ($rs) {
+ if ($a2 !== 'Cinta Hati Malaysia') print "<b>Stored Procedure
Error: a2 = $a2</b><p>";
+ else echo "OK: a2=$a2<p>";
+ } else {
+ print "<b>Error in using Stored Procedure IN/Out
Variables</b><p>";
+ }
+
+
+ $tname = 'A%';
+
+ $stmt = $db->PrepareSP('select * from tab where tname like :tablename');
+ $db->Parameter($stmt,$tname,'tablename');
+ $rs = $db->Execute($stmt);
+ rs2html($rs);
+
+
?>
\ No newline at end of file
Index: test-xmlschema.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test-xmlschema.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test-xmlschema.php 29 Nov 2004 23:03:54 -0000 1.1
+++ test-xmlschema.php 27 Jan 2005 14:43:47 -0000 1.2
@@ -1,53 +1,53 @@
-<?PHP
-
-// V4.50 6 July 2004
-
-error_reporting(E_ALL);
-include_once( "../adodb.inc.php" );
-include_once( "../adodb-xmlschema.inc.php" );
-
-// To build the schema, start by creating a normal ADOdb connection:
-$db = ADONewConnection( 'mysql' );
-$db->Connect( 'localhost', 'root', '', 'schematest' );
-
-// To create a schema object and build the query array.
-$schema = new adoSchema( $db );
-
-// To upgrade an existing schema object, use the following
-// To upgrade an existing database to the provided schema,
-// uncomment the following line:
-#$schema->upgradeSchema();
-
-print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
-// Build the SQL array
-$sql = $schema->ParseSchema( "xmlschema.xml" );
-
-print_r( $sql );
-print "</pre>\n";
-
-// Execute the SQL on the database
-//$result = $schema->ExecuteSchema( $sql );
-
-// Finally, clean up after the XML parser
-// (PHP won't do this for you!)
-//$schema->Destroy();
-
-
-$db2 = ADONewConnection('mssql');
-$db2->Connect('localhost','sa','natsoft','northwind') || die("Fail 2");
-
-$db2->Execute("drop table simple_table");
-
-
-print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>";
-
-$schema = new adoSchema( $db2 );
-$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
-
-print_r( $sql );
-print "</pre>\n";
-
-$db2->debug=1;
-
-$db2->Execute($sql[0]);
+<?PHP
+
+// V4.50 6 July 2004
+
+error_reporting(E_ALL);
+include_once( "../adodb.inc.php" );
+include_once( "../adodb-xmlschema.inc.php" );
+
+// To build the schema, start by creating a normal ADOdb connection:
+$db = ADONewConnection( 'mysql' );
+$db->Connect( 'localhost', 'root', '', 'schematest' );
+
+// To create a schema object and build the query array.
+$schema = new adoSchema( $db );
+
+// To upgrade an existing schema object, use the following
+// To upgrade an existing database to the provided schema,
+// uncomment the following line:
+#$schema->upgradeSchema();
+
+print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
+// Build the SQL array
+$sql = $schema->ParseSchema( "xmlschema.xml" );
+
+print_r( $sql );
+print "</pre>\n";
+
+// Execute the SQL on the database
+//$result = $schema->ExecuteSchema( $sql );
+
+// Finally, clean up after the XML parser
+// (PHP won't do this for you!)
+//$schema->Destroy();
+
+
+$db2 = ADONewConnection('mssql');
+$db2->Connect('localhost','sa','natsoft','northwind') || die("Fail 2");
+
+$db2->Execute("drop table simple_table");
+
+
+print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>";
+
+$schema = new adoSchema( $db2 );
+$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
+
+print_r( $sql );
+print "</pre>\n";
+
+$db2->debug=1;
+
+$db2->Execute($sql[0]);
?>
\ No newline at end of file
Index: test.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test.php 29 Nov 2004 23:03:54 -0000 1.3
+++ test.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,1602 +1,1602 @@
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
[...3173 lines suppressed...]
+There is also support for Sybase, PostgreSQL.</p>
+For the latest version of ADODB, visit <a
href=http://adodb.sourceforge.net/>adodb.sourceforge.net</a>.</p>
+
+Test <a href=test4.php>GetInsertSQL/GetUpdateSQL</a>
+ <a href=testsessions.php>Sessions</a>
+ <a href=testpaging.php>Paging</a>
+ <a href=test-perf.php>Perf Monitor</a><p>
+<?php
+include('./testdatabases.inc.php');
+
+echo "<br>vers=",ADOConnection::Version();
+
+
+include_once('../adodb-time.inc.php');
+if (isset($_GET['time'])) adodb_date_test();
+
+?>
+<p><i>ADODB Database Library (c) 2000-2004 John Lim. All rights reserved.
Released under BSD and LGPL.</i></p>
+</body>
+</html>
Index: testoci8.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testoci8.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testoci8.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testoci8.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,83 +1,83 @@
-<html>
-<body>
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-error_reporting(63);
-include("../adodb.inc.php");
-include("../tohtml.inc.php");
-
-if (0) {
- $db = ADONewConnection('oci8po');
-
- $db->PConnect('','scott','natsoft');
- if (!empty($testblob)) {
- $varHoldingBlob = 'ABC DEF GEF John TEST';
- $num = time()%10240;
- // create table atable (id integer, ablob blob);
- $db->Execute('insert into ATABLE (id,ablob)
values('.$num.',empty_blob())');
- $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num,
'BLOB');
-
- $rs = &$db->Execute('select * from atable');
-
- if (!$rs) die("Empty RS");
- if ($rs->EOF) die("EOF RS");
- rs2html($rs);
- }
- $stmt = $db->Prepare('select * from adoxyz where id=?');
- for ($i = 1; $i <= 10; $i++) {
- $rs = &$db->Execute(
- $stmt,
- array($i));
-
- if (!$rs) die("Empty RS");
- if ($rs->EOF) die("EOF RS");
- rs2html($rs);
- }
-}
-if (1) {
- $db = ADONewConnection('oci8');
- $db->PConnect('','scott','natsoft');
- $db->debug = true;
- $db->Execute("delete from emp where ename='John'");
- print $db->Affected_Rows().'<BR>';
- $stmt = &$db->Prepare('insert into emp (empno, ename) values (:empno,
:ename)');
- $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John'));
- // prepare not quite ready for prime time
- //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
- if (!$rs) die("Empty RS");
-
- $db->setfetchmode(ADODB_FETCH_NUM);
-
- $vv = 'A%';
- $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true);
- $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
- $db->OutParameter($stmt, $vv, 'tt');
- $rs = $db->Execute($stmt);
- while (!$rs->EOF) {
- adodb_pr($rs->fields);
- $rs->MoveNext();
- }
- echo " val = $vv";
-
-}
-
-if (0) {
- $db = ADONewConnection('odbc_oracle');
- if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect');
- $db->debug = true;
- $rs = &$db->Execute(
- 'select * from adoxyz where firstname=? and trim(lastname)=?',
- array('first'=>'Caroline','last'=>'Miranda'));
- if (!$rs) die("Empty RS");
- if ($rs->EOF) die("EOF RS");
- rs2html($rs);
-}
+<html>
+<body>
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+error_reporting(63);
+include("../adodb.inc.php");
+include("../tohtml.inc.php");
+
+if (0) {
+ $db = ADONewConnection('oci8po');
+
+ $db->PConnect('','scott','natsoft');
+ if (!empty($testblob)) {
+ $varHoldingBlob = 'ABC DEF GEF John TEST';
+ $num = time()%10240;
+ // create table atable (id integer, ablob blob);
+ $db->Execute('insert into ATABLE (id,ablob)
values('.$num.',empty_blob())');
+ $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num,
'BLOB');
+
+ $rs = &$db->Execute('select * from atable');
+
+ if (!$rs) die("Empty RS");
+ if ($rs->EOF) die("EOF RS");
+ rs2html($rs);
+ }
+ $stmt = $db->Prepare('select * from adoxyz where id=?');
+ for ($i = 1; $i <= 10; $i++) {
+ $rs = &$db->Execute(
+ $stmt,
+ array($i));
+
+ if (!$rs) die("Empty RS");
+ if ($rs->EOF) die("EOF RS");
+ rs2html($rs);
+ }
+}
+if (1) {
+ $db = ADONewConnection('oci8');
+ $db->PConnect('','scott','natsoft');
+ $db->debug = true;
+ $db->Execute("delete from emp where ename='John'");
+ print $db->Affected_Rows().'<BR>';
+ $stmt = &$db->Prepare('insert into emp (empno, ename) values (:empno,
:ename)');
+ $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John'));
+ // prepare not quite ready for prime time
+ //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
+ if (!$rs) die("Empty RS");
+
+ $db->setfetchmode(ADODB_FETCH_NUM);
+
+ $vv = 'A%';
+ $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true);
+ $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
+ $db->OutParameter($stmt, $vv, 'tt');
+ $rs = $db->Execute($stmt);
+ while (!$rs->EOF) {
+ adodb_pr($rs->fields);
+ $rs->MoveNext();
+ }
+ echo " val = $vv";
+
+}
+
+if (0) {
+ $db = ADONewConnection('odbc_oracle');
+ if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect');
+ $db->debug = true;
+ $rs = &$db->Execute(
+ 'select * from adoxyz where firstname=? and trim(lastname)=?',
+ array('first'=>'Caroline','last'=>'Miranda'));
+ if (!$rs) die("Empty RS");
+ if ($rs->EOF) die("EOF RS");
+ rs2html($rs);
+}
?>
\ No newline at end of file
Index: test-php5.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test-php5.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test-php5.php 29 Nov 2004 23:03:54 -0000 1.1
+++ test-php5.php 27 Jan 2005 14:43:47 -0000 1.2
@@ -1,68 +1,68 @@
-<?php
-/*
- V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 8.
- */
-
-
-error_reporting(E_ALL);
-
-$path = dirname(__FILE__);
-
-include("$path/../adodb-exceptions.inc.php");
-include("$path/../adodb.inc.php");
-
-echo "<h3>PHP ".PHP_VERSION."</h3>\n";
-try {
-
-$dbt = 'oci8po';
-
-switch($dbt) {
-case 'oci8po':
- $db = NewADOConnection("oci8po");
- $db->Connect('','scott','natsoft');
- break;
-default:
-case 'mysql':
- $db = NewADOConnection("mysql");
- $db->Connect('localhost','root','','test');
- break;
-
-case 'mysqli':
- $db = NewADOConnection("mysqli://root:@localhost/test");
- //$db->Connect('localhost','root','','test');
- break;
-}
-
-$db->debug=1;
-
-$cnt = $db->GetOne("select count(*) from adoxyz where ?<id and
id<?",array(10,20));
-$stmt = $db->Prepare("select * from adoxyz where ?<id and id<?");
-if (!$stmt) echo $db->ErrorMsg(),"\n";
-$rs = $db->Execute($stmt,array(10,20));
-
-$i = 0;
-foreach($rs as $v) {
- $i += 1;
- echo "rec $i: "; adodb_pr($v); adodb_pr($rs->fields);
- flush();
-}
-
-
-if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n");
-
-
-$rs = $db->Execute("select bad from badder");
-
-} catch (exception $e) {
- adodb_pr($e);
- echo "<h3>adodb_backtrace:</h3>\n";
- $e = adodb_backtrace($e->gettrace());
-}
-
-$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order
by id");
-echo "Result=\n",$rs;
+<?php
+/*
+ V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 8.
+ */
+
+
+error_reporting(E_ALL);
+
+$path = dirname(__FILE__);
+
+include("$path/../adodb-exceptions.inc.php");
+include("$path/../adodb.inc.php");
+
+echo "<h3>PHP ".PHP_VERSION."</h3>\n";
+try {
+
+$dbt = 'oci8po';
+
+switch($dbt) {
+case 'oci8po':
+ $db = NewADOConnection("oci8po");
+ $db->Connect('','scott','natsoft');
+ break;
+default:
+case 'mysql':
+ $db = NewADOConnection("mysql");
+ $db->Connect('localhost','root','','test');
+ break;
+
+case 'mysqli':
+ $db = NewADOConnection("mysqli://root:@localhost/test");
+ //$db->Connect('localhost','root','','test');
+ break;
+}
+
+$db->debug=1;
+
+$cnt = $db->GetOne("select count(*) from adoxyz where ?<id and
id<?",array(10,20));
+$stmt = $db->Prepare("select * from adoxyz where ?<id and id<?");
+if (!$stmt) echo $db->ErrorMsg(),"\n";
+$rs = $db->Execute($stmt,array(10,20));
+
+$i = 0;
+foreach($rs as $v) {
+ $i += 1;
+ echo "rec $i: "; adodb_pr($v); adodb_pr($rs->fields);
+ flush();
+}
+
+
+if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n");
+
+
+$rs = $db->Execute("select bad from badder");
+
+} catch (exception $e) {
+ adodb_pr($e);
+ echo "<h3>adodb_backtrace:</h3>\n";
+ $e = adodb_backtrace($e->gettrace());
+}
+
+$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order
by id");
+echo "Result=\n",$rs;
?>
\ No newline at end of file
Index: testpaging.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testpaging.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testpaging.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testpaging.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,83 +1,83 @@
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-error_reporting(E_ALL);
-
-
-include_once('../adodb.inc.php');
-include_once('../adodb-pager.inc.php');
-
-$driver = 'oci8';
-$sql = 'select ID, firstname as "First Name", lastname as "Last Name" from
adoxyz order by id';
-//$sql = 'select count(*),firstname from adoxyz group by firstname order by 2
';
-$sql = 'select distinct firstname, lastname from adoxyz order by firstname';
-
-if ($driver == 'postgres') {
- $db = NewADOConnection('postgres');
- $db->PConnect('localhost','tester','test','test');
-}
-
-if ($driver == 'access') {
- $db = NewADOConnection('access');
- $db->PConnect("nwind", "", "", "");
-}
-
-if ($driver == 'ibase') {
- $db = NewADOConnection('ibase');
- $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb",
"sysdba", "masterkey", "");
- $sql = 'select distinct firstname, lastname from adoxyz order by
firstname';
-
-}
-if ($driver == 'mssql') {
- $db = NewADOConnection('mssql');
- $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind');
-}
-if ($driver == 'oci8') {
- $db = NewADOConnection('oci8');
- $db->Connect('','scott','natsoft');
-}
-
-if ($driver == 'access') {
- $db = NewADOConnection('access');
- $db->Connect('nwind');
-}
-
-if (empty($driver) or $driver == 'mysql') {
- $db = NewADOConnection('mysql');
- $db->Connect('localhost','root','','xphplens');
-}
-
-//$db->pageExecuteCountRows = false;
-
-$db->debug = true;
-
-if (0) {
-$rs = &$db->Execute($sql);
-include_once('../toexport.inc.php');
-print "<pre>";
-print rs2csv($rs); # return a string
-
-print '<hr>';
-$rs->MoveFirst(); # note, some databases do not support MoveFirst
-print rs2tab($rs); # return a string
-
-print '<hr>';
-$rs->MoveFirst();
-rs2tabout($rs); # send to stdout directly
-print "</pre>";
-}
-
-$pager = new ADODB_Pager($db,$sql);
-$pager->showPageLinks = true;
-$pager->linksPerPage = 3;
-$pager->cache = 60;
-$pager->Render($rows=7);
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+error_reporting(E_ALL);
+
+
+include_once('../adodb.inc.php');
+include_once('../adodb-pager.inc.php');
+
+$driver = 'oci8';
+$sql = 'select ID, firstname as "First Name", lastname as "Last Name" from
adoxyz order by id';
+//$sql = 'select count(*),firstname from adoxyz group by firstname order by 2
';
+$sql = 'select distinct firstname, lastname from adoxyz order by firstname';
+
+if ($driver == 'postgres') {
+ $db = NewADOConnection('postgres');
+ $db->PConnect('localhost','tester','test','test');
+}
+
+if ($driver == 'access') {
+ $db = NewADOConnection('access');
+ $db->PConnect("nwind", "", "", "");
+}
+
+if ($driver == 'ibase') {
+ $db = NewADOConnection('ibase');
+ $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb",
"sysdba", "masterkey", "");
+ $sql = 'select distinct firstname, lastname from adoxyz order by
firstname';
+
+}
+if ($driver == 'mssql') {
+ $db = NewADOConnection('mssql');
+ $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind');
+}
+if ($driver == 'oci8') {
+ $db = NewADOConnection('oci8');
+ $db->Connect('','scott','natsoft');
+}
+
+if ($driver == 'access') {
+ $db = NewADOConnection('access');
+ $db->Connect('nwind');
+}
+
+if (empty($driver) or $driver == 'mysql') {
+ $db = NewADOConnection('mysql');
+ $db->Connect('localhost','root','','xphplens');
+}
+
+//$db->pageExecuteCountRows = false;
+
+$db->debug = true;
+
+if (0) {
+$rs = &$db->Execute($sql);
+include_once('../toexport.inc.php');
+print "<pre>";
+print rs2csv($rs); # return a string
+
+print '<hr>';
+$rs->MoveFirst(); # note, some databases do not support MoveFirst
+print rs2tab($rs); # return a string
+
+print '<hr>';
+$rs->MoveFirst();
+rs2tabout($rs); # send to stdout directly
+print "</pre>";
+}
+
+$pager = new ADODB_Pager($db,$sql);
+$pager->showPageLinks = true;
+$pager->linksPerPage = 3;
+$pager->cache = 60;
+$pager->Render($rows=7);
?>
\ No newline at end of file
Index: test2.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test2.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test2.php 29 Nov 2004 23:03:54 -0000 1.3
+++ test2.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,26 +1,26 @@
-<?php
-
-// BASIC ADO test
-
- include_once('../adodb.inc.php');
-
- $db = &ADONewConnection("ado_access");
- $db->debug=1;
- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
- $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
- . 'DATA SOURCE=' . $access . ';';
-
- echo "<p>PHP ",PHP_VERSION,"</p>";
-
- $db->Connect($myDSN) || die('fail');
-
- print_r($db->ServerInfo());
-
- try {
- $rs = $db->Execute("select $db->sysTimeStamp,* from adoxyz where
id>02xx");
- print_r($rs->fields);
- } catch(exception $e) {
- print_r($e);
- echo "<p> Date m/d/Y =",$db->UserDate($rs->fields[4],'m/d/Y');
- }
+<?php
+
+// BASIC ADO test
+
+ include_once('../adodb.inc.php');
+
+ $db = &ADONewConnection("ado_access");
+ $db->debug=1;
+ $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
+ $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
+ . 'DATA SOURCE=' . $access . ';';
+
+ echo "<p>PHP ",PHP_VERSION,"</p>";
+
+ $db->Connect($myDSN) || die('fail');
+
+ print_r($db->ServerInfo());
+
+ try {
+ $rs = $db->Execute("select $db->sysTimeStamp,* from adoxyz where
id>02xx");
+ print_r($rs->fields);
+ } catch(exception $e) {
+ print_r($e);
+ echo "<p> Date m/d/Y =",$db->UserDate($rs->fields[4],'m/d/Y');
+ }
?>
\ No newline at end of file
Index: testmssql.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testmssql.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testmssql.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testmssql.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,76 +1,76 @@
-<?php
-
-/**
- * @version V4.50 6 July 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- * Released under both BSD license and Lesser GPL library license.
- * Whenever there is any discrepancy between the two licenses,
- * the BSD license will take precedence.
- *
- * Set tabs to 4 for best viewing.
- *
- * Latest version is available at http://php.weblogs.com
- *
- * Test GetUpdateSQL and GetInsertSQL.
- */
-
-error_reporting(E_ALL);
-
-
-include('../adodb.inc.php');
-include('../tohtml.inc.php');
-
-//==========================
-// This code tests an insert
-
-
-
-$conn = &ADONewConnection("mssql"); // create a connection
-$conn->Connect('localhost','sa','natsoft','northwind') or die('Fail');
-
-$conn->debug =1;
-$query = 'select * from products';
-$conn->SetFetchMode(ADODB_FETCH_ASSOC);
-$rs = $conn->Execute($query);
-echo "<pre>";
-while( !$rs->EOF ) {
- $output[] = $rs->fields;
- var_dump($rs->fields);
- $rs->MoveNext();
- print "<p>";
-}
-die();
-
-
-$p = $conn->Prepare('insert into products (productname,unitprice,dcreated)
values (?,?,?)');
-echo "<pre>";
-print_r($p);
-
-$conn->debug=1;
-$conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
-
-$p = $conn->Prepare('select * from products where productname like ?');
-$arr = $conn->getarray($p,array('V%'));
-print_r($arr);
-die();
-
-//$conn = &ADONewConnection("mssql");
-//$conn->Connect('mangrove','sa','natsoft','ai');
-
-//$conn->Connect('mangrove','sa','natsoft','ai');
-$conn->debug=1;
-$conn->Execute('delete from blobtest');
-
-$conn->Execute('insert into blobtest (id) values(1)');
-$conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
-$rs = $conn->Execute('select b1 from blobtest where id=1');
-
-$output = "c:\\temp\\test_out-".date('H-i-s').".gif";
-print "Saving file <b>$output</b>, size=".strlen($rs->fields[0])."<p>";
-$fd = fopen($output, "wb");
-fwrite($fd, $rs->fields[0]);
-fclose($fd);
-
-print " <a href=file://$output>View Image</a>";
-//$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');
-//rs2html($rs);
+<?php
+
+/**
+ * @version V4.50 6 July 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ * Released under both BSD license and Lesser GPL library license.
+ * Whenever there is any discrepancy between the two licenses,
+ * the BSD license will take precedence.
+ *
+ * Set tabs to 4 for best viewing.
+ *
+ * Latest version is available at http://php.weblogs.com
+ *
+ * Test GetUpdateSQL and GetInsertSQL.
+ */
+
+error_reporting(E_ALL);
+
+
+include('../adodb.inc.php');
+include('../tohtml.inc.php');
+
+//==========================
+// This code tests an insert
+
+
+
+$conn = &ADONewConnection("mssql"); // create a connection
+$conn->Connect('localhost','sa','natsoft','northwind') or die('Fail');
+
+$conn->debug =1;
+$query = 'select * from products';
+$conn->SetFetchMode(ADODB_FETCH_ASSOC);
+$rs = $conn->Execute($query);
+echo "<pre>";
+while( !$rs->EOF ) {
+ $output[] = $rs->fields;
+ var_dump($rs->fields);
+ $rs->MoveNext();
+ print "<p>";
+}
+die();
+
+
+$p = $conn->Prepare('insert into products (productname,unitprice,dcreated)
values (?,?,?)');
+echo "<pre>";
+print_r($p);
+
+$conn->debug=1;
+$conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
+
+$p = $conn->Prepare('select * from products where productname like ?');
+$arr = $conn->getarray($p,array('V%'));
+print_r($arr);
+die();
+
+//$conn = &ADONewConnection("mssql");
+//$conn->Connect('mangrove','sa','natsoft','ai');
+
+//$conn->Connect('mangrove','sa','natsoft','ai');
+$conn->debug=1;
+$conn->Execute('delete from blobtest');
+
+$conn->Execute('insert into blobtest (id) values(1)');
+$conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
+$rs = $conn->Execute('select b1 from blobtest where id=1');
+
+$output = "c:\\temp\\test_out-".date('H-i-s').".gif";
+print "Saving file <b>$output</b>, size=".strlen($rs->fields[0])."<p>";
+$fd = fopen($output, "wb");
+fwrite($fd, $rs->fields[0]);
+fclose($fd);
+
+print " <a href=file://$output>View Image</a>";
+//$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');
+//rs2html($rs);
?>
\ No newline at end of file
Index: test5.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test5.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test5.php 29 Nov 2004 23:03:54 -0000 1.3
+++ test5.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,47 +1,47 @@
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-
-// Select an empty record from the database
-
-include('../adodb.inc.php');
-include('../tohtml.inc.php');
-
-include('../adodb-errorpear.inc.php');
-
-if (0) {
- $conn = &ADONewConnection('mysql');
- $conn->debug=1;
- $conn->PConnect("localhost","root","","xphplens");
- print $conn->databaseType.':'.$conn->GenID().'<br>';
-}
-
-if (0) {
- $conn = &ADONewConnection("oci8"); // create a connection
- $conn->debug=1;
- $conn->PConnect("falcon", "scott", "tiger",
"juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb
- print $conn->databaseType.':'.$conn->GenID();
-}
-
-if (0) {
- $conn = &ADONewConnection("ibase"); // create a connection
- $conn->debug=1;
-
$conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb",
"sysdba", "masterkey", ""); // connect to MySQL, testdb
- print $conn->databaseType.':'.$conn->GenID().'<br>';
-}
-
-if (0) {
- $conn = &ADONewConnection('postgres');
- $conn->debug=1;
- @$conn->PConnect("susetikus","tester","test","test");
- print $conn->databaseType.':'.$conn->GenID().'<br>';
-}
-?>
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+
+// Select an empty record from the database
+
+include('../adodb.inc.php');
+include('../tohtml.inc.php');
+
+include('../adodb-errorpear.inc.php');
+
+if (0) {
+ $conn = &ADONewConnection('mysql');
+ $conn->debug=1;
+ $conn->PConnect("localhost","root","","xphplens");
+ print $conn->databaseType.':'.$conn->GenID().'<br>';
+}
+
+if (0) {
+ $conn = &ADONewConnection("oci8"); // create a connection
+ $conn->debug=1;
+ $conn->PConnect("falcon", "scott", "tiger",
"juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb
+ print $conn->databaseType.':'.$conn->GenID();
+}
+
+if (0) {
+ $conn = &ADONewConnection("ibase"); // create a connection
+ $conn->debug=1;
+
$conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb",
"sysdba", "masterkey", ""); // connect to MySQL, testdb
+ print $conn->databaseType.':'.$conn->GenID().'<br>';
+}
+
+if (0) {
+ $conn = &ADONewConnection('postgres');
+ $conn->debug=1;
+ @$conn->PConnect("susetikus","tester","test","test");
+ print $conn->databaseType.':'.$conn->GenID().'<br>';
+}
+?>
Index: testcache.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testcache.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testcache.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testcache.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,29 +1,29 @@
-<html>
-<body>
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-$ADODB_CACHE_DIR = dirname(tempnam('/tmp',''));
-include("../adodb.inc.php");
-
-if (isset($access)) {
- $db=ADONewConnection('access');
- $db->PConnect('nwind');
-} else {
- $db = ADONewConnection('mysql');
- $db->PConnect('mangrove','root','','xphplens');
-}
-if (isset($cache)) $rs = $db->CacheExecute(120,'select * from products');
-else $rs = $db->Execute('select * from products');
-
-$arr = $rs->GetArray();
-print sizeof($arr);
+<html>
+<body>
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+$ADODB_CACHE_DIR = dirname(tempnam('/tmp',''));
+include("../adodb.inc.php");
+
+if (isset($access)) {
+ $db=ADONewConnection('access');
+ $db->PConnect('nwind');
+} else {
+ $db = ADONewConnection('mysql');
+ $db->PConnect('mangrove','root','','xphplens');
+}
+if (isset($cache)) $rs = $db->CacheExecute(120,'select * from products');
+else $rs = $db->Execute('select * from products');
+
+$arr = $rs->GetArray();
+print sizeof($arr);
?>
\ No newline at end of file
Index: test-perf.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test-perf.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test-perf.php 29 Nov 2004 23:03:53 -0000 1.1
+++ test-perf.php 27 Jan 2005 14:43:47 -0000 1.2
@@ -1,50 +1,50 @@
-<?php
-
-include_once('../adodb-perf.inc.php');
-
-error_reporting(E_ALL);
-session_start();
-
-if (isset($_GET)) {
- foreach($_GET as $k => $v) {
- if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k;
- }
-}
-
-if (isset($_SESSION['_db'])) {
- $_db = $_SESSION['_db'];
- $_GET[$_db] = 1;
- $$_db = 1;
-}
-
-echo "<h1>Performance Monitoring</h1>";
-include_once('testdatabases.inc.php');
-
-
-function testdb($db)
-{
- if (!$db) return;
- echo "<font size=1>";print_r($db->ServerInfo()); echo "
user=".$db->user."</font>";
-
- $perf = NewPerfMonitor($db);
-
- # unit tests
- if (0) {
- //$DB->debug=1;
- echo "Data Cache Size=".$perf->DBParameter('data cache
size').'<p>';
- echo $perf->HealthCheck();
- echo($perf->SuspiciousSQL());
- echo($perf->ExpensiveSQL());
- echo($perf->InvalidSQL());
- echo $perf->Tables();
-
- echo "<pre>";
- echo $perf->HealthCheckCLI();
- $perf->Poll(3);
- die();
- }
-
- if ($perf) $perf->UI(3);
-}
-
-?>
+<?php
+
+include_once('../adodb-perf.inc.php');
+
+error_reporting(E_ALL);
+session_start();
+
+if (isset($_GET)) {
+ foreach($_GET as $k => $v) {
+ if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k;
+ }
+}
+
+if (isset($_SESSION['_db'])) {
+ $_db = $_SESSION['_db'];
+ $_GET[$_db] = 1;
+ $$_db = 1;
+}
+
+echo "<h1>Performance Monitoring</h1>";
+include_once('testdatabases.inc.php');
+
+
+function testdb($db)
+{
+ if (!$db) return;
+ echo "<font size=1>";print_r($db->ServerInfo()); echo "
user=".$db->user."</font>";
+
+ $perf = NewPerfMonitor($db);
+
+ # unit tests
+ if (0) {
+ //$DB->debug=1;
+ echo "Data Cache Size=".$perf->DBParameter('data cache
size').'<p>';
+ echo $perf->HealthCheck();
+ echo($perf->SuspiciousSQL());
+ echo($perf->ExpensiveSQL());
+ echo($perf->InvalidSQL());
+ echo $perf->Tables();
+
+ echo "<pre>";
+ echo $perf->HealthCheckCLI();
+ $perf->Poll(3);
+ die();
+ }
+
+ if ($perf) $perf->UI(3);
+}
+
+?>
Index: testpear.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testpear.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testpear.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testpear.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,34 +1,34 @@
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- Set tabs to 4 for best viewing.
-
- Latest version is available at http://adodb.sourceforge.net
-*/
-
-error_reporting(E_ALL);
-
-include_once('../adodb-pear.inc.php');
-$username = 'root';
-$password = '';
-$hostname = 'localhost';
-$databasename = 'xphplens';
-$driver = 'mysql';
-
-$dsn = "$driver://$username:$password@$hostname/$databasename";
-
-$db = DB::Connect($dsn);
-$db->setFetchMode(ADODB_FETCH_ASSOC);
-$rs = $db->Query('select firstname,lastname from adoxyz');
-$cnt = 0;
-while ($arr = $rs->FetchRow()) {
- print_r($arr);
- print "<br>";
- $cnt += 1;
-}
-
-if ($cnt != 50) print "<b>Error in \$cnt = $cnt</b>";
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+ Set tabs to 4 for best viewing.
+
+ Latest version is available at http://adodb.sourceforge.net
+*/
+
+error_reporting(E_ALL);
+
+include_once('../adodb-pear.inc.php');
+$username = 'root';
+$password = '';
+$hostname = 'localhost';
+$databasename = 'xphplens';
+$driver = 'mysql';
+
+$dsn = "$driver://$username:$password@$hostname/$databasename";
+
+$db = DB::Connect($dsn);
+$db->setFetchMode(ADODB_FETCH_ASSOC);
+$rs = $db->Query('select firstname,lastname from adoxyz');
+$cnt = 0;
+while ($arr = $rs->FetchRow()) {
+ print_r($arr);
+ print "<br>";
+ $cnt += 1;
+}
+
+if ($cnt != 50) print "<b>Error in \$cnt = $cnt</b>";
?>
\ No newline at end of file
Index: test-datadict.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test-datadict.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test-datadict.php 29 Nov 2004 23:03:53 -0000 1.3
+++ test-datadict.php 27 Jan 2005 14:43:46 -0000 1.4
@@ -1,248 +1,248 @@
-<?php
-/*
-
- V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
-
- Set tabs to 4 for best viewing.
-
-*/
-
-error_reporting(E_ALL);
-include_once('../adodb.inc.php');
-
-foreach(array('sapdb','sybase','mysqlt','access','oci8','postgres','odbc_mssql','odbc','db2','firebird','informix')
as $dbType) {
- echo "<h3>$dbType</h3><p>";
- $db = NewADOConnection($dbType);
- $dict = NewDataDictionary($db);
-
- if (!$dict) continue;
- $dict->debug = 1;
-
- $opts = array('REPLACE','mysql' => 'TYPE=INNODB', 'oci8' => 'TABLESPACE
USERS');
-
-/* $flds = array(
- array('id', 'I',
- 'AUTO','KEY'),
-
- array('name' => 'firstname', 'type' => 'varchar','size' => 30,
- 'DEFAULT'=>'Joan'),
-
- array('lastname','varchar',28,
-
'DEFAULT'=>'Chen','key'),
-
- array('averylonglongfieldname','X',1024,
- 'NOTNULL','default' =>
'test'),
-
- array('price','N','7.2',
- 'NOTNULL','default' =>
'0.00'),
-
- array('MYDATE', 'D',
- 'DEFDATE'),
- array('TS','T',
- 'DEFTIMESTAMP')
- );*/
-
- $flds = "
-ID I AUTO KEY,
-FIRSTNAME VARCHAR(30) DEFAULT 'Joan',
-LASTNAME VARCHAR(28) DEFAULT 'Chen' key,
-averylonglongfieldname X(1024) DEFAULT 'test',
-price N(7.2) DEFAULT '0.00',
-MYDATE D DEFDATE,
-BIGFELLOW X NOTNULL,
-TS T DEFTIMESTAMP";
-
-
- $sqla =
$dict->CreateDatabase('KUTU',array('postgres'=>"LOCATION='/u01/postdata'"));
- $dict->SetSchema('KUTU');
-
- $sqli = ($dict->CreateTableSQL('testtable',$flds, $opts));
- $sqla =& array_merge($sqla,$sqli);
-
- $sqli =
$dict->CreateIndexSQL('idx','testtable','firstname,lastname',array('BITMAP','FULLTEXT','CLUSTERED','HASH'));
- $sqla =& array_merge($sqla,$sqli);
- $sqli =
$dict->CreateIndexSQL('idx2','testtable','price,lastname');//,array('BITMAP','FULLTEXT','CLUSTERED'));
- $sqla =& array_merge($sqla,$sqli);
-
- $addflds = array(array('height', 'F'),array('weight','F'));
- $sqli = $dict->AddColumnSQL('testtable',$addflds);
- $sqla =& array_merge($sqla,$sqli);
- $addflds = array(array('height',
'F','NOTNULL'),array('weight','F','NOTNULL'));
- $sqli = $dict->AlterColumnSQL('testtable',$addflds);
- $sqla =& array_merge($sqla,$sqli);
-
-
- printsqla($dbType,$sqla);
-
- if (file_exists('d:\inetpub\wwwroot\php\phplens\adodb\adodb.inc.php'))
- if ($dbType == 'mysqlt') {
- $db->Connect('localhost', "root", "", "test");
- $dict->SetSchema('');
- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
- if ($sqla2) printsqla($dbType,$sqla2);
- }
- if ($dbType == 'postgres') {
- if (@$db->Connect('localhost', "tester", "test", "test"));
- $dict->SetSchema('');
- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
- if ($sqla2) printsqla($dbType,$sqla2);
- }
-
- if ($dbType == 'odbc_mssql') {
- $dsn = $dsn = "PROVIDER=MSDASQL;Driver={SQL
Server};Server=localhost;Database=northwind;";
- if (@$db->Connect($dsn, "sa", "natsoft", "test"));
- $dict->SetSchema('');
- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
- if ($sqla2) printsqla($dbType,$sqla2);
- }
-
-
-
- adodb_pr($dict->databaseType);
- printsqla($dbType, $dict->DropColumnSQL('table',array('`col`','col2')));
- printsqla($dbType, $dict->ChangeTableSQL('adoxyz','LASTNAME
varchar(32)'));
-
-}
-
-function printsqla($dbType,$sqla)
-{
- print "<pre>";
- //print_r($dict->MetaTables());
- foreach($sqla as $s) {
- $s = htmlspecialchars($s);
- print "$s;\n";
- if ($dbType == 'oci8') print "/\n";
- }
- print "</pre><hr>";
-}
-
-/***
-
-Generated SQL:
-
-mysql
-
-CREATE DATABASE KUTU;
-DROP TABLE KUTU.testtable;
-CREATE TABLE KUTU.testtable (
-id INTEGER NOT NULL AUTO_INCREMENT,
-firstname VARCHAR(30) DEFAULT 'Joan',
-lastname VARCHAR(28) NOT NULL DEFAULT 'Chen',
-averylonglongfieldname LONGTEXT NOT NULL,
-price NUMERIC(7,2) NOT NULL DEFAULT 0.00,
-MYDATE DATE DEFAULT CURDATE(),
- PRIMARY KEY (id, lastname)
-)TYPE=ISAM;
-CREATE FULLTEXT INDEX idx ON KUTU.testtable (firstname,lastname);
-CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
-ALTER TABLE KUTU.testtable ADD height DOUBLE;
-ALTER TABLE KUTU.testtable ADD weight DOUBLE;
-ALTER TABLE KUTU.testtable MODIFY COLUMN height DOUBLE NOT NULL;
-ALTER TABLE KUTU.testtable MODIFY COLUMN weight DOUBLE NOT NULL;
-
-
---------------------------------------------------------------------------------
-
-oci8
-
-CREATE USER KUTU IDENTIFIED BY tiger;
-/
-GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO
KUTU;
-/
-DROP TABLE KUTU.testtable CASCADE CONSTRAINTS;
-/
-CREATE TABLE KUTU.testtable (
-id NUMBER(16) NOT NULL,
-firstname VARCHAR(30) DEFAULT 'Joan',
-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
-averylonglongfieldname CLOB NOT NULL,
-price NUMBER(7,2) DEFAULT 0.00 NOT NULL,
-MYDATE DATE DEFAULT TRUNC(SYSDATE),
- PRIMARY KEY (id, lastname)
-)TABLESPACE USERS;
-/
-DROP SEQUENCE KUTU.SEQ_testtable;
-/
-CREATE SEQUENCE KUTU.SEQ_testtable;
-/
-CREATE OR REPLACE TRIGGER KUTU.TRIG_SEQ_testtable BEFORE insert ON
KUTU.testtable
- FOR EACH ROW
- BEGIN
- select KUTU.SEQ_testtable.nextval into :new.id from dual;
- END;
-/
-CREATE BITMAP INDEX idx ON KUTU.testtable (firstname,lastname);
-/
-CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
-/
-ALTER TABLE testtable ADD (
- height NUMBER,
- weight NUMBER);
-/
-ALTER TABLE testtable MODIFY(
- height NUMBER NOT NULL,
- weight NUMBER NOT NULL);
-/
-
-
---------------------------------------------------------------------------------
-
-postgres
-AlterColumnSQL not supported for PostgreSQL
-
-
-CREATE DATABASE KUTU LOCATION='/u01/postdata';
-DROP TABLE KUTU.testtable;
-CREATE TABLE KUTU.testtable (
-id SERIAL,
-firstname VARCHAR(30) DEFAULT 'Joan',
-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
-averylonglongfieldname TEXT NOT NULL,
-price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
-MYDATE DATE DEFAULT CURRENT_DATE,
- PRIMARY KEY (id, lastname)
-);
-CREATE INDEX idx ON KUTU.testtable USING HASH (firstname,lastname);
-CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
-ALTER TABLE KUTU.testtable ADD height FLOAT8;
-ALTER TABLE KUTU.testtable ADD weight FLOAT8;
-
-
---------------------------------------------------------------------------------
-
-odbc_mssql
-
-CREATE DATABASE KUTU;
-DROP TABLE KUTU.testtable;
-CREATE TABLE KUTU.testtable (
-id INT IDENTITY(1,1) NOT NULL,
-firstname VARCHAR(30) DEFAULT 'Joan',
-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
-averylonglongfieldname TEXT NOT NULL,
-price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
-MYDATE DATETIME DEFAULT GetDate(),
- PRIMARY KEY (id, lastname)
-);
-CREATE CLUSTERED INDEX idx ON KUTU.testtable (firstname,lastname);
-CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
-ALTER TABLE KUTU.testtable ADD
- height REAL,
- weight REAL;
-ALTER TABLE KUTU.testtable ALTER COLUMN height REAL NOT NULL;
-ALTER TABLE KUTU.testtable ALTER COLUMN weight REAL NOT NULL;
-
-
---------------------------------------------------------------------------------
-*/
-
-
-echo "<h1>Test XML Schema</h1>";
-$ff = file('xmlschema.xml');
-echo "<pre>";
-foreach($ff as $xml) echo htmlspecialchars($xml);
-echo "</pre>";
-include_once('test-xmlschema.php');
+<?php
+/*
+
+ V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+
+ Set tabs to 4 for best viewing.
+
+*/
+
+error_reporting(E_ALL);
+include_once('../adodb.inc.php');
+
+foreach(array('sapdb','sybase','mysqlt','access','oci8','postgres','odbc_mssql','odbc','db2','firebird','informix')
as $dbType) {
+ echo "<h3>$dbType</h3><p>";
+ $db = NewADOConnection($dbType);
+ $dict = NewDataDictionary($db);
+
+ if (!$dict) continue;
+ $dict->debug = 1;
+
+ $opts = array('REPLACE','mysql' => 'TYPE=INNODB', 'oci8' => 'TABLESPACE
USERS');
+
+/* $flds = array(
+ array('id', 'I',
+ 'AUTO','KEY'),
+
+ array('name' => 'firstname', 'type' => 'varchar','size' => 30,
+ 'DEFAULT'=>'Joan'),
+
+ array('lastname','varchar',28,
+
'DEFAULT'=>'Chen','key'),
+
+ array('averylonglongfieldname','X',1024,
+ 'NOTNULL','default' =>
'test'),
+
+ array('price','N','7.2',
+ 'NOTNULL','default' =>
'0.00'),
+
+ array('MYDATE', 'D',
+ 'DEFDATE'),
+ array('TS','T',
+ 'DEFTIMESTAMP')
+ );*/
+
+ $flds = "
+ID I AUTO KEY,
+FIRSTNAME VARCHAR(30) DEFAULT 'Joan',
+LASTNAME VARCHAR(28) DEFAULT 'Chen' key,
+averylonglongfieldname X(1024) DEFAULT 'test',
+price N(7.2) DEFAULT '0.00',
+MYDATE D DEFDATE,
+BIGFELLOW X NOTNULL,
+TS T DEFTIMESTAMP";
+
+
+ $sqla =
$dict->CreateDatabase('KUTU',array('postgres'=>"LOCATION='/u01/postdata'"));
+ $dict->SetSchema('KUTU');
+
+ $sqli = ($dict->CreateTableSQL('testtable',$flds, $opts));
+ $sqla =& array_merge($sqla,$sqli);
+
+ $sqli =
$dict->CreateIndexSQL('idx','testtable','firstname,lastname',array('BITMAP','FULLTEXT','CLUSTERED','HASH'));
+ $sqla =& array_merge($sqla,$sqli);
+ $sqli =
$dict->CreateIndexSQL('idx2','testtable','price,lastname');//,array('BITMAP','FULLTEXT','CLUSTERED'));
+ $sqla =& array_merge($sqla,$sqli);
+
+ $addflds = array(array('height', 'F'),array('weight','F'));
+ $sqli = $dict->AddColumnSQL('testtable',$addflds);
+ $sqla =& array_merge($sqla,$sqli);
+ $addflds = array(array('height',
'F','NOTNULL'),array('weight','F','NOTNULL'));
+ $sqli = $dict->AlterColumnSQL('testtable',$addflds);
+ $sqla =& array_merge($sqla,$sqli);
+
+
+ printsqla($dbType,$sqla);
+
+ if (file_exists('d:\inetpub\wwwroot\php\phplens\adodb\adodb.inc.php'))
+ if ($dbType == 'mysqlt') {
+ $db->Connect('localhost', "root", "", "test");
+ $dict->SetSchema('');
+ $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
+ if ($sqla2) printsqla($dbType,$sqla2);
+ }
+ if ($dbType == 'postgres') {
+ if (@$db->Connect('localhost', "tester", "test", "test"));
+ $dict->SetSchema('');
+ $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
+ if ($sqla2) printsqla($dbType,$sqla2);
+ }
+
+ if ($dbType == 'odbc_mssql') {
+ $dsn = $dsn = "PROVIDER=MSDASQL;Driver={SQL
Server};Server=localhost;Database=northwind;";
+ if (@$db->Connect($dsn, "sa", "natsoft", "test"));
+ $dict->SetSchema('');
+ $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds);
+ if ($sqla2) printsqla($dbType,$sqla2);
+ }
+
+
+
+ adodb_pr($dict->databaseType);
+ printsqla($dbType, $dict->DropColumnSQL('table',array('`col`','col2')));
+ printsqla($dbType, $dict->ChangeTableSQL('adoxyz','LASTNAME
varchar(32)'));
+
+}
+
+function printsqla($dbType,$sqla)
+{
+ print "<pre>";
+ //print_r($dict->MetaTables());
+ foreach($sqla as $s) {
+ $s = htmlspecialchars($s);
+ print "$s;\n";
+ if ($dbType == 'oci8') print "/\n";
+ }
+ print "</pre><hr>";
+}
+
+/***
+
+Generated SQL:
+
+mysql
+
+CREATE DATABASE KUTU;
+DROP TABLE KUTU.testtable;
+CREATE TABLE KUTU.testtable (
+id INTEGER NOT NULL AUTO_INCREMENT,
+firstname VARCHAR(30) DEFAULT 'Joan',
+lastname VARCHAR(28) NOT NULL DEFAULT 'Chen',
+averylonglongfieldname LONGTEXT NOT NULL,
+price NUMERIC(7,2) NOT NULL DEFAULT 0.00,
+MYDATE DATE DEFAULT CURDATE(),
+ PRIMARY KEY (id, lastname)
+)TYPE=ISAM;
+CREATE FULLTEXT INDEX idx ON KUTU.testtable (firstname,lastname);
+CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
+ALTER TABLE KUTU.testtable ADD height DOUBLE;
+ALTER TABLE KUTU.testtable ADD weight DOUBLE;
+ALTER TABLE KUTU.testtable MODIFY COLUMN height DOUBLE NOT NULL;
+ALTER TABLE KUTU.testtable MODIFY COLUMN weight DOUBLE NOT NULL;
+
+
+--------------------------------------------------------------------------------
+
+oci8
+
+CREATE USER KUTU IDENTIFIED BY tiger;
+/
+GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO
KUTU;
+/
+DROP TABLE KUTU.testtable CASCADE CONSTRAINTS;
+/
+CREATE TABLE KUTU.testtable (
+id NUMBER(16) NOT NULL,
+firstname VARCHAR(30) DEFAULT 'Joan',
+lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
+averylonglongfieldname CLOB NOT NULL,
+price NUMBER(7,2) DEFAULT 0.00 NOT NULL,
+MYDATE DATE DEFAULT TRUNC(SYSDATE),
+ PRIMARY KEY (id, lastname)
+)TABLESPACE USERS;
+/
+DROP SEQUENCE KUTU.SEQ_testtable;
+/
+CREATE SEQUENCE KUTU.SEQ_testtable;
+/
+CREATE OR REPLACE TRIGGER KUTU.TRIG_SEQ_testtable BEFORE insert ON
KUTU.testtable
+ FOR EACH ROW
+ BEGIN
+ select KUTU.SEQ_testtable.nextval into :new.id from dual;
+ END;
+/
+CREATE BITMAP INDEX idx ON KUTU.testtable (firstname,lastname);
+/
+CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
+/
+ALTER TABLE testtable ADD (
+ height NUMBER,
+ weight NUMBER);
+/
+ALTER TABLE testtable MODIFY(
+ height NUMBER NOT NULL,
+ weight NUMBER NOT NULL);
+/
+
+
+--------------------------------------------------------------------------------
+
+postgres
+AlterColumnSQL not supported for PostgreSQL
+
+
+CREATE DATABASE KUTU LOCATION='/u01/postdata';
+DROP TABLE KUTU.testtable;
+CREATE TABLE KUTU.testtable (
+id SERIAL,
+firstname VARCHAR(30) DEFAULT 'Joan',
+lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
+averylonglongfieldname TEXT NOT NULL,
+price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
+MYDATE DATE DEFAULT CURRENT_DATE,
+ PRIMARY KEY (id, lastname)
+);
+CREATE INDEX idx ON KUTU.testtable USING HASH (firstname,lastname);
+CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
+ALTER TABLE KUTU.testtable ADD height FLOAT8;
+ALTER TABLE KUTU.testtable ADD weight FLOAT8;
+
+
+--------------------------------------------------------------------------------
+
+odbc_mssql
+
+CREATE DATABASE KUTU;
+DROP TABLE KUTU.testtable;
+CREATE TABLE KUTU.testtable (
+id INT IDENTITY(1,1) NOT NULL,
+firstname VARCHAR(30) DEFAULT 'Joan',
+lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL,
+averylonglongfieldname TEXT NOT NULL,
+price NUMERIC(7,2) DEFAULT 0.00 NOT NULL,
+MYDATE DATETIME DEFAULT GetDate(),
+ PRIMARY KEY (id, lastname)
+);
+CREATE CLUSTERED INDEX idx ON KUTU.testtable (firstname,lastname);
+CREATE INDEX idx2 ON KUTU.testtable (price,lastname);
+ALTER TABLE KUTU.testtable ADD
+ height REAL,
+ weight REAL;
+ALTER TABLE KUTU.testtable ALTER COLUMN height REAL NOT NULL;
+ALTER TABLE KUTU.testtable ALTER COLUMN weight REAL NOT NULL;
+
+
+--------------------------------------------------------------------------------
+*/
+
+
+echo "<h1>Test XML Schema</h1>";
+$ff = file('xmlschema.xml');
+echo "<pre>";
+foreach($ff as $xml) echo htmlspecialchars($xml);
+echo "</pre>";
+include_once('test-xmlschema.php');
?>
\ No newline at end of file
Index: benchmark.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/benchmark.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- benchmark.php 29 Nov 2004 23:03:52 -0000 1.3
+++ benchmark.php 27 Jan 2005 14:43:46 -0000 1.4
@@ -1,84 +1,84 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>ADODB Benchmarks</title>
-</head>
-
-<body>
-<?php
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
-
- Benchmark code to test the speed to the ADODB library with different
databases.
- This is a simplistic benchmark to be used as the basis for further testing.
- It should not be used as proof of the superiority of one database over the
other.
-*/
-
-$testmssql = true;
-//$testvfp = true;
-$testoracle = true;
-$testado = true;
-$testibase = true;
-$testaccess = true;
-$testmysql = true;
-$testsqlite = true;;
-
-set_time_limit(240); // increase timeout
-
-include("../tohtml.inc.php");
-include("../adodb.inc.php");
-
-function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname
char(24), lastname char(24), created date)")
-{
-GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
-
- adodb_backtrace();
-
- $max = 100;
- $sql = 'select * from ADOXYZ';
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i>
Database: <i>$db->database</i></h3>";
-
- // perform query once to cache results so we are only testing
throughput
- $rs = $db->Execute($sql);
- if (!$rs){
- print "Error in recordset<p>";
- return;
- }
- $arr = $rs->GetArray();
- //$db->debug = true;
- global $ADODB_COUNTRECS;
- $ADODB_COUNTRECS = false;
- $start = microtime();
- for ($i=0; $i < $max; $i++) {
- $rs =& $db->Execute($sql);
- $arr =& $rs->GetArray();
- // print $arr[0][1];
- }
- $end = microtime();
- $start = explode(' ',$start);
- $end = explode(' ',$end);
-
- //print_r($start);
- //print_r($end);
-
- // print_r($arr);
- $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
- printf ("<p>seconds = %8.2f for %d iterations each with %d
records</p>",$total,$max, sizeof($arr));
- flush();
-
-
- //$db->Close();
-}
-include("testdatabases.inc.php");
-
-?>
-
-
-</body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+<head>
+ <title>ADODB Benchmarks</title>
+</head>
+
+<body>
+<?php
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+
+ Benchmark code to test the speed to the ADODB library with different
databases.
+ This is a simplistic benchmark to be used as the basis for further testing.
+ It should not be used as proof of the superiority of one database over the
other.
+*/
+
+$testmssql = true;
+//$testvfp = true;
+$testoracle = true;
+$testado = true;
+$testibase = true;
+$testaccess = true;
+$testmysql = true;
+$testsqlite = true;;
+
+set_time_limit(240); // increase timeout
+
+include("../tohtml.inc.php");
+include("../adodb.inc.php");
+
+function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname
char(24), lastname char(24), created date)")
+{
+GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
+
+ adodb_backtrace();
+
+ $max = 100;
+ $sql = 'select * from ADOXYZ';
+ $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
+
+ //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i>
Database: <i>$db->database</i></h3>";
+
+ // perform query once to cache results so we are only testing
throughput
+ $rs = $db->Execute($sql);
+ if (!$rs){
+ print "Error in recordset<p>";
+ return;
+ }
+ $arr = $rs->GetArray();
+ //$db->debug = true;
+ global $ADODB_COUNTRECS;
+ $ADODB_COUNTRECS = false;
+ $start = microtime();
+ for ($i=0; $i < $max; $i++) {
+ $rs =& $db->Execute($sql);
+ $arr =& $rs->GetArray();
+ // print $arr[0][1];
+ }
+ $end = microtime();
+ $start = explode(' ',$start);
+ $end = explode(' ',$end);
+
+ //print_r($start);
+ //print_r($end);
+
+ // print_r($arr);
+ $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
+ printf ("<p>seconds = %8.2f for %d iterations each with %d
records</p>",$total,$max, sizeof($arr));
+ flush();
+
+
+ //$db->Close();
+}
+include("testdatabases.inc.php");
+
+?>
+
+
+</body>
+</html>
Index: test4.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/test4.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test4.php 29 Nov 2004 23:03:54 -0000 1.3
+++ test4.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,124 +1,124 @@
-<?php
-
-/**
- * @version V4.50 6 July 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- * Released under both BSD license and Lesser GPL library license.
- * Whenever there is any discrepancy between the two licenses,
- * the BSD license will take precedence.
- *
- * Set tabs to 4 for best viewing.
- *
- * Latest version is available at http://php.weblogs.com
- *
- * Test GetUpdateSQL and GetInsertSQL.
- */
-
-error_reporting(E_ALL);
-function testsql()
-{
-
-
-include('../adodb.inc.php');
-include('../tohtml.inc.php');
-
-global $ADODB_FORCE_TYPE;
-
-
-//==========================
-// This code tests an insert
-
-$sql = "
-SELECT *
-FROM ADOXYZ WHERE id = -1";
-// Select an empty record from the database
-
-
-$conn = &ADONewConnection("mssql"); // create a connection
-$conn->PConnect("", "sa", "natsoft", "northwind"); // connect to MySQL, testdb
-
-//$conn = &ADONewConnection("mysql"); // create a connection
-//$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb
-
-//$conn =& ADONewConnection('oci8');
-//$conn->Connect('','scott','natsoft');
-//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-
-$conn->debug=1;
-$conn->Execute("delete from adoxyz where lastname like 'Smi%'");
-
-$rs = $conn->Execute($sql); // Execute the query and get the empty recordset
-$record = array(); // Initialize an array to hold the record data to insert
-
-if (strpos($conn->databaseType,'mssql')!==false) $record['id'] = 751;
-$record["firstname"] = 'Jann';
-$record["lastname"] = "Smitts";
-$record["created"] = time();
-
-$insertSQL = $conn->GetInsertSQL($rs, $record);
-$conn->Execute($insertSQL); // Insert the record into the database
-
-if (strpos($conn->databaseType,'mssql')!==false) $record['id'] = 752;
-// Set the values for the fields in the record
-$record["firstname"] = 'null';
-$record["lastname"] = "Smith\$@//";
-$record["created"] = time();
-
-if (isset($_GET['f'])) $ADODB_FORCE_TYPE = $_GET['f'];
-
-//$record["id"] = -1;
-
-// Pass the empty recordset and the array containing the data to insert
-// into the GetInsertSQL function. The function will process the data and
return
-// a fully formatted insert sql statement.
-$insertSQL = $conn->GetInsertSQL($rs, $record);
-$conn->Execute($insertSQL); // Insert the record into the database
-
-
-
-$insertSQL2 = $conn->GetInsertSQL($table='ADOXYZ', $record);
-if ($insertSQL != $insertSQL2) echo "<p><b>Walt's new stuff failed</b>:
$insertSQL2</p>";
-//==========================
-// This code tests an update
-
-$sql = "
-SELECT *
-FROM ADOXYZ WHERE lastname=".$conn->Param('var'). " ORDER BY 1";
-// Select a record to update
-
-$varr = array('var'=>$record['lastname'].'');
-$rs = $conn->Execute($sql,$varr); // Execute the query and get the existing
record to update
-if (!$rs || $rs->EOF) print "<p><b>No record found!</b></p>";
-
-$record = array(); // Initialize an array to hold the record data to update
-
-
-// Set the values for the fields in the record
-$record["firstName"] = "Caroline".rand();
-//$record["lasTname"] = ""; // Update Caroline's lastname from Miranda to Smith
-$record["creAted"] = '2002-12-'.(rand()%30+1);
-$record['num'] = '';
-// Pass the single record recordset and the array containing the data to update
-// into the GetUpdateSQL function. The function will process the data and
return
-// a fully formatted update sql statement.
-// If the data has not changed, no recordset is returned
-
-$updateSQL = $conn->GetUpdateSQL($rs, $record);
-$conn->Execute($updateSQL,$varr); // Update the record in the database
-if ($conn->Affected_Rows() != 1)print "<p><b>Error1 </b>: Rows
Affected=".$conn->Affected_Rows().", should be 1</p>";
-
-$record["firstName"] = "Caroline".rand();
-$record["lasTname"] = "Smithy Jones"; // Update Caroline's lastname from
Miranda to Smith
-$record["creAted"] = '2002-12-'.(rand()%30+1);
-$record['num'] = 331;
-$updateSQL = $conn->GetUpdateSQL($rs, $record);
-$conn->Execute($updateSQL,$varr); // Update the record in the database
-if ($conn->Affected_Rows() != 1)print "<p><b>Error 2</b>: Rows
Affected=".$conn->Affected_Rows().", should be 1</p>";
-
-$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'");
-//adodb_pr($rs);
-rs2html($rs);
-}
-
-
-testsql();
+<?php
+
+/**
+ * @version V4.50 6 July 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ * Released under both BSD license and Lesser GPL library license.
+ * Whenever there is any discrepancy between the two licenses,
+ * the BSD license will take precedence.
+ *
+ * Set tabs to 4 for best viewing.
+ *
+ * Latest version is available at http://php.weblogs.com
+ *
+ * Test GetUpdateSQL and GetInsertSQL.
+ */
+
+error_reporting(E_ALL);
+function testsql()
+{
+
+
+include('../adodb.inc.php');
+include('../tohtml.inc.php');
+
+global $ADODB_FORCE_TYPE;
+
+
+//==========================
+// This code tests an insert
+
+$sql = "
+SELECT *
+FROM ADOXYZ WHERE id = -1";
+// Select an empty record from the database
+
+
+$conn = &ADONewConnection("mssql"); // create a connection
+$conn->PConnect("", "sa", "natsoft", "northwind"); // connect to MySQL, testdb
+
+//$conn = &ADONewConnection("mysql"); // create a connection
+//$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb
+
+//$conn =& ADONewConnection('oci8');
+//$conn->Connect('','scott','natsoft');
+//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+
+$conn->debug=1;
+$conn->Execute("delete from adoxyz where lastname like 'Smi%'");
+
+$rs = $conn->Execute($sql); // Execute the query and get the empty recordset
+$record = array(); // Initialize an array to hold the record data to insert
+
+if (strpos($conn->databaseType,'mssql')!==false) $record['id'] = 751;
+$record["firstname"] = 'Jann';
+$record["lastname"] = "Smitts";
+$record["created"] = time();
+
+$insertSQL = $conn->GetInsertSQL($rs, $record);
+$conn->Execute($insertSQL); // Insert the record into the database
+
+if (strpos($conn->databaseType,'mssql')!==false) $record['id'] = 752;
+// Set the values for the fields in the record
+$record["firstname"] = 'null';
+$record["lastname"] = "Smith\$@//";
+$record["created"] = time();
+
+if (isset($_GET['f'])) $ADODB_FORCE_TYPE = $_GET['f'];
+
+//$record["id"] = -1;
+
+// Pass the empty recordset and the array containing the data to insert
+// into the GetInsertSQL function. The function will process the data and
return
+// a fully formatted insert sql statement.
+$insertSQL = $conn->GetInsertSQL($rs, $record);
+$conn->Execute($insertSQL); // Insert the record into the database
+
+
+
+$insertSQL2 = $conn->GetInsertSQL($table='ADOXYZ', $record);
+if ($insertSQL != $insertSQL2) echo "<p><b>Walt's new stuff failed</b>:
$insertSQL2</p>";
+//==========================
+// This code tests an update
+
+$sql = "
+SELECT *
+FROM ADOXYZ WHERE lastname=".$conn->Param('var'). " ORDER BY 1";
+// Select a record to update
+
+$varr = array('var'=>$record['lastname'].'');
+$rs = $conn->Execute($sql,$varr); // Execute the query and get the existing
record to update
+if (!$rs || $rs->EOF) print "<p><b>No record found!</b></p>";
+
+$record = array(); // Initialize an array to hold the record data to update
+
+
+// Set the values for the fields in the record
+$record["firstName"] = "Caroline".rand();
+//$record["lasTname"] = ""; // Update Caroline's lastname from Miranda to Smith
+$record["creAted"] = '2002-12-'.(rand()%30+1);
+$record['num'] = '';
+// Pass the single record recordset and the array containing the data to update
+// into the GetUpdateSQL function. The function will process the data and
return
+// a fully formatted update sql statement.
+// If the data has not changed, no recordset is returned
+
+$updateSQL = $conn->GetUpdateSQL($rs, $record);
+$conn->Execute($updateSQL,$varr); // Update the record in the database
+if ($conn->Affected_Rows() != 1)print "<p><b>Error1 </b>: Rows
Affected=".$conn->Affected_Rows().", should be 1</p>";
+
+$record["firstName"] = "Caroline".rand();
+$record["lasTname"] = "Smithy Jones"; // Update Caroline's lastname from
Miranda to Smith
+$record["creAted"] = '2002-12-'.(rand()%30+1);
+$record['num'] = 331;
+$updateSQL = $conn->GetUpdateSQL($rs, $record);
+$conn->Execute($updateSQL,$varr); // Update the record in the database
+if ($conn->Affected_Rows() != 1)print "<p><b>Error 2</b>: Rows
Affected=".$conn->Affected_Rows().", should be 1</p>";
+
+$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'");
+//adodb_pr($rs);
+rs2html($rs);
+}
+
+
+testsql();
?>
\ No newline at end of file
Index: time.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/time.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- time.php 29 Nov 2004 23:03:54 -0000 1.3
+++ time.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,17 +1,17 @@
-<?php
-
-include_once('../adodb-time.inc.php');
-//adodb_date_test();
-?>
-<?php
-//require("adodb-time.inc.php");
-
-$datestring = "1963-12-04"; // string normally from mySQL
-$stringArray = explode("-", $datestring);
-$date = adodb_mktime(0,0,0,$stringArray[1],$stringArray[2],$stringArray[0]);
-
-$convertedDate = date("d-M-Y", $date); // converted string to UK style date
-
-echo( "Birthday: $convertedDate" ); //why is string returned as one day (3 not
4) less for this example??
-
+<?php
+
+include_once('../adodb-time.inc.php');
+//adodb_date_test();
+?>
+<?php
+//require("adodb-time.inc.php");
+
+$datestring = "1963-12-04"; // string normally from mySQL
+$stringArray = explode("-", $datestring);
+$date = adodb_mktime(0,0,0,$stringArray[1],$stringArray[2],$stringArray[0]);
+
+$convertedDate = date("d-M-Y", $date); // converted string to UK style date
+
+echo( "Birthday: $convertedDate" ); //why is string returned as one day (3 not
4) less for this example??
+
?>
\ No newline at end of file
Index: pdo.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/pdo.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pdo.php 29 Nov 2004 23:03:53 -0000 1.1
+++ pdo.php 27 Jan 2005 14:43:46 -0000 1.2
@@ -1,42 +1,42 @@
-<?php
-error_reporting(E_ALL);
-include('../adodb.inc.php');
-
-
-
-echo "New Connection\n";
-$DB = NewADOConnection('pdo');
-echo "Connect\n";
-$pdo_connection_string = 'odbc:nwind';
-$DB->Connect($pdo_connection_string,'','') || die("CONNECT FAILED");
-echo "Execute\n";
-
-
-
-//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
-$rs = $DB->Execute("select * from products where productid<3");
-echo "e=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n";
-
-
-//print_r(get_class_methods($DB->_stmt));
-
-if (!$rs) die("NO RS");
-echo "FETCH\n";
-$cnt = 0;
-while (!$rs->EOF) {
- print_r($rs->fields);
- $rs->MoveNext();
- if ($cnt++ > 1000) break;
-}
-
-echo "<br>--------------------------------------------------------<br>\n\n\n";
-
-$stmt = $DB->PrepareStmt("select * from products");
-$rs = $stmt->Execute();
-echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n";
-while ($arr = $rs->FetchRow()) {
- print_r($arr);
-}
-die("DONE\n");
-
+<?php
+error_reporting(E_ALL);
+include('../adodb.inc.php');
+
+
+
+echo "New Connection\n";
+$DB = NewADOConnection('pdo');
+echo "Connect\n";
+$pdo_connection_string = 'odbc:nwind';
+$DB->Connect($pdo_connection_string,'','') || die("CONNECT FAILED");
+echo "Execute\n";
+
+
+
+//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
+$rs = $DB->Execute("select * from products where productid<3");
+echo "e=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n";
+
+
+//print_r(get_class_methods($DB->_stmt));
+
+if (!$rs) die("NO RS");
+echo "FETCH\n";
+$cnt = 0;
+while (!$rs->EOF) {
+ print_r($rs->fields);
+ $rs->MoveNext();
+ if ($cnt++ > 1000) break;
+}
+
+echo "<br>--------------------------------------------------------<br>\n\n\n";
+
+$stmt = $DB->PrepareStmt("select * from products");
+$rs = $stmt->Execute();
+echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n";
+while ($arr = $rs->FetchRow()) {
+ print_r($arr);
+}
+die("DONE\n");
+
?>
\ No newline at end of file
Index: testdatabases.inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/tests/testdatabases.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- testdatabases.inc.php 29 Nov 2004 23:03:54 -0000 1.3
+++ testdatabases.inc.php 27 Jan 2005 14:43:47 -0000 1.4
@@ -1,342 +1,342 @@
-<?php
-
-/*
-V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
-*/
-
- /* this file is used by the ADODB test program: test.php */
- ?>
-
-<table><tr valign=top><td>
-<form method=get>
-<input type=checkbox name="testaccess" value=1 <?php echo !empty($testaccess)
? 'checked' : '' ?>> <b>Access</b><br>
-<input type=checkbox name="testibase" value=1 <?php echo !empty($testibase) ?
'checked' : '' ?>> <b>Interbase</b><br>
-<input type=checkbox name="testmssql" value=1 <?php echo !empty($testmssql) ?
'checked' : '' ?>> <b>MSSQL</b><br>
- <input type=checkbox name="testmysql" value=1 <?php echo !empty($testmysql) ?
'checked' : '' ?>> <b>MySQL</b><br>
-<input type=checkbox name="testmysqlodbc" value=1 <?php echo
!empty($testmysqlodbc) ? 'checked' : '' ?>> <b>MySQL ODBC</b><br>
-<input type=checkbox name="testmysqli" value=1 <?php echo !empty($testmysqli)
? 'checked' : '' ?>> <b>MySQLi</b>
-<br>
-<td><input type=checkbox name="testsqlite" value=1 <?php echo
!empty($testsqlite) ? 'checked' : '' ?>> <b>SQLite</b><br>
-<input type=checkbox name="testproxy" value=1 <?php echo !empty($testproxy) ?
'checked' : '' ?>> <b>MySQL Proxy</b><br>
-<input type=checkbox name="testoracle" value=1 <?php echo !empty($testoracle)
? 'checked' : '' ?>> <b>Oracle (oci8)</b> <br>
-<input type=checkbox name="testpostgres" value=1 <?php echo
!empty($testpostgres) ? 'checked' : '' ?>> <b>PostgreSQL</b><br>
-<input type=checkbox name="testpgodbc" value=1 <?php echo !empty($testpgodbc)
? 'checked' : '' ?>> <b>PostgreSQL ODBC</b><br>
-<td><input type=checkbox name="testdb2" value=1 <?php echo !empty($testdb2) ?
'checked' : '' ?>> DB2<br>
-<input type=checkbox name="testvfp" value=1 <?php echo !empty($testvfp) ?
'checked' : '' ?>> VFP+ODBTP<br>
-<input type=checkbox name="testado" value=1 <?php echo !empty($testado) ?
'checked' : '' ?>> ADO (for mssql and access)<br>
-<input type=checkbox name="nocountrecs" value=1 <?php echo
!empty($nocountrecs) ? 'checked' : '' ?>> $ADODB_COUNTRECS=false<br>
-<input type=checkbox name="nolog" value=1 <?php echo !empty($nolog) ?
'checked' : '' ?>> No SQL Logging<br>
-<input type=checkbox name="time" value=1 <?php echo !empty($_GET['time']) ?
'checked' : '' ?>> ADOdb time test
-</table>
-<input type=submit>
-</form>
-
-<?php
-
-if ($ADODB_FETCH_MODE != ADODB_FETCH_DEFAULT) print "<h3>FETCH MODE IS NOT
ADODB_FETCH_DEFAULT</h3>";
-
-if (isset($nocountrecs)) $ADODB_COUNTRECS = false;
-
-// cannot test databases below, but we include them anyway to check
-// if they parse ok...
-
-if (!strpos(PHP_VERSION,'5') === 0) {
- ADOLoadCode("sybase");
- ADOLoadCode("postgres");
- ADOLoadCode("postgres7");
- ADOLoadCode("firebird");
- ADOLoadCode("borland_ibase");
- ADOLoadCode("informix");
- ADOLoadCode("sqlanywhere");
-// ADOLoadCode('mysqli');
-}
-
-
-flush();
-if (!empty($testpostgres)) {
- //ADOLoadCode("postgres");
-
- $db = &ADONewConnection('postgres');
- print "<h1>Connecting $db->databaseType...</h1>";
- if ($db->Connect("localhost","tester","test","test")) {
- testdb($db,"create table ADOXYZ (id integer, firstname
char(24), lastname varchar,created date)");
- }else
- print "ERROR: PostgreSQL requires a database called test on
server, user tester, password test.<BR>".$db->ErrorMsg();
-}
-
-if (!empty($testpgodbc)) {
-
- $db = &ADONewConnection('odbc');
- $db->hasTransactions = false;
- print "<h1>Connecting $db->databaseType...</h1>";
-
- if ($db->PConnect('Postgresql')) {
- $db->hasTransactions = true;
- testdb($db,
- "create table ADOXYZ (id int, firstname char(24), lastname
char(24), created date) type=innodb");
- } else print "ERROR: PostgreSQL requires a database called test on
server, user tester, password test.<BR>".$db->ErrorMsg();
-}
-
-if (!empty($testibase)) {
- //$_GET['nolog'] = true;
- $db = &ADONewConnection('firebird');
- print "<h1>Connecting $db->databaseType...</h1>";
- if
($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba",
"masterkey", ""))
- testdb($db,"create table ADOXYZ (id integer, firstname
char(24), lastname char(24),price numeric(12,2),created date)");
- else print "ERROR: Interbase test requires a database called
employee.gdb".'<BR>'.$db->ErrorMsg();
-
-}
-
-
-if (!empty($testsqlite)) {
- $db = &ADONewConnection('sqlite');
- print "<h1>Connecting $db->databaseType...</h1>";
-
- if ($db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", ""))
- testdb($db,"create table ADOXYZ (id int, firstname char(24),
lastname char(24),created datetime)");
- else print "ERROR: SQLite";
-
-}
-
-// REQUIRES ODBC DSN CALLED nwind
-if (!empty($testaccess)) {
- $db = &ADONewConnection('access');
- print "<h1>Connecting $db->databaseType...</h1>";
- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
- $dsn = "nwind";
- $dsn = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=$access;Uid=Admin;Pwd=;";
-
- //$dsn = 'Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . $access .
';';
- if ($db->PConnect($dsn, "", "", ""))
- testdb($db,"create table ADOXYZ (id int, firstname char(24),
lastname char(24),created datetime)");
- else print "ERROR: Access test requires a Windows ODBC DSN=nwind,
Access driver";
-
-}
-
-if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS
-
- $db = &ADONewConnection("ado_access");
- print "<h1>Connecting $db->databaseType...</h1>";
-
- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
- $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
- . 'DATA SOURCE=' . $access . ';';
- //. 'USER ID=;PASSWORD=;';
- $_GET['nolog'] = 1;
- if ($db->PConnect($myDSN, "", "", "")) {
- print "ADO version=".$db->_connectionID->version."<br>";
- testdb($db,"create table ADOXYZ (id int, firstname char(24),
lastname char(24),created datetime)");
- } else print "ERROR: Access test requires a Access database
$access".'<BR>'.$db->ErrorMsg();
-
-}
-
-if (!empty($testvfp)) { // ODBC
- $db = &ADONewConnection('vfp');
- print "<h1>Connecting $db->databaseType...</h1>";flush();
-
- if ( $db->PConnect("vfp-adoxyz")) {
- testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int,
firstname char(24), lastname char(24),created date)");
- } else print "ERROR: Visual FoxPro test requires a Windows ODBC
DSN=vfp-adoxyz, VFP driver";
-
- echo "<hr>";
- $db = &ADONewConnection('odbtp');
-
- if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro
Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) {
- print "<h1>Connecting $db->databaseType...</h1>";flush();
- testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname
char(24), lastname char(24),created date)");
- } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC
DSN=vfp-adoxyz, VFP driver";
-
-}
-
-
-// REQUIRES MySQL server at localhost with database 'test'
-if (!empty($testmysql)) { // MYSQL
-
-
- if (PHP_VERSION >= 5 || $HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost')
$server = 'localhost';
- else $server = "mangrove";
- $user = 'root'; $password = ''; $database = 'northwind';
- $db =
&ADONewConnection("mysql://$user:$password@$server/$database?persist");
- print "<h1>Connecting $db->databaseType...</h1>";
-
- if (true || $db->PConnect($server, "root", "", "northwind")) {
- //$db->debug=1;$db->Execute('drop table ADOXYZ');
- testdb($db,
- "create table ADOXYZ (id int, firstname char(24), lastname
char(24), created date)");
- } else print "ERROR: MySQL test requires a MySQL server on localhost,
userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
-}
-
-// REQUIRES MySQL server at localhost with database 'test'
-if (!empty($testmysqli)) { // MYSQL
-
- $db = &ADONewConnection('mysqli');
- print "<h1>Connecting $db->databaseType...</h1>";
- if (PHP_VERSION >= 5 || $HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost')
$server = 'localhost';
- else $server = "mangrove";
- if ($db->PConnect($server, "root", "", "northwind")) {
- //$db->debug=1;$db->Execute('drop table ADOXYZ');
- testdb($db,
- "create table ADOXYZ (id int, firstname char(24), lastname
char(24), created date)");
- } else print "ERROR: MySQL test requires a MySQL server on localhost,
userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
-}
-
-
-// REQUIRES MySQL server at localhost with database 'test'
-if (!empty($testmysqlodbc)) { // MYSQL
-
- $db = &ADONewConnection('odbc');
- $db->hasTransactions = false;
- print "<h1>Connecting $db->databaseType...</h1>";
- if ($HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost') $server =
'localhost';
- else $server = "mangrove";
- if ($db->PConnect('mysql', "root", ""))
- testdb($db,
- "create table ADOXYZ (id int, firstname char(24), lastname
char(24), created date) type=innodb");
- else print "ERROR: MySQL test requires a MySQL server on localhost,
userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
-}
-
-if (!empty($testproxy)){
- $db = &ADONewConnection('proxy');
- print "<h1>Connecting $db->databaseType...</h1>";
- if ($HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost') $server =
'localhost';
-
- if ($db->PConnect('http://localhost/php/phplens/adodb/server.php'))
- testdb($db,
- "create table ADOXYZ (id int, firstname char(24), lastname
char(24), created date) type=innodb");
- else print "ERROR: MySQL test requires a MySQL server on localhost,
userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
-
-}
-
-ADOLoadCode('oci805');
-ADOLoadCode("oci8po");
-if (!empty($testoracle)) {
- $dsn = "oci8po://scott:natsoft@sherkhan?persist";
- $db = ADONewConnection($dsn);
- print "<h1>Connecting $db->databaseType...</h1>";
- if (true || $db->Connect('', "scott", "natsoft",''))
- testdb($db,"create table ADOXYZ (id int, firstname varchar(24),
lastname varchar(24),created date)");
- else print "ERROR: Oracle test requires an Oracle server setup with
scott/natsoft".'<BR>'.$db->ErrorMsg();
-
-}
-ADOLoadCode("oracle"); // no longer supported
-if (false && !empty($testoracle)) {
-
- $db = ADONewConnection();
- print "<h1>Connecting $db->databaseType...</h1>";
- if ($db->PConnect("", "scott", "tiger", "natsoft.domain"))
- testdb($db,"create table ADOXYZ (id int, firstname varchar(24),
lastname varchar(24),created date)");
- else print "ERROR: Oracle test requires an Oracle server setup with
scott/tiger".'<BR>'.$db->ErrorMsg();
-
-}
-
-ADOLoadCode("db2"); // no longer supported
-if (!empty($testdb2)) {
- $db = ADONewConnection();
- print "<h1>Connecting $db->databaseType...</h1>";
-
- $dsn = "db2_sample";
- $dsn = "driver={IBM db2 odbc
DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root;
pwd=natsoft";
- if ($db->Connect($dsn)) {
- // testdb($db,"create table ADOXYZ (id int, firstname varchar(24),
lastname varchar(24),created date)");
- } else print "ERROR: DB2 test requires an server setup with odbc data
source db2_sample".'<BR>'.$db->ErrorMsg();
-
-echo "<hr>";
-flush();
- $dsn = "driver={IBM db2 odbc
DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root;
pwd=natsoft";
-
- $db = ADONewConnection('odbtp');
- if ($db->Connect('127.0.0.1',$dsn)) {
-
- $db->debug=1;
- $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr);
- $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR"
);adodb_pr($arr);
-
- testdb($db,"create table ADOXYZ (id int, firstname varchar(24),
lastname varchar(24),created date)");
- } else echo ("ERROR Connection");
- echo $db->ErrorMsg();
-}
-
-
-$server = 'sherkhan';
-if (extension_loaded('odbtp') && !empty($testmssql)) { // MS SQL Server via
ODBC
- $db = ADONewConnection('odbtp');
-
- $dsn = "PROVIDER=MSDASQL;Driver={SQL
Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft";
-
- if ($db->PConnect('localhost',$dsn, "", "")) {
- print "<h1>Connecting $db->databaseType...</h1>";
- testdb($db,"create table ADOXYZ (id int, firstname char(24)
null, lastname char(24) null,created datetime null)");
- }
- else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with
DSN setup";
-
-}
-
-
-ADOLoadCode('odbc_mssql');
-if (!empty($testmssql)) { // MS SQL Server via ODBC
- $db = ADONewConnection();
-
- print "<h1>Connecting $db->databaseType...</h1>";
-
- $dsn = "PROVIDER=MSDASQL;Driver={SQL
Server};Server=$server;Database=northwind;";
-
- if ($db->PConnect($dsn, "adodb", "natsoft", "")) {
- testdb($db,"create table ADOXYZ (id int, firstname char(24)
null, lastname char(24) null,created datetime null)");
- }
- else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with
DSN setup";
-
-}
-
-ADOLoadCode("ado_mssql");
-if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru
ODBC -- DSN-less
-
- $db = &ADONewConnection("ado_mssql");
- //$db->debug=1;
- print "<h1>Connecting DSN-less $db->databaseType...</h1>";
-
- $myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};"
- .
"SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No"
;
-
-
- if ($db->PConnect($myDSN, "", "", ""))
- testdb($db,"create table ADOXYZ (id int, firstname char(24)
null, lastname char(24) null,created datetime null)");
- else print "ERROR: MSSQL test 2 requires MS SQL 7";
-
-}
-
-
-ADOLoadCode("mssqlpo");
-if (!empty($testmssql)) { // MS SQL Server -- the extension is buggy --
probably better to use ODBC
- $db = ADONewConnection("mssqlpo");
- //$db->debug=1;
- print "<h1>Connecting $db->databaseType...</h1>";
-
- $ok = $db->Connect('','adodb','natsoft','northwind');
-
- if ($ok or $db->PConnect("mangrove", "sa", "natsoft", "ai")) {
- AutoDetect_MSSQL_Date_Order($db);
- // $db->Execute('drop table adoxyz');
- testdb($db,"create table ADOXYZ (id int, firstname char(24)
null, lastname char(24) null,created datetime null)");
- } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a
server='192.168.0.1', userid='adodb', password='natsoft',
database='ai'".'<BR>'.$db->ErrorMsg();
-
-}
-
-if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB
provider
-
- $db = &ADONewConnection("ado_mssql");
- print "<h1>Connecting DSN-less OLEDB Provider
$db->databaseType...</h1>";
- //$db->debug=1;
- $myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes";
- if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) {
- testdb($db,"create table ADOXYZ (id int, firstname char(24),
lastname char(24),created datetime)");
- } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a
server='mangrove', userid='sa', password='', database='ai'";
-
-}
-
-
-print "<h3>Tests Completed</h3>";
-
-?>
+<?php
+
+/*
+V4.54 5 Nov 2004 (c) 2000-2004 John Lim
(jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved.
+ Released under both BSD license and Lesser GPL library license.
+ Whenever there is any discrepancy between the two licenses,
+ the BSD license will take precedence.
+*/
+
+ /* this file is used by the ADODB test program: test.php */
+ ?>
+
+<table><tr valign=top><td>
+<form method=get>
+<input type=checkbox name="testaccess" value=1 <?php echo !empty($testaccess)
? 'checked' : '' ?>> <b>Access</b><br>
+<input type=checkbox name="testibase" value=1 <?php echo !empty($testibase) ?
'checked' : '' ?>> <b>Interbase</b><br>
+<input type=checkbox name="testmssql" value=1 <?php echo !empty($testmssql) ?
'checked' : '' ?>> <b>MSSQL</b><br>
+ <input type=checkbox name="testmysql" value=1 <?php echo !empty($testmysql) ?
'checked' : '' ?>> <b>MySQL</b><br>
+<input type=checkbox name="testmysqlodbc" value=1 <?php echo
!empty($testmysqlodbc) ? 'checked' : '' ?>> <b>MySQL ODBC</b><br>
+<input type=checkbox name="testmysqli" value=1 <?php echo !empty($testmysqli)
? 'checked' : '' ?>> <b>MySQLi</b>
+<br&g |