ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/WEBCONDDB/php_CondDB/adodb/tests/client.php
Revision: 1.1
Committed: Fri Jun 29 07:49:40 2007 UTC (17 years, 10 months ago) by kdziedzi
Branch: MAIN
CVS Tags: V01-01-02, V01-01-01, V1_01_00, V01-01-00, V1_00_01, HEAD
Log Message:
Introducing new order in project

File Contents

# User Rev Content
1 kdziedzi 1.1 <html>
2     <body bgcolor=white>
3     <?php
4     /**
5     * V4.50 6 July 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
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    
19     include('../adodb.inc.php');
20     include('../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    
46     if ($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    
80     print "<a name=c><h1>CLIENT Driver Tests</h1>";
81     $conn = ADONewConnection('csv');
82     $conn->Connect($serverURL);
83     $conn->debug = true;
84    
85     print "<h3>Bad SQL</h3>";
86    
87     $rs = $conn->Execute($sql1);
88    
89     print "<h3>Insert SQL 1</h3>";
90     $rs = $conn->Execute($sql2);
91    
92     print "<h3>Insert SQL 2</h3>";
93     $rs = $conn->Execute($sql3);
94    
95     print "<h3>Select SQL</h3>";
96     $rs = $conn->Execute($sql5);
97     if ($rs) rs2html($rs);
98    
99     print "<h3>Delete SQL</h3>";
100     $rs = $conn->Execute($sql4);
101    
102     print "<h3>Select SQL</h3>";
103     $rs = $conn->Execute($sql5);
104     if ($rs) rs2html($rs);
105    
106    
107     /* EXPECTED RESULTS FOR HTTP TEST:
108    
109     Test Insert
110     http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
111    
112     adorecordset 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    
138     Test Insert2
139     http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
140    
141     adorecordset 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    
167     Test Delete
168     http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
169    
170     adorecordset 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     ?>