2001-06-05 13:51:01 +00:00
|
|
|
--TEST--
|
|
|
|
dbx_connect
|
|
|
|
--SKIPIF--
|
2002-10-07 09:27:02 +00:00
|
|
|
<?php
|
2002-10-24 19:34:18 +00:00
|
|
|
include_once("skipif.inc");
|
2002-10-07 09:27:02 +00:00
|
|
|
?>
|
2001-06-05 13:51:01 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2002-10-07 09:27:02 +00:00
|
|
|
include_once("dbx_test.p");
|
2001-06-05 13:51:01 +00:00
|
|
|
$nonexisting_database="nonexisting_database";
|
|
|
|
$nonexisting_username="nonexisting_username";
|
|
|
|
$nonexisting_password="nonexisting_password";
|
|
|
|
$dlo = dbx_connect($module_name, $host, $database, $username, $password);
|
|
|
|
if ($dlo!=0) {
|
|
|
|
print('connect using string ok'."\n");
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
|
|
|
$dlo = dbx_connect($module, $host, $database, $username, $password);
|
|
|
|
if ($dlo!=0) {
|
|
|
|
print('connect using constant ok'."\n");
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
// 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");
|
|
|
|
}
|
2001-06-05 13:51:01 +00:00
|
|
|
else {
|
2003-07-09 16:31:40 +00:00
|
|
|
$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");
|
2001-06-05 13:51:01 +00:00
|
|
|
}
|
|
|
|
else {
|
2003-07-09 16:31:40 +00:00
|
|
|
$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);
|
|
|
|
}
|
2001-06-05 13:51:01 +00:00
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
|
2001-06-05 13:51:01 +00:00
|
|
|
$dlo = dbx_connect($module_name, $host, $database, $username, $password, DBX_PERSISTENT);
|
|
|
|
if ($dlo!=0) {
|
|
|
|
print('persistent connect using string ok'."\n");
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
|
|
|
$dlo = dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT);
|
|
|
|
if ($dlo!=0) {
|
|
|
|
print('persistent connect using constant ok'."\n");
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
// 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");
|
|
|
|
}
|
2001-06-05 13:51:01 +00:00
|
|
|
else {
|
2003-07-09 16:31:40 +00:00
|
|
|
$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);
|
|
|
|
}
|
2001-06-05 13:51:01 +00:00
|
|
|
}
|
2003-08-13 07:54:31 +00:00
|
|
|
// sqlite is a special case as it doesn't use user/password restrictions
|
|
|
|
if ($module == DBX_SQLITE) {
|
|
|
|
print('persistent connect with false username/password combi failed, so it\'s ok'."\n");
|
2001-06-05 13:51:01 +00:00
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
else {
|
2003-08-13 07:54:31 +00:00
|
|
|
$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password, DBX_PERSISTENT);
|
|
|
|
if ($dlo==0) {
|
|
|
|
print('persistent connect with false username/password combi failed, so it\'s ok'."\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_r($dlo);
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
|
2001-06-05 13:51:01 +00:00
|
|
|
$dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, "12many");
|
|
|
|
if ($dlo==0) {
|
|
|
|
print('too many parameters: connect failure works ok'."\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_r($dlo);
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
|
|
|
$dlo = @dbx_connect($module, $host, $database, $username);
|
|
|
|
if ($dlo==0) {
|
|
|
|
print('too few parameters: connect failure works ok'."\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print_r($dlo);
|
|
|
|
dbx_close($dlo);
|
|
|
|
}
|
2001-06-12 15:32:22 +00:00
|
|
|
$dlo1 = dbx_connect($module, $host, $database, $username, $password);
|
|
|
|
$dlo2 = dbx_connect($module, $host, $database, $username, $password);
|
|
|
|
if ($dlo1!=0 && $dlo2!=0) {
|
|
|
|
print('multiple connects ok'."\n");
|
|
|
|
dbx_close($dlo1);
|
|
|
|
dbx_close($dlo2);
|
|
|
|
}
|
2003-07-09 16:31:40 +00:00
|
|
|
// sqlite is a special case as it will just create a db if it isn't found
|
|
|
|
if ($module == DBX_SQLITE) {
|
2001-06-13 13:35:17 +00:00
|
|
|
print('multiple connects (2nd fails on database-name) ok'."\n");
|
2003-07-09 16:31:40 +00:00
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2001-06-05 13:51:01 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
connect using string ok
|
|
|
|
connect using constant ok
|
|
|
|
connect to non-existing database failed, so it's ok
|
|
|
|
connect with false username/password combi failed, so it's ok
|
|
|
|
persistent connect using string ok
|
|
|
|
persistent connect using constant ok
|
|
|
|
persistent connect to non-existing database failed, so it's ok
|
|
|
|
persistent connect with false username/password combi failed, so it's ok
|
|
|
|
too many parameters: connect failure works ok
|
2001-06-12 15:32:22 +00:00
|
|
|
too few parameters: connect failure works ok
|
|
|
|
multiple connects ok
|
|
|
|
multiple connects (2nd fails on database-name) ok
|