stop reporting of a custom error (it is benign) to the php logfile
[openemr.git] / library / adodb / tests / client.php
blobc7cca950351e6df2fa5fe08c11d09b0fef37e2c9
1 <html>
2 <body bgcolor=white>
3 <?php
4 /**
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.
9 *
10 * set tabs to 8
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);
21 print "<p>$url</p>";
22 $rs = csv2rs($url,$err);
23 if ($err) print $err;
24 return $rs;
27 function print_pre($s)
29 print "<pre>";print_r($s);print "</pre>";
33 $serverURL = 'http://localhost/php/phplens/adodb/server.php';
34 $testhttp = false;
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';
42 if ($testhttp) {
43 print "<a href=#c>Client Driver Tests</a><p>";
44 print "<h3>Test Error</h3>";
45 $rs = send2server($serverURL,$sql1);
46 print_pre($rs);
47 print "<hr>";
49 print "<h3>Test Insert</h3>";
51 $rs = send2server($serverURL,$sql2);
52 print_pre($rs);
53 print "<hr>";
55 print "<h3>Test Insert2</h3>";
57 $rs = send2server($serverURL,$sql3);
58 print_pre($rs);
59 print "<hr>";
61 print "<h3>Test Delete</h3>";
63 $rs = send2server($serverURL,$sql4);
64 print_pre($rs);
65 print "<hr>";
68 print "<h3>Test Select</h3>";
69 $rs = send2server($serverURL,$sql5);
70 if ($rs) rs2html($rs);
72 print "<hr>";
76 print "<a name=c><h1>CLIENT Driver Tests</h1>";
77 $conn = ADONewConnection('csv');
78 $conn->Connect($serverURL);
79 $conn->debug = true;
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:
105 Test Insert
106 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
108 adorecordset Object
110 [dataProvider] => native
111 [fields] =>
112 [blobSize] => 64
113 [canSeek] =>
114 [EOF] => 1
115 [emptyTimeStamp] =>
116 [emptyDate] =>
117 [debug] =>
118 [timeToLive] => 0
119 [bind] =>
120 [_numOfRows] => -1
121 [_numOfFields] => 0
122 [_queryID] => 1
123 [_currentRow] => -1
124 [_closed] =>
125 [_inited] =>
126 [sql] => insert into products (productname) values ('testprod')
127 [affectedrows] => 1
128 [insertid] => 81
132 --------------------------------------------------------------------------------
134 Test Insert2
135 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
137 adorecordset Object
139 [dataProvider] => native
140 [fields] =>
141 [blobSize] => 64
142 [canSeek] =>
143 [EOF] => 1
144 [emptyTimeStamp] =>
145 [emptyDate] =>
146 [debug] =>
147 [timeToLive] => 0
148 [bind] =>
149 [_numOfRows] => -1
150 [_numOfFields] => 0
151 [_queryID] => 1
152 [_currentRow] => -1
153 [_closed] =>
154 [_inited] =>
155 [sql] => insert into products (productname) values ('testprod')
156 [affectedrows] => 1
157 [insertid] => 82
161 --------------------------------------------------------------------------------
163 Test Delete
164 http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
166 adorecordset Object
168 [dataProvider] => native
169 [fields] =>
170 [blobSize] => 64
171 [canSeek] =>
172 [EOF] => 1
173 [emptyTimeStamp] =>
174 [emptyDate] =>
175 [debug] =>
176 [timeToLive] => 0
177 [bind] =>
178 [_numOfRows] => -1
179 [_numOfFields] => 0
180 [_queryID] => 1
181 [_currentRow] => -1
182 [_closed] =>
183 [_inited] =>
184 [sql] => delete from products where productid>80
185 [affectedrows] => 2
186 [insertid] => 0
189 [more stuff deleted]