From ea3ef35f195c2a764bd95a31dff63fc2419a7f94 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Thu, 5 Nov 2009 11:51:21 +0000 Subject: [PATCH] Fixing test: it didn't do a select_db and gave a false-positive with libmysql --- ext/mysql/tests/connect.inc | 14 ++++++++++---- ext/mysql/tests/mysql_pconn_disable.phpt | 16 ++++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc index 45c41167a0f..b5cc03ecb47 100755 --- a/ext/mysql/tests/connect.inc +++ b/ext/mysql/tests/connect.inc @@ -21,7 +21,7 @@ if (!function_exists('sys_get_temp_dir')) { if (!function_exists('my_mysql_connect')) { /* wrapper to simplify test porting */ - function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) { + function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL, $persistent = false) { global $connect_flags; $flags = ($flags === NULL) ? $connect_flags : $flags; @@ -31,9 +31,15 @@ if (!function_exists('my_mysql_connect')) { else if ($port) $host = sprintf("%s:%s", $host, $port); - if (!$link = mysql_connect($host, $user, $passwd, true, $flags)) { - printf("[000-a] Cannot connect using host '%s', user '%s', password '****', [%d] %s\n", - $host, $user, $passwd, + if ($persistent) { + $link = mysql_pconnect($host, $user, $passwd, $flags); + } else { + $link = mysql_connect($host, $user, $passwd, true, $flags); + } + + if (!$link) { + printf("[000-a] Cannot connect using host '%s', user '%s', password '****', persistent = %d, [%d] %s\n", + $host, $user, ($persistent) ? 1 : 0, mysql_errno(), mysql_error()); return false; } diff --git a/ext/mysql/tests/mysql_pconn_disable.phpt b/ext/mysql/tests/mysql_pconn_disable.phpt index dfb04eeef19..532e2e57885 100644 --- a/ext/mysql/tests/mysql_pconn_disable.phpt +++ b/ext/mysql/tests/mysql_pconn_disable.phpt @@ -13,19 +13,11 @@ mysql.max_links=2