Documentation TYPO3 par Ameos

client.php

00001 <html>
00002 <body bgcolor=white>
00003 <?php
00013  // documentation on usage is at http://php.weblogs.com/adodb_csv
00014  
00015  echo PHP_VERSION,'<br>';
00016  var_dump(parse_url('odbc_mssql://userserver/'));
00017  die();
00018  
00019 include('../adodb.inc.php');
00020 include('../tohtml.inc.php');
00021 
00022  function &send2server($url,$sql)
00023  {
00024         $url .= '?sql='.urlencode($sql);
00025         print "<p>$url</p>";
00026         $rs = csv2rs($url,$err);
00027         if ($err) print $err;
00028         return $rs;
00029  }
00030  
00031  function print_pre($s)
00032  {
00033         print "<pre>";print_r($s);print "</pre>";
00034  }
00035 
00036 
00037 $serverURL = 'http://localhost/php/phplens/adodb/server.php';
00038 $testhttp = false;
00039 
00040 $sql1 = "insertz into products (productname) values ('testprod 1')";
00041 $sql2 = "insert into products (productname) values ('testprod 1')";
00042 $sql3 = "insert into products (productname) values ('testprod 2')";
00043 $sql4 = "delete from products where productid>80";
00044 $sql5 = 'select * from products';
00045         
00046 if ($testhttp) {
00047         print "<a href=#c>Client Driver Tests</a><p>";
00048         print "<h3>Test Error</h3>";
00049         $rs = send2server($serverURL,$sql1);
00050         print_pre($rs);
00051         print "<hr />";
00052         
00053         print "<h3>Test Insert</h3>";
00054         
00055         $rs = send2server($serverURL,$sql2);
00056         print_pre($rs);
00057         print "<hr />";
00058         
00059         print "<h3>Test Insert2</h3>";
00060         
00061         $rs = send2server($serverURL,$sql3);
00062         print_pre($rs);
00063         print "<hr />";
00064         
00065         print "<h3>Test Delete</h3>";
00066         
00067         $rs = send2server($serverURL,$sql4);
00068         print_pre($rs);
00069         print "<hr />";
00070         
00071         
00072         print "<h3>Test Select</h3>";
00073         $rs = send2server($serverURL,$sql5);
00074         if ($rs) rs2html($rs);
00075         
00076         print "<hr />";
00077 }
00078 
00079 
00080 print "<a name=c><h1>CLIENT Driver Tests</h1>";
00081 $conn = ADONewConnection('csv');
00082 $conn->Connect($serverURL);
00083 $conn->debug = true;
00084 
00085 print "<h3>Bad SQL</h3>";
00086 
00087 $rs = $conn->Execute($sql1);
00088 
00089 print "<h3>Insert SQL 1</h3>";
00090 $rs = $conn->Execute($sql2);
00091 
00092 print "<h3>Insert SQL 2</h3>";
00093 $rs = $conn->Execute($sql3);
00094 
00095 print "<h3>Select SQL</h3>";
00096 $rs = $conn->Execute($sql5);
00097 if ($rs) rs2html($rs);
00098 
00099 print "<h3>Delete SQL</h3>";
00100 $rs = $conn->Execute($sql4);
00101 
00102 print "<h3>Select SQL</h3>";
00103 $rs = $conn->Execute($sql5);
00104 if ($rs) rs2html($rs);
00105 
00106 
00107 /* EXPECTED RESULTS FOR HTTP TEST:
00108 
00109 Test Insert
00110 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
00111 
00112 adorecordset Object
00113 (
00114         [dataProvider] => native
00115         [fields] => 
00116         [blobSize] => 64
00117         [canSeek] => 
00118         [EOF] => 1
00119         [emptyTimeStamp] =>  
00120         [emptyDate] =>  
00121         [debug] => 
00122         [timeToLive] => 0
00123         [bind] => 
00124         [_numOfRows] => -1
00125         [_numOfFields] => 0
00126         [_queryID] => 1
00127         [_currentRow] => -1
00128         [_closed] => 
00129         [_inited] => 
00130         [sql] => insert into products (productname) values ('testprod')
00131         [affectedrows] => 1
00132         [insertid] => 81
00133 )
00134 
00135 
00136 --------------------------------------------------------------------------------
00137 
00138 Test Insert2
00139 http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
00140 
00141 adorecordset Object
00142 (
00143         [dataProvider] => native
00144         [fields] => 
00145         [blobSize] => 64
00146         [canSeek] => 
00147         [EOF] => 1
00148         [emptyTimeStamp] =>  
00149         [emptyDate] =>  
00150         [debug] => 
00151         [timeToLive] => 0
00152         [bind] => 
00153         [_numOfRows] => -1
00154         [_numOfFields] => 0
00155         [_queryID] => 1
00156         [_currentRow] => -1
00157         [_closed] => 
00158         [_inited] => 
00159         [sql] => insert into products (productname) values ('testprod')
00160         [affectedrows] => 1
00161         [insertid] => 82
00162 )
00163 
00164 
00165 --------------------------------------------------------------------------------
00166 
00167 Test Delete
00168 http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
00169 
00170 adorecordset Object
00171 (
00172         [dataProvider] => native
00173         [fields] => 
00174         [blobSize] => 64
00175         [canSeek] => 
00176         [EOF] => 1
00177         [emptyTimeStamp] =>  
00178         [emptyDate] =>  
00179         [debug] => 
00180         [timeToLive] => 0
00181         [bind] => 
00182         [_numOfRows] => -1
00183         [_numOfFields] => 0
00184         [_queryID] => 1
00185         [_currentRow] => -1
00186         [_closed] => 
00187         [_inited] => 
00188         [sql] => delete from products where productid>80
00189         [affectedrows] => 2
00190         [insertid] => 0
00191 )
00192 
00193 [more stuff deleted]
00194  .
00195  . 
00196  .
00197 */
00198 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6