2003-10-19 21:05:23 +02:00
< ? php
/*
2005-09-26 12:12:10 +02:00
V4 . 65 22 July 2005 ( c ) 2000 - 2005 John Lim ( jlim @ natsoft . com . my ) . All rights reserved .
2003-10-19 21:05:23 +02:00
Released under both BSD license and Lesser GPL library license .
Whenever there is any discrepancy between the two licenses ,
the BSD license will take precedence .
*/
/* this file is used by the ADODB test program: test.php */
?>
< table >< tr valign = top >< td >
< form method = get >
< input type = checkbox name = " testaccess " value = 1 < ? php echo ! empty ( $testaccess ) ? 'checked' : '' ?> > <b>Access</b><br>
< input type = checkbox name = " testibase " value = 1 < ? php echo ! empty ( $testibase ) ? 'checked' : '' ?> > <b>Interbase</b><br>
< input type = checkbox name = " testmssql " value = 1 < ? php echo ! empty ( $testmssql ) ? 'checked' : '' ?> > <b>MSSQL</b><br>
< input type = checkbox name = " testmysql " value = 1 < ? php echo ! empty ( $testmysql ) ? 'checked' : '' ?> > <b>MySQL</b><br>
< input type = checkbox name = " testmysqlodbc " value = 1 < ? php echo ! empty ( $testmysqlodbc ) ? 'checked' : '' ?> > <b>MySQL ODBC</b><br>
2005-09-26 12:12:10 +02:00
< input type = checkbox name = " testmysqli " value = 1 < ? php echo ! empty ( $testmysqli ) ? 'checked' : '' ?> > <b>MySQLi</b>
< br >
2003-10-19 21:05:23 +02:00
< td >< input type = checkbox name = " testsqlite " value = 1 < ? php echo ! empty ( $testsqlite ) ? 'checked' : '' ?> > <b>SQLite</b><br>
< input type = checkbox name = " testproxy " value = 1 < ? php echo ! empty ( $testproxy ) ? 'checked' : '' ?> > <b>MySQL Proxy</b><br>
< input type = checkbox name = " testoracle " value = 1 < ? php echo ! empty ( $testoracle ) ? 'checked' : '' ?> > <b>Oracle (oci8)</b> <br>
< input type = checkbox name = " testpostgres " value = 1 < ? php echo ! empty ( $testpostgres ) ? 'checked' : '' ?> > <b>PostgreSQL</b><br>
< input type = checkbox name = " testpgodbc " value = 1 < ? php echo ! empty ( $testpgodbc ) ? 'checked' : '' ?> > <b>PostgreSQL ODBC</b><br>
2005-09-26 12:12:10 +02:00
< td >
< input type = checkbox name = " testpdopgsql " value = 1 < ? php echo ! empty ( $testpdopgsql ) ? 'checked' : '' ?> > <b>PgSQL PDO</b><br>
< input type = checkbox name = " testpdomysql " value = 1 < ? php echo ! empty ( $testpdomysql ) ? 'checked' : '' ?> > <b>MySQL PDO</b><br>
< input type = checkbox name = " testpdosqlite " value = 1 < ? php echo ! empty ( $testpdosqlite ) ? 'checked' : '' ?> > <b>SQLite PDO</b><br>
< input type = checkbox name = " testpdoaccess " value = 1 < ? php echo ! empty ( $testpdoaccess ) ? 'checked' : '' ?> > <b>Access PDO</b><br>
< input type = checkbox name = " testpdoora " value = 1 < ? php echo ! empty ( $testpdoora ) ? 'checked' : '' ?> > <b>OCI PDO</b><br>
2003-10-19 21:05:23 +02:00
< td >< input type = checkbox name = " testdb2 " value = 1 < ? php echo ! empty ( $testdb2 ) ? 'checked' : '' ?> > DB2<br>
2005-09-26 12:12:10 +02:00
< input type = checkbox name = " testvfp " value = 1 < ? php echo ! empty ( $testvfp ) ? 'checked' : '' ?> > VFP+ODBTP<br>
2003-10-19 21:05:23 +02:00
< input type = checkbox name = " testado " value = 1 < ? php echo ! empty ( $testado ) ? 'checked' : '' ?> > ADO (for mssql and access)<br>
< input type = checkbox name = " nocountrecs " value = 1 < ? php echo ! empty ( $nocountrecs ) ? 'checked' : '' ?> > $ADODB_COUNTRECS=false<br>
< input type = checkbox name = " nolog " value = 1 < ? php echo ! empty ( $nolog ) ? 'checked' : '' ?> > No SQL Logging<br>
2005-09-26 12:12:10 +02:00
< input type = checkbox name = " time " value = 1 < ? php echo ! empty ( $_GET [ 'time' ]) ? 'checked' : '' ?> > ADOdb time test
2003-10-19 21:05:23 +02:00
</ table >
2005-09-26 12:12:10 +02:00
< input type = submit >
</ form >
2003-10-19 21:05:23 +02:00
< ? php
if ( $ADODB_FETCH_MODE != ADODB_FETCH_DEFAULT ) print " <h3>FETCH MODE IS NOT ADODB_FETCH_DEFAULT</h3> " ;
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 " );
2005-09-26 12:12:10 +02:00
//ADOLoadCode("postgres");
//ADOLoadCode("postgres7");
2003-10-19 21:05:23 +02:00
ADOLoadCode ( " firebird " );
ADOLoadCode ( " borland_ibase " );
ADOLoadCode ( " informix " );
ADOLoadCode ( " sqlanywhere " );
2004-07-10 09:19:40 +02:00
// ADOLoadCode('mysqli');
2003-10-19 21:05:23 +02:00
}
flush ();
if ( ! empty ( $testpostgres )) {
//ADOLoadCode("postgres");
$db = & ADONewConnection ( 'postgres' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
2004-08-02 10:30:47 +02:00
if ( $db -> Connect ( " localhost " , " tester " , " test " , " test " )) {
2003-10-19 21:05:23 +02:00
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.<BR> " . $db -> ErrorMsg ();
}
if ( ! empty ( $testpgodbc )) {
$db = & ADONewConnection ( 'odbc' );
$db -> hasTransactions = false ;
print " <h1>Connecting $db->databaseType ...</h1> " ;
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.<BR> " . $db -> ErrorMsg ();
}
if ( ! empty ( $testibase )) {
2004-07-10 09:19:40 +02:00
//$_GET['nolog'] = true;
2003-10-19 21:05:23 +02:00
$db = & ADONewConnection ( 'firebird' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
if ( $db -> PConnect ( " localhost:d: \\ firebird \\ 151 \\ examples \\ EMPLOYEE.fdb " , " sysdba " , " masterkey " , " " ))
2003-10-19 21:05:23 +02:00
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 " . '<BR>' . $db -> ErrorMsg ();
}
if ( ! empty ( $testsqlite )) {
2005-09-26 12:12:10 +02:00
$path = urlencode ( 'd:\inetpub\adodb\sqlite.db' );
$dsn = " sqlite:// $path / " ;
$db = ADONewConnection ( $dsn );
echo $dsn ;
// $db = &ADONewConnection('sqlite');
2003-10-19 21:05:23 +02:00
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
if ( 1 )
//if ($db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", ""))
2003-10-19 21:05:23 +02:00
testdb ( $db , " create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime) " );
else print " ERROR: SQLite " ;
}
2005-09-26 12:12:10 +02:00
if ( ! empty ( $testpdopgsql )) {
$connstr = " pgsql:dbname=test " ;
$u = 'tester' ; $p = 'test' ;
$db = & ADONewConnection ( 'pdo' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
$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 " <h1>Connecting $db->databaseType ...</h1> " ;
$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 " <h1>Connecting $db->databaseType ...</h1> " ;
$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 " <h1>Connecting $db->databaseType ...</h1> " ;
$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 " <h1>Connecting $db->databaseType ...</h1> " ;
$db -> Connect ( $connstr , $u , $p ) || die ( " CONNECT FAILED " );
testdb ( $db ,
" create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) " );
}
2003-10-19 21:05:23 +02:00
// REQUIRES ODBC DSN CALLED nwind
if ( ! empty ( $testaccess )) {
$db = & ADONewConnection ( 'access' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
2004-08-02 10:30:47 +02:00
$access = 'd:\inetpub\wwwroot\php\NWIND.MDB' ;
2003-10-19 21:05:23 +02:00
$dsn = " nwind " ;
2004-08-02 10:30:47 +02:00
$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 , " " , " " , " " ))
2003-10-19 21:05:23 +02:00
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 " <h1>Connecting $db->databaseType ...</h1> " ;
$access = 'd:\inetpub\wwwroot\php\NWIND.MDB' ;
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;'
. 'DATA SOURCE=' . $access . ';' ;
//. 'USER ID=;PASSWORD=;';
2005-09-26 12:12:10 +02:00
$_GET [ 'nolog' ] = 1 ;
2004-08-02 10:30:47 +02:00
if ( $db -> PConnect ( $myDSN , " " , " " , " " )) {
2003-10-19 21:05:23 +02:00
print " ADO version= " . $db -> _connectionID -> version . " <br> " ;
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 " . '<BR>' . $db -> ErrorMsg ();
}
if ( ! empty ( $testvfp )) { // ODBC
$db = & ADONewConnection ( 'vfp' );
print " <h1>Connecting $db->databaseType ...</h1> " ; 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 " ;
2005-09-26 12:12:10 +02:00
echo " <hr> " ;
$db = & ADONewConnection ( 'odbtp' );
if ( $db -> PConnect ( 'localhost' , 'DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;' )) {
print " <h1>Connecting $db->databaseType ...</h1> " ; 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 " ;
2003-10-19 21:05:23 +02:00
}
// REQUIRES MySQL server at localhost with database 'test'
if ( ! empty ( $testmysql )) { // MYSQL
2004-08-02 10:30:47 +02:00
2005-09-26 12:12:10 +02:00
if ( PHP_VERSION >= 5 || $_SERVER [ 'HTTP_HOST' ] == 'localhost' ) $server = 'localhost' ;
2003-10-19 21:05:23 +02:00
else $server = " mangrove " ;
2004-08-02 10:30:47 +02:00
$user = 'root' ; $password = '' ; $database = 'northwind' ;
2005-09-26 12:12:10 +02:00
$db = & ADONewConnection ( " mysqlt:// $user : $password @ $server / $database ?persist " );
2004-08-02 10:30:47 +02:00
print " <h1>Connecting $db->databaseType ...</h1> " ;
if ( true || $db -> PConnect ( $server , " root " , " " , " northwind " )) {
2005-09-26 12:12:10 +02:00
//$db->Execute("DROP TABLE ADOXYZ") || die('fail drop');
2003-10-19 21:05:23 +02:00
//$db->debug=1;$db->Execute('drop table ADOXYZ');
testdb ( $db ,
2005-09-26 12:12:10 +02:00
" create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB " );
2003-10-19 21:05:23 +02:00
} else print " ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test' " . '<BR>' . $db -> ErrorMsg ();
}
2004-07-10 09:19:40 +02:00
// REQUIRES MySQL server at localhost with database 'test'
if ( ! empty ( $testmysqli )) { // MYSQL
$db = & ADONewConnection ( 'mysqli' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
if ( PHP_VERSION >= 5 || $_SERVER [ 'HTTP_HOST' ] == 'localhost' ) $server = 'localhost' ;
2004-07-10 09:19:40 +02:00
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' " . '<BR>' . $db -> ErrorMsg ();
}
2003-10-19 21:05:23 +02:00
// REQUIRES MySQL server at localhost with database 'test'
if ( ! empty ( $testmysqlodbc )) { // MYSQL
$db = & ADONewConnection ( 'odbc' );
$db -> hasTransactions = false ;
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
if ( $_SERVER [ 'HTTP_HOST' ] == 'localhost' ) $server = 'localhost' ;
2003-10-19 21:05:23 +02:00
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' " . '<BR>' . $db -> ErrorMsg ();
}
if ( ! empty ( $testproxy )){
$db = & ADONewConnection ( 'proxy' );
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
if ( $_SERVER [ 'HTTP_HOST' ] == 'localhost' ) $server = 'localhost' ;
2003-10-19 21:05:23 +02:00
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' " . '<BR>' . $db -> ErrorMsg ();
}
ADOLoadCode ( 'oci805' );
ADOLoadCode ( " oci8po " );
2004-08-02 10:30:47 +02:00
if ( ! empty ( $testoracle )) {
2005-09-26 12:12:10 +02:00
$dsn = " oci8po://juris10:natsoft@sherkhan?persist " ;
2004-08-02 10:30:47 +02:00
$db = ADONewConnection ( $dsn );
2003-10-19 21:05:23 +02:00
print " <h1>Connecting $db->databaseType ...</h1> " ;
2004-08-02 10:30:47 +02:00
if ( true || $db -> Connect ( '' , " scott " , " natsoft " , '' ))
2003-10-19 21:05:23 +02:00
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 " . '<BR>' . $db -> ErrorMsg ();
}
ADOLoadCode ( " oracle " ); // no longer supported
if ( false && ! empty ( $testoracle )) {
$db = ADONewConnection ();
print " <h1>Connecting $db->databaseType ...</h1> " ;
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 " . '<BR>' . $db -> ErrorMsg ();
}
ADOLoadCode ( " db2 " ); // no longer supported
if ( ! empty ( $testdb2 )) {
$db = ADONewConnection ();
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
$dsn = " db2_sample " ;
$dsn = " driver= { IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft " ;
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 " . '<BR>' . $db -> ErrorMsg ();
2003-10-19 21:05:23 +02:00
2005-09-26 12:12:10 +02:00
echo " <hr> " ;
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 ();
2003-10-19 21:05:23 +02:00
}
2005-09-26 12:12:10 +02:00
$server = 'sherkhan' ;
2004-03-15 23:17:52 +01:00
ADOLoadCode ( 'odbc_mssql' );
2003-10-19 21:05:23 +02:00
if ( ! empty ( $testmssql )) { // MS SQL Server via ODBC
$db = ADONewConnection ();
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
$dsn = " PROVIDER=MSDASQL;Driver= { SQL Server};Server= $server ;Database=northwind; " ;
2003-10-19 21:05:23 +02:00
2004-08-02 10:30:47 +02:00
if ( $db -> PConnect ( $dsn , " adodb " , " natsoft " , " " )) {
2003-10-19 21:05:23 +02:00
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 " <h1>Connecting DSN-less $db->databaseType ...</h1> " ;
$myDSN = " PROVIDER=MSDASQL;DRIVER= { SQL Server}; "
2005-09-26 12:12:10 +02:00
. " SERVER= $server ;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No " ;
2003-10-19 21:05:23 +02:00
2004-08-02 10:30:47 +02:00
if ( $db -> PConnect ( $myDSN , " " , " " , " " ))
2003-10-19 21:05:23 +02:00
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
2004-03-15 23:17:52 +01:00
$db = ADONewConnection ( " mssqlpo " );
2003-10-19 21:05:23 +02:00
//$db->debug=1;
print " <h1>Connecting $db->databaseType ...</h1> " ;
2005-09-26 12:12:10 +02:00
$ok = $db -> Connect ( '' , 'adodb' , 'natsoft' , 'northwind' );
2004-03-15 23:17:52 +01:00
2004-08-02 10:30:47 +02:00
if ( $ok or $db -> PConnect ( " mangrove " , " sa " , " natsoft " , " ai " )) {
2003-10-19 21:05:23 +02:00
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) " );
2005-09-26 12:12:10 +02:00
} 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 ();
2003-10-19 21:05:23 +02:00
}
if ( ! empty ( $testmssql ) && ! empty ( $testado )) { // ADO ACCESS MSSQL with OLEDB provider
$db = & ADONewConnection ( " ado_mssql " );
print " <h1>Connecting DSN-less OLEDB Provider $db->databaseType ...</h1> " ;
//$db->debug=1;
2005-09-26 12:12:10 +02:00
$myDSN = " SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes " ;
if ( $db -> PConnect ( $myDSN , " adodb " , " natsoft " , 'SQLOLEDB' )) {
2003-10-19 21:05:23 +02:00
testdb ( $db , " create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime) " );
2005-09-26 12:12:10 +02:00
} 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 " <h1>Connecting $db->databaseType ...</h1> " ;
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 " ;
2003-10-19 21:05:23 +02:00
}
print " <h3>Tests Completed</h3> " ;
?>