5 * V4.20 22 Feb 2004 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.
6 * Released under both BSD license and Lesser GPL library license.
7 Whenever there is any discrepancy between the two licenses,
8 the BSD license will take precedence.
13 // documentation on usage is at http://php.weblogs.com/adodb_csv
15 include('../adodb.inc.php');
16 include('../tohtml.inc.php');
18 function &send2server($url,$sql)
20 $url .= '?sql='.urlencode($sql);
22 $rs = csv2rs($url,$err);
27 function print_pre($s)
29 print "<pre>";print_r($s);print "</pre>";
33 $serverURL = 'http://localhost/php/phplens/adodb/server.php';
36 $sql1 = "insertz into products (productname) values ('testprod 1')";
37 $sql2 = "insert into products (productname) values ('testprod 1')";
38 $sql3 = "insert into products (productname) values ('testprod 2')";
39 $sql4 = "delete from products where productid>80";
40 $sql5 = 'select * from products';
43 print "<a href=#c>Client Driver Tests</a><p>";
44 print "<h3>Test Error</h3>";
45 $rs = send2server($serverURL,$sql1);
49 print "<h3>Test Insert</h3>";
51 $rs = send2server($serverURL,$sql2);
55 print "<h3>Test Insert2</h3>";
57 $rs = send2server($serverURL,$sql3);
61 print "<h3>Test Delete</h3>";
63 $rs = send2server($serverURL,$sql4);
68 print "<h3>Test Select</h3>";
69 $rs = send2server($serverURL,$sql5);
70 if ($rs) rs2html($rs);
76 print "<a name=c><h1>CLIENT Driver Tests</h1>";
77 $conn = ADONewConnection('csv');
78 $conn->Connect($serverURL);
81 print "<h3>Bad SQL</h3>";
83 $rs = $conn->Execute($sql1);
85 print "<h3>Insert SQL 1</h3>";
86 $rs = $conn->Execute($sql2);
88 print "<h3>Insert SQL 2</h3>";
89 $rs = $conn->Execute($sql3);
91 print "<h3>Select SQL</h3>";
92 $rs = $conn->Execute($sql5);
93 if ($rs) rs2html($rs);
95 print "<h3>Delete SQL</h3>";
96 $rs = $conn->Execute($sql4);
98 print "<h3>Select SQL</h3>";
99 $rs = $conn->Execute($sql5);
100 if ($rs) rs2html($rs);
103 /* EXPECTED RESULTS FOR HTTP TEST:
106 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
110 [dataProvider] => native
126 [sql] => insert into products (productname) values ('testprod')
132 --------------------------------------------------------------------------------
135 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
139 [dataProvider] => native
155 [sql] => insert into products (productname) values ('testprod')
161 --------------------------------------------------------------------------------
164 http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
168 [dataProvider] => native
184 [sql] => delete from products where productid>80