From 9fa730a60bde0d4fab130e0ff061566a01de137e Mon Sep 17 00:00:00 2001
From: martin ";
+ return;
+ }
+ $arr = $rs->GetArray();
+ //$db->debug = true;
+
+ $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 (" seconds = %8.2f for %d iterations each with %d records
";print_r($s);print ""; + } + + +$serverURL = 'http://localhost/php/phplens/adodb/server.php'; +$testhttp = false; + +$sql1 = "insertz into products (productname) values ('testprod 1')"; +$sql2 = "insert into products (productname) values ('testprod 1')"; +$sql3 = "insert into products (productname) values ('testprod 2')"; +$sql4 = "delete from products where productid>80"; +$sql5 = 'select * from products'; + +if ($testhttp) { + print "Client Driver Tests
"; + print "
ADODB Database Library (c) 2000-2002 John Lim. All rights reserved. Released under BSD and LGPL.
+ + diff --git a/lib/adodb/tests/test2.php b/lib/adodb/tests/test2.php new file mode 100644 index 00000000000..f620af3ab8d --- /dev/null +++ b/lib/adodb/tests/test2.php @@ -0,0 +1,54 @@ + + + + +
+PConnect("susetikus","tester","test","test"))
+ die("Cannot connect to database");
+
+# select * from last table in DB
+$rs = $c1->Execute("select * from adoxyz order by 1");
+
+$i = 0;
+$max = $rs->RecordCount();
+if ($max == -1) "RecordCount returns -1
";
+while (!$rs->EOF and $i < $max) {
+ $rs->Move($i);
+ print_r( $rs->fields);
+ print '
';
+ $i++;
+}
+?>
+
\ No newline at end of file
diff --git a/lib/adodb/tests/test4.php b/lib/adodb/tests/test4.php
new file mode 100644
index 00000000000..d20676bf693
--- /dev/null
+++ b/lib/adodb/tests/test4.php
@@ -0,0 +1,78 @@
+debug=1;
+$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb
+$conn->Execute("delete from adoxyz where lastname like 'Smith%'");
+
+$rs = $conn->Execute($sql); // Execute the query and get the empty recordset
+$record = array(); // Initialize an array to hold the record data to insert
+
+// Set the values for the fields in the record
+$record["firstname"] = "Bob";
+$record["lastname"] = "Smith\$@//";
+$record["created"] = time();
+
+// 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
+
+//==========================
+// This code tests an update
+
+$sql = "SELECT * FROM ADOXYZ WHERE lastname=".$conn->qstr($record['lastname']);
+// Select a record to update
+
+$rs = $conn->Execute($sql); // Execute the query and get the existing record to update
+if (!$rs) print "No record found!
"; +$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"] = "Smithy"; // Update Caroline's lastname from Miranda to Smith +$record["created"] = '2002-12-'.(rand()%30+1); + +// 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); // Update the record in the database +print "Rows Affected=".$conn->Affected_Rows()."
"; + +rs2html($conn->Execute("select * from adoxyz where lastname like 'Smith%'")); +} + + +testsql(); +?> \ No newline at end of file diff --git a/lib/adodb/tests/test5.php b/lib/adodb/tests/test5.php new file mode 100644 index 00000000000..a392bb7730c --- /dev/null +++ b/lib/adodb/tests/test5.php @@ -0,0 +1,45 @@ +debug=1; + $conn->PConnect("localhost","root","","xphplens"); + print $conn->databaseType.':'.$conn->GenID().'