📄 testdatabases.inc.php
字号:
} else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; 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"; }// 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 "<h1>Connecting $db->databaseType...</h1>"; 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'".'<BR>'.$db->ErrorMsg();}// REQUIRES MySQL server at localhost with database 'test'if (!empty($testmysqli)) { // MYSQL $db = &ADONewConnection('mysqli'); print "<h1>Connecting $db->databaseType...</h1>"; 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'".'<BR>'.$db->ErrorMsg();}// REQUIRES MySQL server at localhost with database 'test'if (!empty($testmysqlodbc)) { // MYSQL $db = &ADONewConnection('odbc'); $db->hasTransactions = false; print "<h1>Connecting $db->databaseType...</h1>"; 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'".'<BR>'.$db->ErrorMsg();}if (!empty($testproxy)){ $db = &ADONewConnection('proxy'); print "<h1>Connecting $db->databaseType...</h1>"; 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'".'<BR>'.$db->ErrorMsg();}ADOLoadCode('oci805');ADOLoadCode("oci8po"); if (!empty($testoracle)) { $dsn = "oci8po://juris10:natsoft@sherkhan?persist"; $db = ADONewConnection($dsn );//'oci8'); //$db->debug=1; print "<h1>Connecting $db->databaseType...</h1>"; if (true || $db->Connect('', "scott", "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".'<BR>'.$db->ErrorMsg();}ADOLoadCode("oracle"); // no longer supportedif (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("odbc_db2"); // no longer supportedif (!empty($testdb2)) { if (PHP_VERSION>=5.1) { $db = ADONewConnection("db2"); print "<h1>Connecting $db->databaseType...</h1>"; #$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".'<BR>'.$db->ErrorMsg(); } else { $db = ADONewConnection("odbc_db2"); print "<h1>Connecting $db->databaseType...</h1>"; $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".'<BR>'.$db->ErrorMsg(); }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();}$server = 'sherkhan';ADOLoadCode("mssqlpo");if (!empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC $db = ADONewConnection("mssqlpo"); //$db->debug=1; print "<h1>Connecting $db->databaseType...</h1>"; $ok = $db->Connect('','adodb','natsoft','northwind'); 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='192.168.0.1', userid='adodb', password='natsoft', database='ai'".'<BR>'.$db->ErrorMsg(); }ADOLoadCode('odbc_mssql');if (!empty($testmssql)) { // MS SQL Server via ODBC $db = ADONewConnection(); print "<h1>Connecting $db->databaseType...</h1>"; $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;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 "<h1>Connecting DSN-less $db->databaseType...</h1>"; $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 "<h1>Connecting DSN-less OLEDB Provider $db->databaseType...</h1>"; //$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 "<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";}print "<h3>Tests Completed</h3>";?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -