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 (!strpos(PHP_VERSION,'5') === 0) {
ADOLoadCode("sybase");
ADOLoadCode("postgres");
ADOLoadCode("postgres7");
ADOLoadCode("firebird");
ADOLoadCode("borland_ibase");
ADOLoadCode("informix");
ADOLoadCode("sqlanywhere");
}
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)) {
$db = &ADONewConnection('firebird');
print "
Connecting $db->databaseType...
";
if (@$db->PConnect("localhost:d:\\firebird\\10\\examples\\employee.gdb", "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)) {
$db = &ADONewConnection('sqlite');
print "
Connecting $db->databaseType...
";
if (@$db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", ""))
testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)");
else print "ERROR: SQLite";
}
// REQUIRES ODBC DSN CALLED nwind
if (!empty($testaccess)) {
$db = &ADONewConnection('access');
print "
Connecting $db->databaseType...
";
$dsn = "nwind";
$driver = "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\inetpub\adodb\northwind.mdb;Uid=Admin;Pwd=;";
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 "
";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";
}
// REQUIRES MySQL server at localhost with database 'test'
if (!empty($testmysql)) { // MYSQL
$db = &ADONewConnection('mysql');
print "
Connecting $db->databaseType...
";
if ($HTTP_SERVER_VARS['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 ($HTTP_SERVER_VARS['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 ($HTTP_SERVER_VARS['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)) {
$db = ADONewConnection('oci8po');
print "
Connecting $db->databaseType...
";
if ($db->Connect('', "scott", "natsoft",''))
//if ($db->PConnect("", "scott", "tiger", "juris.ecosystem.natsoft.com.my"))
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("db2"); // no longer supported
if (!empty($testdb2)) {
$db = ADONewConnection();
print "
Connecting $db->databaseType...
";
if ($db->Connect("db2_sample", "root", "natsoft", ""))
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();
}
ADOLoadCode("odbc_mssql");
if (!empty($testmssql)) { // MS SQL Server via ODBC
$db = ADONewConnection();
print "
Connecting $db->databaseType...
";
$dsn = "mssql-northwind";
$dsn = "Driver={SQL Server};Server=localhost;Database=northwind;";
if (@$db->PConnect($dsn, "adodb", "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=tigress;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";
}
ADOLoadCode("mssqlpo");
if (!empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC
$db = ADONewConnection();
//$db->debug=1;
print "
Connecting $db->databaseType...
";
$db->PConnect('tigress','adodb','natsoft','northwind');
if (true 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='192.168.0.1', userid='sa', password='natsoft', database='ai'".' '.$db->ErrorMsg();
}
if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider
$db = &ADONewConnection("ado_mssql");
print "