diff options
author | Ulf Wendel <uw@php.net> | 2009-09-28 10:39:42 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2009-09-28 10:39:42 +0000 |
commit | fbfd13310b4953ff960f51a37554727c63992f33 (patch) | |
tree | e37284ca026ba120ee49e5fef00a0326d263a442 | |
parent | 5edef9d2ddc5f618a38fa45f9f82b6c25f0c2ab1 (diff) | |
download | php-git-fbfd13310b4953ff960f51a37554727c63992f33.tar.gz |
Allow setting of default connection flags through the environment variable MYSQL_TEST_CONNECT_FLAGS
-rwxr-xr-x | ext/mysql/tests/connect.inc | 8 | ||||
-rwxr-xr-x | ext/mysql/tests/skipifconnectfailure.inc | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc index 70017b9e26..86c0ee6748 100755 --- a/ext/mysql/tests/connect.inc +++ b/ext/mysql/tests/connect.inc @@ -20,14 +20,17 @@ if (!function_exists('sys_get_temp_dir')) { } /* wrapper to simplify test porting */ -function my_mysql_connect($host, $user, $passwd, $db, $port, $socket) { +function my_mysql_connect($host, $user, $passwd, $db, $port, $socket, $flags = NULL) { + global $connect_flags; + + $flags = ($flags === NULL) ? $connect_flags : $flags; if ($socket) $host = sprintf("%s:%s", $host, $socket); else if ($port) $host = sprintf("%s:%s", $host, $port); - if (!$link = mysql_connect($host, $user, $passwd, true)) { + 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, mysql_errno(), mysql_error()); @@ -55,6 +58,7 @@ $db = getenv("MYSQL_TEST_DB") ? getenv("MYSQL_TEST_DB") : "test"; $engine = getenv("MYSQL_TEST_ENGINE") ? getenv("MYSQL_TEST_ENGINE") : "MyISAM"; $socket = getenv("MYSQL_TEST_SOCKET") ? getenv("MYSQL_TEST_SOCKET") : null; $skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ? getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") : true; +$connect_flags = getenv("MYSQL_TEST_CONNECT_FLAGS") ? (int)getenv("MYSQL_TEST_CONNECT_FLAGS") : 0; /* Development setting: test experimal features and/or feature requests that never worked before? */ $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ? diff --git a/ext/mysql/tests/skipifconnectfailure.inc b/ext/mysql/tests/skipifconnectfailure.inc index e586a33f3b..a57c7dbd58 100755 --- a/ext/mysql/tests/skipifconnectfailure.inc +++ b/ext/mysql/tests/skipifconnectfailure.inc @@ -6,7 +6,7 @@ if ($skip_on_connect_failure) { else if ($port) $myhost = sprintf("%s:%s", $host, $port); - if (!$link = @mysql_connect($myhost, $user, $passwd, true)) + if (!$link = @mysql_connect($myhost, $user, $passwd, true, $connect_flags)) die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysql_errno(), mysql_error())); if (!@mysql_select_db($db, $link)) |