003.phpt
来自「php-4.4.7学习linux时下载的源代码」· PHPT 代码 · 共 107 行
PHPT
107 行
--TEST--dbx_connect--SKIPIF--<?php include_once("skipif.inc");?>--FILE--<?php include_once("dbx_test.p");$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); }$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); }$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_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); }$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) { print('persistent 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, $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); }$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); }$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 okconnect using constant okconnect to non-existing database failed, so it's okconnect with false username/password combi failed, so it's okpersistent connect using string okpersistent connect using constant okpersistent connect to non-existing database failed, so it's okpersistent connect with false username/password combi failed, so it's oktoo many parameters: connect failure works oktoo few parameters: connect failure works okmultiple connects okmultiple connects (2nd fails on database-name) ok
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?