summaryrefslogtreecommitdiff
path: root/ext/dbx/tests
diff options
context:
space:
mode:
authorMarc Boeren <mboeren@php.net>2001-06-13 13:35:17 +0000
committerMarc Boeren <mboeren@php.net>2001-06-13 13:35:17 +0000
commitbfd1f986b173d62a3e3a455b71073f7a97ee9c51 (patch)
tree4e5e4719bae0994340499c46789828fa07273375 /ext/dbx/tests
parentf3fa23ace99c3c32ea670ddf2960e5dbf6f370c7 (diff)
downloadphp-git-bfd1f986b173d62a3e3a455b71073f7a97ee9c51.tar.gz
Latest (minor) fixes: mssql, mysql and odbc now pass the testset correctly.
# I need a working setup to test pgsql with the test-set as well.
Diffstat (limited to 'ext/dbx/tests')
-rw-r--r--ext/dbx/tests/003.phpt5
-rw-r--r--ext/dbx/tests/006.phpt19
-rw-r--r--ext/dbx/tests/dbx_test.p41
3 files changed, 54 insertions, 11 deletions
diff --git a/ext/dbx/tests/003.phpt b/ext/dbx/tests/003.phpt
index 2c5a8ec762..03eec20ddf 100644
--- a/ext/dbx/tests/003.phpt
+++ b/ext/dbx/tests/003.phpt
@@ -7,7 +7,6 @@ dbx_connect
--FILE--
<?php
include_once("ext/dbx/tests/dbx_test.p");
-$module_name="mysql";
$nonexisting_database="nonexisting_database";
$nonexisting_username="nonexisting_username";
$nonexisting_password="nonexisting_password";
@@ -87,9 +86,9 @@ if ($dlo1!=0 && $dlo2!=0) {
dbx_close($dlo2);
}
$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = dbx_connect($module, $host, $nonexisting_database, $username, $password);
+$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
if ($dlo1!=0 && $dlo2==0) {
- print('multiple connects (2nd fails on database-name) ok'."\n");
+ print('multiple connects (2nd fails on database-name) ok'."\n");
dbx_close($dlo1);
}
?>
diff --git a/ext/dbx/tests/006.phpt b/ext/dbx/tests/006.phpt
index cf4d118511..cfe1e48b97 100644
--- a/ext/dbx/tests/006.phpt
+++ b/ext/dbx/tests/006.phpt
@@ -7,6 +7,16 @@ dbx_error
--FILE--
<?php
include_once("ext/dbx/tests/dbx_test.p");
+if ($module==DBX_ODBC) {
+ // ODBC module doesn't have an error-message-function (yet?)
+ print('query generated an error: dbx_error works ok'."\n");
+ print('query is valid: dbx_error works ok'."\n");
+ print('wrong dbx_link_object: dbx_error failure works ok'."\n");
+ print('too many parameters: dbx_error failure works ok'."\n");
+ print('too few parameters: dbx_error failure works ok'."\n");
+ }
+else {
+
$sql_statement = "select * from tbl";
$invalid_sql_statement = "invalid select * from tbl";
$dlo = dbx_connect($module, $host, $database, $username, $password);
@@ -14,12 +24,13 @@ if (!$dlo) {
print('this won\'t work'."\n");
}
else {
- dbx_query($dlo, "select nonexistingfield from tbl");
- if (strlen(dbx_error($dlo))) {
+ @dbx_query($dlo, "select nonexistingfield from tbl");
+ if (($module==DBX_MSSQL && dbx_error($dlo)!="Changed database context to '".$database."'.")
+ || strlen(dbx_error($dlo))) {
print('query generated an error: dbx_error works ok'."\n");
}
dbx_query($dlo, "select description from tbl");
- if (!strlen(dbx_error($dlo))) {
+ if (!strlen(dbx_error($dlo)) || ($module==DBX_MSSQL && dbx_error($dlo)=="Changed database context to '".$database."'.")) {
print('query is valid: dbx_error works ok'."\n");
}
if (!@dbx_error(0)) {
@@ -33,6 +44,8 @@ else {
}
dbx_close($dlo);
}
+
+ }
?>
--EXPECT--
query generated an error: dbx_error works ok
diff --git a/ext/dbx/tests/dbx_test.p b/ext/dbx/tests/dbx_test.p
index f639b93f78..d2193be246 100644
--- a/ext/dbx/tests/dbx_test.p
+++ b/ext/dbx/tests/dbx_test.p
@@ -1,7 +1,38 @@
<?php
-$module=DBX_MYSQL;
-$host="";
-$database="dbx_test";
-$username="dbx_testuser";
-$password="dbx_testpassword";
+$connection = DBX_MYSQL;
+switch ($connection) {
+ case DBX_MYSQL:
+ $module=DBX_MYSQL;
+ $host="";
+ $database="dbx_test";
+ $username="dbx_testuser";
+ $password="dbx_testpassword";
+ $module_name="mysql";
+ break;
+ case DBX_MSSQL:
+ $module=DBX_MSSQL;
+ $host="HOLLY";
+ $database="dbx_test";
+ $username="";
+ $password="";
+ $module_name="mssql";
+ break;
+ case DBX_ODBC:
+ $module=DBX_ODBC;
+ $host="localhost";
+ $database="dbx_test_mysql"; // "dbx_test_access";
+ $username="dbx_testuser";
+ $password="dbx_testpassword";
+ $module_name="odbc";
+ break;
+ case DBX_PGSQL:
+ $module=DBX_PGSQL;
+ $host="";
+ $database="dbx_test";
+ $username="";
+ $password="";
+ $module_name="pgsql";
+ break;
+ }
+
?> \ No newline at end of file