00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 ?>
00012
00013 <table><tr valign=top><td>
00014 <form method=get>
00015 <input type=checkbox name="testaccess" value=1 <?php echo !empty($testaccess) ? 'checked' : '' ?>> <b>Access</b><br>
00016 <input type=checkbox name="testibase" value=1 <?php echo !empty($testibase) ? 'checked' : '' ?>> <b>Interbase</b><br>
00017 <input type=checkbox name="testmssql" value=1 <?php echo !empty($testmssql) ? 'checked' : '' ?>> <b>MSSQL</b><br>
00018 <input type=checkbox name="testmysql" value=1 <?php echo !empty($testmysql) ? 'checked' : '' ?>> <b>MySQL</b><br>
00019 <input type=checkbox name="testmysqlodbc" value=1 <?php echo !empty($testmysqlodbc) ? 'checked' : '' ?>> <b>MySQL ODBC</b><br>
00020 <input type=checkbox name="testmysqli" value=1 <?php echo !empty($testmysqli) ? 'checked' : '' ?>> <b>MySQLi</b>
00021 <br>
00022 <td><input type=checkbox name="testsqlite" value=1 <?php echo !empty($testsqlite) ? 'checked' : '' ?>> <b>SQLite</b><br>
00023 <input type=checkbox name="testproxy" value=1 <?php echo !empty($testproxy) ? 'checked' : '' ?>> <b>MySQL Proxy</b><br>
00024 <input type=checkbox name="testoracle" value=1 <?php echo !empty($testoracle) ? 'checked' : '' ?>> <b>Oracle (oci8)</b> <br>
00025 <input type=checkbox name="testpostgres" value=1 <?php echo !empty($testpostgres) ? 'checked' : '' ?>> <b>PostgreSQL</b><br>
00026 <input type=checkbox name="testpgodbc" value=1 <?php echo !empty($testpgodbc) ? 'checked' : '' ?>> <b>PostgreSQL ODBC</b><br>
00027 <td>
00028 <input type=checkbox name="testpdopgsql" value=1 <?php echo !empty($testpdopgsql) ? 'checked' : '' ?>> <b>PgSQL PDO</b><br>
00029 <input type=checkbox name="testpdomysql" value=1 <?php echo !empty($testpdomysql) ? 'checked' : '' ?>> <b>MySQL PDO</b><br>
00030 <input type=checkbox name="testpdosqlite" value=1 <?php echo !empty($testpdosqlite) ? 'checked' : '' ?>> <b>SQLite PDO</b><br>
00031 <input type=checkbox name="testpdoaccess" value=1 <?php echo !empty($testpdoaccess) ? 'checked' : '' ?>> <b>Access PDO</b><br>
00032 <input type=checkbox name="testpdomssql" value=1 <?php echo !empty($testpdomssql) ? 'checked' : '' ?>> <b>MSSQL PDO</b><br>
00033
00034 <input type=checkbox name="testpdoora" value=1 <?php echo !empty($testpdoora) ? 'checked' : '' ?>> <b>OCI PDO</b><br>
00035
00036 <td><input type=checkbox name="testdb2" value=1 <?php echo !empty($testdb2) ? 'checked' : '' ?>> DB2<br>
00037 <input type=checkbox name="testvfp" value=1 <?php echo !empty($testvfp) ? 'checked' : '' ?>> VFP+ODBTP<br>
00038 <input type=checkbox name="testado" value=1 <?php echo !empty($testado) ? 'checked' : '' ?>> ADO (for mssql and access)<br>
00039 <input type=checkbox name="nocountrecs" value=1 <?php echo !empty($nocountrecs) ? 'checked' : '' ?>> $ADODB_COUNTRECS=false<br>
00040 <input type=checkbox name="nolog" value=1 <?php echo !empty($nolog) ? 'checked' : '' ?>> No SQL Logging<br>
00041 <input type=checkbox name="time" value=1 <?php echo !empty($_GET['time']) ? 'checked' : '' ?>> ADOdb time test
00042 </table>
00043 <input type=submit>
00044 </form>
00045
00046 <?php
00047
00048 if ($ADODB_FETCH_MODE != ADODB_FETCH_DEFAULT) print "<h3>FETCH MODE IS NOT ADODB_FETCH_DEFAULT</h3>";
00049
00050 if (isset($nocountrecs)) $ADODB_COUNTRECS = false;
00051
00052
00053
00054
00055 if (!strpos(PHP_VERSION,'5') === 0) {
00056 ADOLoadCode("sybase");
00057
00058
00059 ADOLoadCode("firebird");
00060 ADOLoadCode("borland_ibase");
00061 ADOLoadCode("informix");
00062 ADOLoadCode("sqlanywhere");
00063
00064 }
00065
00066
00067 flush();
00068 if (!empty($testpostgres)) {
00069
00070
00071 $db = &ADONewConnection('postgres');
00072 print "<h1>Connecting $db->databaseType...</h1>";
00073 if ($db->Connect("localhost","tester","test","test")) {
00074 testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date)");
00075 }else
00076 print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg();
00077 }
00078
00079 if (!empty($testpgodbc)) {
00080
00081 $db = &ADONewConnection('odbc');
00082 $db->hasTransactions = false;
00083 print "<h1>Connecting $db->databaseType...</h1>";
00084
00085 if ($db->PConnect('Postgresql')) {
00086 $db->hasTransactions = true;
00087 testdb($db,
00088 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
00089 } else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg();
00090 }
00091
00092 if (!empty($testibase)) {
00093
00094 $db = &ADONewConnection('firebird');
00095 print "<h1>Connecting $db->databaseType...</h1>";
00096 if ($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba", "masterkey", ""))
00097 testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname char(24),price numeric(12,2),created date)");
00098 else print "ERROR: Interbase test requires a database called employee.gdb".'<BR>'.$db->ErrorMsg();
00099
00100 }
00101
00102
00103 if (!empty($testsqlite)) {
00104 $path =urlencode('d:\inetpub\adodb\sqlite.db');
00105 $dsn = "sqlite://$path/";
00106 $db = ADONewConnection($dsn);
00107
00108
00109
00110
00111
00112 if ($db && $db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", "")) {
00113 print "<h1>Connecting $db->databaseType...</h1>";
00114 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
00115 } else
00116 print "ERROR: SQLite";
00117
00118 }
00119
00120 if (!empty($testpdopgsql)) {
00121 $connstr = "pgsql:dbname=test";
00122 $u = 'tester';$p='test';
00123 $db = &ADONewConnection('pdo');
00124 print "<h1>Connecting $db->databaseType...</h1>";
00125 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00126 testdb($db,
00127 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00128 }
00129
00130 if (!empty($testpdomysql)) {
00131 $connstr = "mysql:dbname=northwind";
00132 $u = 'root';$p='';
00133 $db = &ADONewConnection('pdo');
00134 print "<h1>Connecting $db->databaseType...</h1>";
00135 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00136
00137 testdb($db,
00138 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00139 }
00140
00141 if (!empty($testpdomssql)) {
00142 $connstr = "mssql:dbname=northwind";
00143 $u = 'sa';$p='natsoft';
00144 $db = &ADONewConnection('pdo');
00145 print "<h1>Connecting $db->databaseType...</h1>";
00146 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00147
00148 testdb($db,
00149 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00150 }
00151
00152 if (!empty($testpdosqlite)) {
00153 $connstr = "sqlite:d:/inetpub/adodb/sqlite-pdo.db3";
00154 $u = '';$p='';
00155 $db = &ADONewConnection('pdo');
00156 $db->hasTransactions = false;
00157 print "<h1>Connecting $db->databaseType...</h1>";
00158 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00159 testdb($db,
00160 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00161 }
00162
00163 if (!empty($testpdoaccess)) {
00164 $connstr = 'odbc:nwind';
00165 $u = '';$p='';
00166 $db = &ADONewConnection('pdo');
00167 $db->hasTransactions = false;
00168 print "<h1>Connecting $db->databaseType...</h1>";
00169 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00170 testdb($db,
00171 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00172 }
00173
00174 if (!empty($testpdoora)) {
00175 $connstr = 'oci:';
00176 $u = 'scott';$p='natsoft';
00177 $db = &ADONewConnection('pdo');
00178 #$db->hasTransactions = false;
00179 print "<h1>Connecting $db->databaseType...</h1>";
00180 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED");
00181 testdb($db,
00182 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00183 }
00184
00185
00186 if (!empty($testaccess)) {
00187 $db = &ADONewConnection('access');
00188 print "<h1>Connecting $db->databaseType...</h1>";
00189 $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
00190 $dsn = "nwind";
00191 $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$access;Uid=Admin;Pwd=;";
00192
00193
00194 if ($db->PConnect($dsn, "", "", ""))
00195 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
00196 else print "ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver";
00197
00198 }
00199
00200 if (!empty($testaccess) && !empty($testado)) {
00201
00202 $db = &ADONewConnection("ado_access");
00203 print "<h1>Connecting $db->databaseType...</h1>";
00204
00205 $access = 'd:\inetpub\wwwroot\php\NWIND.MDB';
00206 $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
00207 . 'DATA SOURCE=' . $access . ';';
00208
00209 $_GET['nolog'] = 1;
00210 if ($db->PConnect($myDSN, "", "", "")) {
00211 print "ADO version=".$db->_connectionID->version."<br>";
00212 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
00213 } else print "ERROR: Access test requires a Access database $access".'<BR>'.$db->ErrorMsg();
00214
00215 }
00216
00217 if (!empty($testvfp)) {
00218 $db = &ADONewConnection('vfp');
00219 print "<h1>Connecting $db->databaseType...</h1>";flush();
00220
00221 if ( $db->PConnect("vfp-adoxyz")) {
00222 testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)");
00223 } else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver";
00224
00225 echo "<hr />";
00226 $db = &ADONewConnection('odbtp');
00227
00228 if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) {
00229 print "<h1>Connecting $db->databaseType...</h1>";flush();
00230 testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)");
00231 } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC DSN=vfp-adoxyz, VFP driver";
00232
00233 }
00234
00235
00236
00237 if (!empty($testmysql)) {
00238
00239
00240 if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
00241 else $server = "mangrove";
00242 $user = 'root'; $password = ''; $database = 'northwind';
00243 $db = &ADONewConnection("mysqlt://$user:$password@$server/$database?persist");
00244 print "<h1>Connecting $db->databaseType...</h1>";
00245
00246 if (true || $db->PConnect($server, "root", "", "northwind")) {
00247
00248
00249 testdb($db,
00250 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB");
00251 } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
00252 }
00253
00254
00255 if (!empty($testmysqli)) {
00256
00257 $db = &ADONewConnection('mysqli');
00258 print "<h1>Connecting $db->databaseType...</h1>";
00259 if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
00260 else $server = "mangrove";
00261 if ($db->PConnect($server, "root", "", "northwind")) {
00262
00263 testdb($db,
00264 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)");
00265 } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
00266 }
00267
00268
00269
00270 if (!empty($testmysqlodbc)) {
00271
00272 $db = &ADONewConnection('odbc');
00273 $db->hasTransactions = false;
00274 print "<h1>Connecting $db->databaseType...</h1>";
00275 if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
00276 else $server = "mangrove";
00277 if ($db->PConnect('mysql', "root", ""))
00278 testdb($db,
00279 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
00280 else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
00281 }
00282
00283 if (!empty($testproxy)){
00284 $db = &ADONewConnection('proxy');
00285 print "<h1>Connecting $db->databaseType...</h1>";
00286 if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost';
00287
00288 if ($db->PConnect('http:
00289 testdb($db,
00290 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb");
00291 else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg();
00292
00293 }
00294
00295 ADOLoadCode('oci805');
00296 ADOLoadCode("oci8po");
00297
00298 if (!empty($testoracle)) {
00299 $dsn = "oci8po://juris10:natsoft@sherkhan?persist";
00300 $db = ADONewConnection($dsn );
00301
00302
00303 print "<h1>Connecting $db->databaseType...</h1>";
00304 if (true || $db->Connect('', "scott", "natsoft",''))
00305 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
00306 else
00307 print "ERROR: Oracle test requires an Oracle server setup with scott/natsoft".'<BR>'.$db->ErrorMsg();
00308
00309 }
00310 ADOLoadCode("oracle");
00311 if (false && !empty($testoracle)) {
00312
00313 $db = ADONewConnection();
00314 print "<h1>Connecting $db->databaseType...</h1>";
00315 if ($db->PConnect("", "scott", "tiger", "natsoft.domain"))
00316 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
00317 else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'<BR>'.$db->ErrorMsg();
00318
00319 }
00320
00321 ADOLoadCode("odbc_db2");
00322 if (!empty($testdb2)) {
00323 if (PHP_VERSION>=5.1) {
00324 $db = ADONewConnection("db2");
00325 print "<h1>Connecting $db->databaseType...</h1>";
00326
00327 #$db->curMode = SQL_CUR_USE_ODBC;
00328 #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
00329 if ($db->Connect('localhost','natsoft','guest','test')) {
00330 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
00331 } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
00332 } else {
00333 $db = ADONewConnection("odbc_db2");
00334 print "<h1>Connecting $db->databaseType...</h1>";
00335
00336 $dsn = "db2test";
00337 #$db->curMode = SQL_CUR_USE_ODBC;
00338 #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest";
00339 if ($db->Connect($dsn)) {
00340 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
00341 } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg();
00342 }
00343 echo "<hr />";
00344 flush();
00345 $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft";
00346
00347 $db = ADONewConnection('odbtp');
00348 if ($db->Connect('127.0.0.1',$dsn)) {
00349
00350 $db->debug=1;
00351 $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr);
00352 $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR" );adodb_pr($arr);
00353
00354 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
00355 } else echo ("ERROR Connection");
00356 echo $db->ErrorMsg();
00357 }
00358
00359
00360 $server = 'sherkhan';
00361
00362
00363
00364 ADOLoadCode("mssqlpo");
00365 if (!empty($testmssql)) {
00366 $db = ADONewConnection("mssqlpo");
00367
00368 print "<h1>Connecting $db->databaseType...</h1>";
00369
00370 $ok = $db->Connect('','adodb','natsoft','northwind');
00371
00372 if ($ok or $db->PConnect("mangrove", "sa", "natsoft", "ai")) {
00373 AutoDetect_MSSQL_Date_Order($db);
00374
00375 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
00376 } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='192.168.0.1', userid='adodb', password='natsoft', database='ai'".'<BR>'.$db->ErrorMsg();
00377
00378 }
00379
00380
00381 ADOLoadCode('odbc_mssql');
00382 if (!empty($testmssql)) {
00383 $db = ADONewConnection();
00384
00385 print "<h1>Connecting $db->databaseType...</h1>";
00386
00387 $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;";
00388
00389 if ($db->PConnect($dsn, "adodb", "natsoft", "")) {
00390 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
00391 }
00392 else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup";
00393
00394 }
00395
00396 ADOLoadCode("ado_mssql");
00397 if (!empty($testmssql) && !empty($testado) ) {
00398
00399 $db = &ADONewConnection("ado_mssql");
00400
00401 print "<h1>Connecting DSN-less $db->databaseType...</h1>";
00402
00403 $myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};"
00404 . "SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No";
00405
00406
00407 if ($db->PConnect($myDSN, "", "", ""))
00408 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
00409 else print "ERROR: MSSQL test 2 requires MS SQL 7";
00410
00411 }
00412
00413 if (!empty($testmssql) && !empty($testado)) {
00414
00415 $db = &ADONewConnection("ado_mssql");
00416 print "<h1>Connecting DSN-less OLEDB Provider $db->databaseType...</h1>";
00417
00418 $myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes";
00419 if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) {
00420 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
00421 } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'";
00422
00423 }
00424
00425
00426 if (extension_loaded('odbtp') && !empty($testmssql)) {
00427 $db = ADONewConnection('odbtp');
00428
00429 $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft";
00430
00431 if ($db->PConnect('localhost',$dsn, "", "")) {
00432 print "<h1>Connecting $db->databaseType...</h1>";
00433 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)");
00434 }
00435 else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup";
00436
00437 }
00438
00439
00440 print "<h3>Tests Completed</h3>";
00441
00442 ?>