> Access
> Interbase
> MSSQL
> MySQL
> MySQL ODBC
> MySQLi
> SQLite
> MySQL Proxy
> Oracle (oci8)
> PostgreSQL
> PostgreSQL ODBC
> PgSQL PDO
> MySQL PDO
> SQLite PDO
> Access PDO
> MSSQL PDO
> OCI PDO
> DB2
> VFP+ODBTP
> ADO (for mssql and access)
> $ADODB_COUNTRECS=false
> No SQL Logging
> ADOdb time test
FETCH MODE IS NOT ADODB_FETCH_DEFAULT"; if (isset($nocountrecs)) $ADODB_COUNTRECS = false; // cannot test databases below, but we include them anyway to check // if they parse ok... if (sizeof($_GET) || !isset($_SERVER['HTTP_HOST'])) { echo "
"; ADOLoadCode2("sybase"); ADOLoadCode2("postgres"); ADOLoadCode2("postgres7"); ADOLoadCode2("firebird"); ADOLoadCode2("borland_ibase"); ADOLoadCode2("informix"); ADOLoadCode2('mysqli'); if (defined('ODBC_BINMODE_RETURN')) { ADOLoadCode2("sqlanywhere"); ADOLoadCode2("access"); } ADOLoadCode2("mysql"); ADOLoadCode2("oci8"); } function ADOLoadCode2($d) { ADOLoadCode($d); $c = ADONewConnection($d); echo "Loaded $d ",($c ? 'ok' : 'extension not installed'),"
"; } flush(); if (!empty($testpostgres)) { //ADOLoadCode("postgres"); $db = ADONewConnection('postgres'); print "

Connecting $db->databaseType...

"; if ($db->Connect("localhost","tester","test","test")) { testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date)"); }else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.
".$db->ErrorMsg(); } if (!empty($testpgodbc)) { $db = ADONewConnection('odbc'); $db->hasTransactions = false; print "

Connecting $db->databaseType...

"; if ($db->PConnect('Postgresql')) { $db->hasTransactions = true; testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); } else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.
".$db->ErrorMsg(); } if (!empty($testibase)) { //$_GET['nolog'] = true; $db = ADONewConnection('firebird'); print "

Connecting $db->databaseType...

"; if ($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba", "masterkey", "")) testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname char(24),price numeric(12,2),created date)"); else print "ERROR: Interbase test requires a database called employee.gdb".'
'.$db->ErrorMsg(); } if (!empty($testsqlite)) { $path =urlencode('d:\inetpub\adodb\sqlite.db'); $dsn = "sqlite://$path/"; $db = ADONewConnection($dsn); //echo $dsn; //$db = ADONewConnection('sqlite'); if ($db && $db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", "")) { print "

Connecting $db->databaseType...

"; testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); } else print "ERROR: SQLite"; } if (!empty($testpdopgsql)) { $connstr = "pgsql:dbname=test"; $u = 'tester';$p='test'; $db = ADONewConnection('pdo'); print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } if (!empty($testpdomysql)) { $connstr = "mysql:dbname=northwind"; $u = 'root';$p=''; $db = ADONewConnection('pdo'); print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } if (!empty($testpdomssql)) { $connstr = "mssql:dbname=northwind"; $u = 'sa';$p='natsoft'; $db = ADONewConnection('pdo'); print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } if (!empty($testpdosqlite)) { $connstr = "sqlite:d:/inetpub/adodb/sqlite-pdo.db3"; $u = '';$p=''; $db = ADONewConnection('pdo'); $db->hasTransactions = false; print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } if (!empty($testpdoaccess)) { $connstr = 'odbc:nwind'; $u = '';$p=''; $db = ADONewConnection('pdo'); $db->hasTransactions = false; print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } if (!empty($testpdoora)) { $connstr = 'oci:'; $u = 'scott';$p='natsoft'; $db = ADONewConnection('pdo'); #$db->hasTransactions = false; print "

Connecting $db->databaseType...

"; $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } // REQUIRES ODBC DSN CALLED nwind if (!empty($testaccess)) { $db = ADONewConnection('access'); print "

Connecting $db->databaseType...

"; $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; $dsn = "nwind"; $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$access;Uid=Admin;Pwd=;"; //$dsn = 'Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . $access . ';'; if ($db->PConnect($dsn, "", "", "")) testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); else print "ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver"; } if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS $db = ADONewConnection("ado_access"); print "

Connecting $db->databaseType...

"; $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' . 'DATA SOURCE=' . $access . ';'; //. 'USER ID=;PASSWORD=;'; $_GET['nolog'] = 1; if ($db->PConnect($myDSN, "", "", "")) { print "ADO version=".$db->_connectionID->version."
"; testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); } else print "ERROR: Access test requires a Access database $access".'
'.$db->ErrorMsg(); } if (!empty($testvfp)) { // ODBC $db = ADONewConnection('vfp'); print "

Connecting $db->databaseType...

";flush(); if ( $db->PConnect("vfp-adoxyz")) { testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); } else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; echo "
"; $db = ADONewConnection('odbtp'); if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) { print "

Connecting $db->databaseType...

";flush(); testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; } // REQUIRES MySQL server at localhost with database 'test' if (!empty($testmysql)) { // MYSQL if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; else $server = "mangrove"; $user = 'root'; $password = ''; $database = 'northwind'; $db = ADONewConnection("mysqlt://$user:$password@$server/$database?persist"); print "

Connecting $db->databaseType...

"; if (true || $db->PConnect($server, "root", "", "northwind")) { //$db->Execute("DROP TABLE ADOXYZ") || die('fail drop'); //$db->debug=1;$db->Execute('drop table ADOXYZ'); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB"); } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); } // REQUIRES MySQL server at localhost with database 'test' if (!empty($testmysqli)) { // MYSQL $db = ADONewConnection('mysqli'); print "

Connecting $db->databaseType...

"; if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; else $server = "mangrove"; if ($db->PConnect($server, "root", "", "northwind")) { //$db->debug=1;$db->Execute('drop table ADOXYZ'); testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); } // REQUIRES MySQL server at localhost with database 'test' if (!empty($testmysqlodbc)) { // MYSQL $db = ADONewConnection('odbc'); $db->hasTransactions = false; print "

Connecting $db->databaseType...

"; if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; else $server = "mangrove"; if ($db->PConnect('mysql', "root", "")) testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); } if (!empty($testproxy)){ $db = ADONewConnection('proxy'); print "

Connecting $db->databaseType...

"; if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; if ($db->PConnect('http://localhost/php/phplens/adodb/server.php')) testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); } ADOLoadCode('oci805'); ADOLoadCode("oci8po"); if (!empty($testoracle)) { $dsn = "oci8po";//://scott:natsoft@kk2?persist"; $db = ADONewConnection($dsn );//'oci8'); //$db->debug=1; print "

Connecting $db->databaseType...

"; if ($db->Connect('192.168.0.138', "scott", "natsoft",'SID=natsoft')) testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); else print "ERROR: Oracle test requires an Oracle server setup with scott/natsoft".'
'.$db->ErrorMsg(); } ADOLoadCode("oracle"); // no longer supported if (false && !empty($testoracle)) { $db = ADONewConnection(); print "

Connecting $db->databaseType...

"; if ($db->PConnect("", "scott", "tiger", "natsoft.domain")) testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'
'.$db->ErrorMsg(); } ADOLoadCode("odbc_db2"); // no longer supported if (!empty($testdb2)) { if (PHP_VERSION>=5.1) { $db = ADONewConnection("db2"); print "

Connecting $db->databaseType...

"; #$db->curMode = SQL_CUR_USE_ODBC; #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; if ($db->Connect('localhost','natsoft','guest','test')) { testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'
'.$db->ErrorMsg(); } else { $db = ADONewConnection("odbc_db2"); print "

Connecting $db->databaseType...

"; $dsn = "db2test"; #$db->curMode = SQL_CUR_USE_ODBC; #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; if ($db->Connect($dsn)) { testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'
'.$db->ErrorMsg(); } echo "
"; flush(); $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft"; $db = ADONewConnection('odbtp'); if ($db->Connect('127.0.0.1',$dsn)) { $db->debug=1; $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr); $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR" );adodb_pr($arr); testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); } else echo ("ERROR Connection"); echo $db->ErrorMsg(); } $server = 'localhost'; ADOLoadCode("mssqlpo"); if (false && !empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC $db = ADONewConnection("mssqlpo"); //$db->debug=1; print "

Connecting $db->databaseType...

"; $ok = $db->Connect('','sa','natsoft','northwind'); echo $db->ErrorMsg(); if ($ok /*or $db->PConnect("mangrove", "sa", "natsoft", "ai")*/) { AutoDetect_MSSQL_Date_Order($db); // $db->Execute('drop table adoxyz'); testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='$server', userid='adodb', password='natsoft', database='ai'".'
'.$db->ErrorMsg(); } ADOLoadCode('odbc_mssql'); if (!empty($testmssql)) { // MS SQL Server via ODBC $db = ADONewConnection(); print "

Connecting $db->databaseType...

"; $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;"; $dsn = 'condor'; if ($db->PConnect($dsn, "sa", "natsoft", "")) { testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); } else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; } ADOLoadCode("ado_mssql"); if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC -- DSN-less $db = ADONewConnection("ado_mssql"); //$db->debug=1; print "

Connecting DSN-less $db->databaseType...

"; $myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};" . "SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No"; if ($db->PConnect($myDSN, "", "", "")) testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); else print "ERROR: MSSQL test 2 requires MS SQL 7"; } if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider $db = ADONewConnection("ado_mssql"); print "

Connecting DSN-less OLEDB Provider $db->databaseType...

"; //$db->debug=1; $myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes"; if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) { testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'"; } if (extension_loaded('odbtp') && !empty($testmssql)) { // MS SQL Server via ODBC $db = ADONewConnection('odbtp'); $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft"; if ($db->PConnect('localhost',$dsn, "", "")) { print "

Connecting $db->databaseType...

"; testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); } else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; } print "

Tests Completed

"; ?>