summaryrefslogtreecommitdiff
path: root/ext/dbx/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dbx/tests')
-rw-r--r--ext/dbx/tests/002.phpt1
-rw-r--r--ext/dbx/tests/003.phpt84
-rw-r--r--ext/dbx/tests/004.phpt2
-rw-r--r--ext/dbx/tests/006.phpt1
-rw-r--r--ext/dbx/tests/dbx_test.p8
5 files changed, 72 insertions, 24 deletions
diff --git a/ext/dbx/tests/002.phpt b/ext/dbx/tests/002.phpt
index cf51901cb9..f3ec8eeef3 100644
--- a/ext/dbx/tests/002.phpt
+++ b/ext/dbx/tests/002.phpt
@@ -11,6 +11,7 @@ if (DBX_MSSQL=="DBX_MSSQL") print('!DBX_MSSQL');
if (DBX_FBSQL=="DBX_FBSQL") print('!DBX_FBSQL');
if (DBX_OCI8=="DBX_OCI8") print('!DBX_OCI8');
if (DBX_SYBASECT=="DBX_SYBASECT") print('!DBX_SYBASECT');
+if (DBX_SQLITE=="DBX_SQLITE") print('!DBX_SQLITE');
if (DBX_PERSISTENT=="DBX_PERSISTENT") print('!DBX_PERSISTENT');
if (DBX_RESULT_INFO=="DBX_RESULT_INFO") print('!DBX_RESULT_INFO');
if (DBX_RESULT_INDEX=="DBX_RESULT_INDEX") print('!DBX_RESULT_INDEX');
diff --git a/ext/dbx/tests/003.phpt b/ext/dbx/tests/003.phpt
index 76fda4caf2..01c05f6e8c 100644
--- a/ext/dbx/tests/003.phpt
+++ b/ext/dbx/tests/003.phpt
@@ -20,39 +20,62 @@ if ($dlo!=0) {
print('connect using constant ok'."\n");
dbx_close($dlo);
}
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo==0) {
- print('connect to non-existing database failed, so it\'s ok'."\n");
- }
+// sqlite is a special case as it will just create a db if it isn't found
+if ($module == DBX_SQLITE) {
+ print('connect to non-existing database failed, so it\'s ok'."\n");
+ }
else {
- print_r($dlo);
- dbx_close($dlo);
+ $dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
+ if ($dlo==0) {
+ print('connect to non-existing database failed, so it\'s ok'."\n");
+ }
+ else {
+ print_r($dlo);
+ dbx_close($dlo);
+ }
+ }
+// sqlite is a special case as it doesn't use user/password restrictions
+if ($module == DBX_SQLITE) {
+ print('connect with false username/password combi failed, so it\'s ok'."\n");
}
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password);
-if ($dlo==0) {
- print('connect with false username/password combi failed, so it\'s ok'."\n");
- }
else {
- print_r($dlo);
- dbx_close($dlo);
+ $dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password);
+ if ($dlo==0) {
+ print('connect with false username/password combi failed, so it\'s ok'."\n");
+ }
+ else {
+ print_r($dlo);
+ dbx_close($dlo);
+ }
}
+
+if ($module != DBX_SQLITE) { // skip persistent tests for sqlite until that bug is solved
+
$dlo = dbx_connect($module_name, $host, $database, $username, $password, DBX_PERSISTENT);
if ($dlo!=0) {
print('persistent connect using string ok'."\n");
+ var_dump($dlo->handle);
dbx_close($dlo);
}
$dlo = dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT);
if ($dlo!=0) {
print('persistent connect using constant ok'."\n");
+ var_dump($dlo->handle);
dbx_close($dlo);
}
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password, DBX_PERSISTENT);
-if ($dlo==0) {
- print('persistent connect to non-existing database failed, so it\'s ok'."\n");
- }
+// sqlite is a special case as it will just create a db if it isn't found
+if ($module == DBX_SQLITE) {
+ print('persistent connect to non-existing database failed, so it\'s ok'."\n");
+ }
else {
- print_r($dlo);
- dbx_close($dlo);
+ $dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password, DBX_PERSISTENT);
+ if ($dlo==0) {
+ print('persistent connect to non-existing database failed, so it\'s ok'."\n");
+ }
+ else {
+ print_r($dlo);
+ dbx_close($dlo);
+ }
}
$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password, DBX_PERSISTENT);
if ($dlo==0) {
@@ -62,6 +85,15 @@ else {
print_r($dlo);
dbx_close($dlo);
}
+
+} // skip persistent tests for sqlite until that bug is solved
+else {
+ print('persistent connect using string ok'."\n");
+ print('persistent connect using constant ok'."\n");
+ print('persistent connect to non-existing database failed, so it\'s ok'."\n");
+ print('persistent connect with false username/password combi failed, so it\'s ok'."\n");
+}
+
$dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, "12many");
if ($dlo==0) {
print('too many parameters: connect failure works ok'."\n");
@@ -85,12 +117,18 @@ if ($dlo1!=0 && $dlo2!=0) {
dbx_close($dlo1);
dbx_close($dlo2);
}
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo1!=0 && $dlo2==0) {
+// sqlite is a special case as it will just create a db if it isn't found
+if ($module == DBX_SQLITE) {
print('multiple connects (2nd fails on database-name) ok'."\n");
- dbx_close($dlo1);
- }
+ }
+else {
+ $dlo1 = dbx_connect($module, $host, $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");
+ dbx_close($dlo1);
+ }
+ }
?>
--EXPECT--
connect using string ok
diff --git a/ext/dbx/tests/004.phpt b/ext/dbx/tests/004.phpt
index 404e7de3eb..233bf49be1 100644
--- a/ext/dbx/tests/004.phpt
+++ b/ext/dbx/tests/004.phpt
@@ -8,7 +8,7 @@ include_once("skipif.inc");
<?php
include_once("dbx_test.p");
$dlo = dbx_connect($module, $host, $database, $username, $password);
-if ($module===DBX_OCI8) { // close for oci8 always return NULL since it doesn't do anything
+if ($module===DBX_OCI8 || $module===DBX_SQLITE) { // close for oci8 and sqlite always return NULL since it doesn't do anything
print('close works ok'."\n");
}
else {
diff --git a/ext/dbx/tests/006.phpt b/ext/dbx/tests/006.phpt
index 13b8b677f7..e5aa925a97 100644
--- a/ext/dbx/tests/006.phpt
+++ b/ext/dbx/tests/006.phpt
@@ -34,6 +34,7 @@ else {
if (!strlen(dbx_error($dlo)) || (($module==DBX_MSSQL || $module==DBX_SYBASECT) && dbx_error($dlo)=="Changed database context to '".$database."'.".($module==DBX_SYBASECT?"\n":""))) {
print('query is valid: dbx_error works ok'."\n");
}
+ else print(dbx_error($dlo));
if (!@dbx_error(0)) {
print('wrong dbx_link_object: dbx_error failure works ok'."\n");
}
diff --git a/ext/dbx/tests/dbx_test.p b/ext/dbx/tests/dbx_test.p
index 67f2546b24..00fe1f2e37 100644
--- a/ext/dbx/tests/dbx_test.p
+++ b/ext/dbx/tests/dbx_test.p
@@ -60,6 +60,14 @@ switch ($connection) {
$password="dbx_testpassword";
$module_name="sybase_ct";
break;
+ case DBX_SQLITE:
+ $module=DBX_SQLITE;
+ $host="";
+ $database="ext\\dbx\\tests\\dbx_test.sqlite.db";
+ $username="";
+ $password="";
+ $module_name="sqlite";
+ break;
}
?> \ No newline at end of file