|
Adodb Dokumentation
V5.14 8 Sept 2011
|
00001 <?php 00002 00003 /* 00004 V4.80 8 Mar 2006 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved. 00005 Released under both BSD license and Lesser GPL library license. 00006 Whenever there is any discrepancy between the two licenses, 00007 the BSD license will take precedence. 00008 */ 00009 00010 /* this file is used by the ADODB test program: test.php */ 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 // cannot test databases below, but we include them anyway to check 00053 // if they parse ok... 00054 00055 if (sizeof($_GET) || !isset($_SERVER['HTTP_HOST'])) { 00056 echo "<BR>"; 00057 ADOLoadCode2("sybase"); 00058 ADOLoadCode2("postgres"); 00059 ADOLoadCode2("postgres7"); 00060 ADOLoadCode2("firebird"); 00061 ADOLoadCode2("borland_ibase"); 00062 ADOLoadCode2("informix"); 00063 ADOLoadCode2('mysqli'); 00064 if (defined('ODBC_BINMODE_RETURN')) { 00065 ADOLoadCode2("sqlanywhere"); 00066 ADOLoadCode2("access"); 00067 } 00068 ADOLoadCode2("mysql"); 00069 ADOLoadCode2("oci8"); 00070 } 00071 00072 function ADOLoadCode2($d) 00073 { 00074 ADOLoadCode($d); 00075 $c = ADONewConnection($d); 00076 echo "Loaded $d ",($c ? 'ok' : 'extension not installed'),"<br>"; 00077 } 00078 00079 flush(); 00080 if (!empty($testpostgres)) { 00081 //ADOLoadCode("postgres"); 00082 00083 $db = ADONewConnection('postgres'); 00084 print "<h1>Connecting $db->databaseType...</h1>"; 00085 if ($db->Connect("localhost","tester","test","northwind")) { 00086 testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date)"); 00087 }else 00088 print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg(); 00089 } 00090 00091 if (!empty($testpgodbc)) { 00092 00093 $db = ADONewConnection('odbc'); 00094 $db->hasTransactions = false; 00095 print "<h1>Connecting $db->databaseType...</h1>"; 00096 00097 if ($db->PConnect('Postgresql')) { 00098 $db->hasTransactions = true; 00099 testdb($db, 00100 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); 00101 } else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.<BR>".$db->ErrorMsg(); 00102 } 00103 00104 if (!empty($testibase)) { 00105 //$_GET['nolog'] = true; 00106 $db = ADONewConnection('firebird'); 00107 print "<h1>Connecting $db->databaseType...</h1>"; 00108 if ($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba", "masterkey", "")) 00109 testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname char(24),price numeric(12,2),created date)"); 00110 else print "ERROR: Interbase test requires a database called employee.gdb".'<BR>'.$db->ErrorMsg(); 00111 00112 } 00113 00114 00115 if (!empty($testsqlite)) { 00116 $path =urlencode('d:\inetpub\adodb\sqlite.db'); 00117 $dsn = "sqlite://$path/"; 00118 $db = ADONewConnection($dsn); 00119 //echo $dsn; 00120 00121 //$db = ADONewConnection('sqlite'); 00122 00123 00124 if ($db && $db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", "")) { 00125 print "<h1>Connecting $db->databaseType...</h1>"; 00126 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); 00127 } else 00128 print "ERROR: SQLite"; 00129 00130 } 00131 00132 if (!empty($testpdopgsql)) { 00133 $connstr = "pgsql:dbname=test"; 00134 $u = 'tester';$p='test'; 00135 $db = ADONewConnection('pdo'); 00136 print "<h1>Connecting $db->databaseType...</h1>"; 00137 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00138 testdb($db, 00139 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00140 } 00141 00142 if (!empty($testpdomysql)) { 00143 $connstr = "mysql:dbname=northwind"; 00144 $u = 'root';$p=''; 00145 $db = ADONewConnection('pdo'); 00146 print "<h1>Connecting $db->databaseType...</h1>"; 00147 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00148 00149 testdb($db, 00150 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00151 } 00152 00153 if (!empty($testpdomssql)) { 00154 $connstr = "mssql:dbname=northwind"; 00155 $u = 'sa';$p='natsoft'; 00156 $db = ADONewConnection('pdo'); 00157 print "<h1>Connecting $db->databaseType...</h1>"; 00158 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00159 00160 testdb($db, 00161 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00162 } 00163 00164 if (!empty($testpdosqlite)) { 00165 $connstr = "sqlite:d:/inetpub/adodb/sqlite-pdo.db3"; 00166 $u = '';$p=''; 00167 $db = ADONewConnection('pdo'); 00168 $db->hasTransactions = false; 00169 print "<h1>Connecting $db->databaseType...</h1>"; 00170 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00171 testdb($db, 00172 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00173 } 00174 00175 if (!empty($testpdoaccess)) { 00176 $connstr = 'odbc:nwind'; 00177 $u = '';$p=''; 00178 $db = ADONewConnection('pdo'); 00179 $db->hasTransactions = false; 00180 print "<h1>Connecting $db->databaseType...</h1>"; 00181 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00182 testdb($db, 00183 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00184 } 00185 00186 if (!empty($testpdoora)) { 00187 $connstr = 'oci:'; 00188 $u = 'scott';$p='natsoft'; 00189 $db = ADONewConnection('pdo'); 00190 #$db->hasTransactions = false; 00191 print "<h1>Connecting $db->databaseType...</h1>"; 00192 $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 00193 testdb($db, 00194 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00195 } 00196 00197 // REQUIRES ODBC DSN CALLED nwind 00198 if (!empty($testaccess)) { 00199 $db = ADONewConnection('access'); 00200 print "<h1>Connecting $db->databaseType...</h1>"; 00201 $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; 00202 $dsn = "nwind"; 00203 $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$access;Uid=Admin;Pwd=;"; 00204 00205 //$dsn = 'Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . $access . ';'; 00206 if ($db->PConnect($dsn, "", "", "")) 00207 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); 00208 else print "ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver"; 00209 00210 } 00211 00212 if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS 00213 00214 $db = ADONewConnection("ado_access"); 00215 print "<h1>Connecting $db->databaseType...</h1>"; 00216 00217 $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; 00218 $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' 00219 . 'DATA SOURCE=' . $access . ';'; 00220 //. 'USER ID=;PASSWORD=;'; 00221 $_GET['nolog'] = 1; 00222 if ($db->PConnect($myDSN, "", "", "")) { 00223 print "ADO version=".$db->_connectionID->version."<br>"; 00224 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); 00225 } else print "ERROR: Access test requires a Access database $access".'<BR>'.$db->ErrorMsg(); 00226 00227 } 00228 00229 if (!empty($testvfp)) { // ODBC 00230 $db = ADONewConnection('vfp'); 00231 print "<h1>Connecting $db->databaseType...</h1>";flush(); 00232 00233 if ( $db->PConnect("vfp-adoxyz")) { 00234 testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); 00235 } else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; 00236 00237 echo "<hr />"; 00238 $db = ADONewConnection('odbtp'); 00239 00240 if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) { 00241 print "<h1>Connecting $db->databaseType...</h1>";flush(); 00242 testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); 00243 } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; 00244 00245 } 00246 00247 00248 // REQUIRES MySQL server at localhost with database 'test' 00249 if (!empty($testmysql)) { // MYSQL 00250 00251 00252 if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; 00253 else $server = "mangrove"; 00254 $user = 'root'; $password = ''; $database = 'northwind'; 00255 $db = ADONewConnection("mysqlt://$user:$password@$server/$database?persist"); 00256 print "<h1>Connecting $db->databaseType...</h1>"; 00257 00258 if (true || $db->PConnect($server, "root", "", "northwind")) { 00259 //$db->Execute("DROP TABLE ADOXYZ") || die('fail drop'); 00260 //$db->debug=1;$db->Execute('drop table ADOXYZ'); 00261 testdb($db, 00262 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB"); 00263 } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg(); 00264 } 00265 00266 // REQUIRES MySQL server at localhost with database 'test' 00267 if (!empty($testmysqli)) { // MYSQL 00268 00269 $db = ADONewConnection('mysqli'); 00270 print "<h1>Connecting $db->databaseType...</h1>"; 00271 if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; 00272 else $server = "mangrove"; 00273 if ($db->PConnect($server, "root", "", "northwind")) { 00274 //$db->debug=1;$db->Execute('drop table ADOXYZ'); 00275 testdb($db, 00276 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); 00277 } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg(); 00278 } 00279 00280 00281 // REQUIRES MySQL server at localhost with database 'test' 00282 if (!empty($testmysqlodbc)) { // MYSQL 00283 00284 $db = ADONewConnection('odbc'); 00285 $db->hasTransactions = false; 00286 print "<h1>Connecting $db->databaseType...</h1>"; 00287 if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; 00288 else $server = "mangrove"; 00289 if ($db->PConnect('mysql', "root", "")) 00290 testdb($db, 00291 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); 00292 else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg(); 00293 } 00294 00295 if (!empty($testproxy)){ 00296 $db = ADONewConnection('proxy'); 00297 print "<h1>Connecting $db->databaseType...</h1>"; 00298 if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; 00299 00300 if ($db->PConnect('http://localhost/php/phplens/adodb/server.php')) 00301 testdb($db, 00302 "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); 00303 else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'<BR>'.$db->ErrorMsg(); 00304 00305 } 00306 00307 ADOLoadCode('oci805'); 00308 ADOLoadCode("oci8po"); 00309 00310 if (!empty($testoracle)) { 00311 $dsn = "oci8";//://scott:natsoft@kk2?persist"; 00312 $db = ADONewConnection($dsn );//'oci8'); 00313 00314 //$db->debug=1; 00315 print "<h1>Connecting $db->databaseType...</h1>"; 00316 if ($db->Connect('mobydick', "scott", "natsoft",'SID=mobydick')) 00317 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); 00318 else 00319 print "ERROR: Oracle test requires an Oracle server setup with scott/natsoft".'<BR>'.$db->ErrorMsg(); 00320 00321 } 00322 ADOLoadCode("oracle"); // no longer supported 00323 if (false && !empty($testoracle)) { 00324 00325 $db = ADONewConnection(); 00326 print "<h1>Connecting $db->databaseType...</h1>"; 00327 if ($db->PConnect("", "scott", "tiger", "natsoft.domain")) 00328 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); 00329 else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'<BR>'.$db->ErrorMsg(); 00330 00331 } 00332 00333 ADOLoadCode("odbc_db2"); // no longer supported 00334 if (!empty($testdb2)) { 00335 if (PHP_VERSION>=5.1) { 00336 $db = ADONewConnection("db2"); 00337 print "<h1>Connecting $db->databaseType...</h1>"; 00338 00339 #$db->curMode = SQL_CUR_USE_ODBC; 00340 #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; 00341 if ($db->Connect('localhost','natsoft','guest','test')) { 00342 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); 00343 } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg(); 00344 } else { 00345 $db = ADONewConnection("odbc_db2"); 00346 print "<h1>Connecting $db->databaseType...</h1>"; 00347 00348 $dsn = "db2test"; 00349 #$db->curMode = SQL_CUR_USE_ODBC; 00350 #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; 00351 if ($db->Connect($dsn)) { 00352 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); 00353 } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'<BR>'.$db->ErrorMsg(); 00354 } 00355 echo "<hr />"; 00356 flush(); 00357 $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft"; 00358 00359 $db = ADONewConnection('odbtp'); 00360 if ($db->Connect('127.0.0.1',$dsn)) { 00361 00362 $db->debug=1; 00363 $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr); 00364 $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR" );adodb_pr($arr); 00365 00366 testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); 00367 } else echo ("ERROR Connection"); 00368 echo $db->ErrorMsg(); 00369 } 00370 00371 00372 $server = 'localhost'; 00373 00374 00375 00376 ADOLoadCode("mssqlpo"); 00377 if (false && !empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC 00378 $db = ADONewConnection("mssqlpo"); 00379 //$db->debug=1; 00380 print "<h1>Connecting $db->databaseType...</h1>"; 00381 00382 $ok = $db->Connect('','sa','natsoft','northwind'); 00383 echo $db->ErrorMsg(); 00384 if ($ok /*or $db->PConnect("mangrove", "sa", "natsoft", "ai")*/) { 00385 AutoDetect_MSSQL_Date_Order($db); 00386 // $db->Execute('drop table adoxyz'); 00387 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); 00388 } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='$server', userid='adodb', password='natsoft', database='ai'".'<BR>'.$db->ErrorMsg(); 00389 00390 } 00391 00392 00393 ADOLoadCode('odbc_mssql'); 00394 if (!empty($testmssql)) { // MS SQL Server via ODBC 00395 $db = ADONewConnection(); 00396 00397 print "<h1>Connecting $db->databaseType...</h1>"; 00398 00399 $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;"; 00400 $dsn = 'condor'; 00401 if ($db->PConnect($dsn, "sa", "natsoft", "")) { 00402 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); 00403 } 00404 else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; 00405 00406 } 00407 00408 ADOLoadCode("ado_mssql"); 00409 if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC -- DSN-less 00410 00411 $db = ADONewConnection("ado_mssql"); 00412 //$db->debug=1; 00413 print "<h1>Connecting DSN-less $db->databaseType...</h1>"; 00414 00415 $myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};" 00416 . "SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No"; 00417 00418 00419 if ($db->PConnect($myDSN, "", "", "")) 00420 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); 00421 else print "ERROR: MSSQL test 2 requires MS SQL 7"; 00422 00423 } 00424 00425 if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider 00426 00427 $db = ADONewConnection("ado_mssql"); 00428 print "<h1>Connecting DSN-less OLEDB Provider $db->databaseType...</h1>"; 00429 //$db->debug=1; 00430 $myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes"; 00431 if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) { 00432 testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); 00433 } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'"; 00434 00435 } 00436 00437 00438 if (extension_loaded('odbtp') && !empty($testmssql)) { // MS SQL Server via ODBC 00439 $db = ADONewConnection('odbtp'); 00440 00441 $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft"; 00442 00443 if ($db->PConnect('localhost',$dsn, "", "")) { 00444 print "<h1>Connecting $db->databaseType...</h1>"; 00445 testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); 00446 } 00447 else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; 00448 00449 } 00450 00451 00452 print "<h3>Tests Completed</h3>"; 00453 00454 ?>