source: tmp/version-2_5-test/data/module/adodb/tests/client.php @ 18609

Revision 18609, 4.0 KB checked in by kajiwara, 14 years ago (diff)

正式版にナイトリービルド版をマージしてみるテスト

Line 
1<html>
2<body bgcolor=white>
3<?php
4/**
5 * V4.50 6 July 2004  (c) 2001-2002 John Lim (jlim#natsoft.com). 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
11 */
12 
13 // documentation on usage is at http://php.weblogs.com/adodb_csv
14 
15 echo PHP_VERSION,'<br>';
16 var_dump(parse_url('odbc_mssql://userserver/'));
17 die();
18 
19include('../adodb.inc.php');
20include('../tohtml.inc.php');
21
22 function &send2server($url,$sql)
23 {
24    $url .= '?sql='.urlencode($sql);
25    print "<p>$url</p>";
26    $rs = csv2rs($url,$err);
27    if ($err) print $err;
28    return $rs;
29 }
30 
31 function print_pre($s)
32 {
33    print "<pre>";print_r($s);print "</pre>";
34 }
35
36
37$serverURL = 'http://localhost/php/phplens/adodb/server.php';
38$testhttp = false;
39
40$sql1 = "insertz into products (productname) values ('testprod 1')";
41$sql2 = "insert into products (productname) values ('testprod 1')";
42$sql3 = "insert into products (productname) values ('testprod 2')";
43$sql4 = "delete from products where productid>80";
44$sql5 = 'select * from products';
45   
46if ($testhttp) {
47    print "<a href=#c>Client Driver Tests</a><p>";
48    print "<h3>Test Error</h3>";
49    $rs = send2server($serverURL,$sql1);
50    print_pre($rs);
51    print "<hr />";
52   
53    print "<h3>Test Insert</h3>";
54   
55    $rs = send2server($serverURL,$sql2);
56    print_pre($rs);
57    print "<hr />";
58   
59    print "<h3>Test Insert2</h3>";
60   
61    $rs = send2server($serverURL,$sql3);
62    print_pre($rs);
63    print "<hr />";
64   
65    print "<h3>Test Delete</h3>";
66   
67    $rs = send2server($serverURL,$sql4);
68    print_pre($rs);
69    print "<hr />";
70   
71   
72    print "<h3>Test Select</h3>";
73    $rs = send2server($serverURL,$sql5);
74    if ($rs) rs2html($rs);
75   
76    print "<hr />";
77}
78
79
80print "<a name=c><h1>CLIENT Driver Tests</h1>";
81$conn = ADONewConnection('csv');
82$conn->Connect($serverURL);
83$conn->debug = true;
84
85print "<h3>Bad SQL</h3>";
86
87$rs = $conn->Execute($sql1);
88
89print "<h3>Insert SQL 1</h3>";
90$rs = $conn->Execute($sql2);
91
92print "<h3>Insert SQL 2</h3>";
93$rs = $conn->Execute($sql3);
94
95print "<h3>Select SQL</h3>";
96$rs = $conn->Execute($sql5);
97if ($rs) rs2html($rs);
98
99print "<h3>Delete SQL</h3>";
100$rs = $conn->Execute($sql4);
101
102print "<h3>Select SQL</h3>";
103$rs = $conn->Execute($sql5);
104if ($rs) rs2html($rs);
105
106
107/* EXPECTED RESULTS FOR HTTP TEST:
108
109Test Insert
110http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
111
112adorecordset Object
113(
114    [dataProvider] => native
115    [fields] =>
116    [blobSize] => 64
117    [canSeek] =>
118    [EOF] => 1
119    [emptyTimeStamp] => 
120    [emptyDate] => 
121    [debug] =>
122    [timeToLive] => 0
123    [bind] =>
124    [_numOfRows] => -1
125    [_numOfFields] => 0
126    [_queryID] => 1
127    [_currentRow] => -1
128    [_closed] =>
129    [_inited] =>
130    [sql] => insert into products (productname) values ('testprod')
131    [affectedrows] => 1
132    [insertid] => 81
133)
134
135
136--------------------------------------------------------------------------------
137
138Test Insert2
139http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
140
141adorecordset Object
142(
143    [dataProvider] => native
144    [fields] =>
145    [blobSize] => 64
146    [canSeek] =>
147    [EOF] => 1
148    [emptyTimeStamp] => 
149    [emptyDate] => 
150    [debug] =>
151    [timeToLive] => 0
152    [bind] =>
153    [_numOfRows] => -1
154    [_numOfFields] => 0
155    [_queryID] => 1
156    [_currentRow] => -1
157    [_closed] =>
158    [_inited] =>
159    [sql] => insert into products (productname) values ('testprod')
160    [affectedrows] => 1
161    [insertid] => 82
162)
163
164
165--------------------------------------------------------------------------------
166
167Test Delete
168http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
169
170adorecordset Object
171(
172    [dataProvider] => native
173    [fields] =>
174    [blobSize] => 64
175    [canSeek] =>
176    [EOF] => 1
177    [emptyTimeStamp] => 
178    [emptyDate] => 
179    [debug] =>
180    [timeToLive] => 0
181    [bind] =>
182    [_numOfRows] => -1
183    [_numOfFields] => 0
184    [_queryID] => 1
185    [_currentRow] => -1
186    [_closed] =>
187    [_inited] =>
188    [sql] => delete from products where productid>80
189    [affectedrows] => 2
190    [insertid] => 0
191)
192
193[more stuff deleted]
194 .
195 .
196 .
197*/
198?>
Note: See TracBrowser for help on using the repository browser.