uw Mon, 28 Sep 2009 10:39:42 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=288892
Log:
Allow setting of default connection flags through the environment variable
MYSQL_TEST_CONNECT_FLAGS
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
U php/php-src/branches/PHP_5_3/ext/mysql/tests/skipifconnectfailure.inc
U php/php-src/trunk/ext/mysql/tests/connect.inc
U php/php-src/trunk/ext/mysql/tests/skipifconnectfailure.inc
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2009-09-28
09:56:21 UTC (rev 288891)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc 2009-09-28
10:39:42 UTC (rev 288892)
@@ -20,14 +20,17 @@
}
/* 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 @@
$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))) ?
Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/skipifconnectfailure.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/skipifconnectfailure.inc
2009-09-28 09:56:21 UTC (rev 288891)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/skipifconnectfailure.inc
2009-09-28 10:39:42 UTC (rev 288892)
@@ -6,7 +6,7 @@
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))
Modified: php/php-src/trunk/ext/mysql/tests/connect.inc
===================================================================
--- php/php-src/trunk/ext/mysql/tests/connect.inc 2009-09-28 09:56:21 UTC
(rev 288891)
+++ php/php-src/trunk/ext/mysql/tests/connect.inc 2009-09-28 10:39:42 UTC
(rev 288892)
@@ -20,14 +20,17 @@
}
/* 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 @@
$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))) ?
Modified: php/php-src/trunk/ext/mysql/tests/skipifconnectfailure.inc
===================================================================
--- php/php-src/trunk/ext/mysql/tests/skipifconnectfailure.inc 2009-09-28
09:56:21 UTC (rev 288891)
+++ php/php-src/trunk/ext/mysql/tests/skipifconnectfailure.inc 2009-09-28
10:39:42 UTC (rev 288892)
@@ -6,7 +6,7 @@
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))
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php