uw                                       Thu, 01 Sep 2011 16:35:13 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=315999

Log:
Check for LOAD DATA support during SKIPIF

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt
    U   php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug53503.phpt
    U   php/php-src/trunk/ext/mysqli/tests/bug53503.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt 2011-09-01 
15:45:47 UTC (rev 315998)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug53503.phpt 2011-09-01 
16:35:13 UTC (rev 315999)
@@ -4,6 +4,16 @@
 <?php
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+       die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_support($link, $engine))
+       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
 ?>
 --FILE--
 <?php
@@ -13,19 +23,22 @@
                printf("[001] Connect failed, [%d] %s\n", 
mysqli_connect_errno(), mysqli_connect_error());
        }

-       if (!$link->query("DROP TABLE IF EXISTS tlocaldata")) {
+       if (!$link->query("DROP TABLE IF EXISTS test")) {
                printf("[002] [%d] %s\n", $link->errno, $link->error);
        }

-       if (!$link->query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
+       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
                printf("[003] [%d] %s\n", $link->errno, $link->error);
        }

-       file_put_contents('bug53503.data', "1\n2\n3\n");
+       if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+               printf("[004] Failed to create CVS file\n");

-       $link->query("SELECT 1 FROM DUAL");
+       if (!$link->query("SELECT 1 FROM DUAL"))
+               printf("[005] [%d] %s\n", $link->errno, $link->error);

-       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
tlocaldata")) {
+       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
test")) {
+               printf("[006] [%d] %s\n", $link->errno, $link->error);
                echo "bug";
        } else {
                echo "done";
@@ -41,7 +54,7 @@
                $host, $user, $db, $port, $socket);
 }

-if (!$link->query($link, 'DROP TABLE IF EXISTS tlocaldata')) {
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
        printf("[clean] Failed to drop old test table: [%d] %s\n", 
mysqli_errno($link), mysqli_error($link));
 }


Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug53503.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug53503.phpt 2011-09-01 
15:45:47 UTC (rev 315998)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug53503.phpt 2011-09-01 
16:35:13 UTC (rev 315999)
@@ -4,6 +4,16 @@
 <?php
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+       die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_support($link, $engine))
+       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
 ?>
 --FILE--
 <?php
@@ -13,19 +23,22 @@
                printf("[001] Connect failed, [%d] %s\n", 
mysqli_connect_errno(), mysqli_connect_error());
        }

-       if (!$link->query("DROP TABLE IF EXISTS tlocaldata")) {
+       if (!$link->query("DROP TABLE IF EXISTS test")) {
                printf("[002] [%d] %s\n", $link->errno, $link->error);
        }

-       if (!$link->query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
+       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
                printf("[003] [%d] %s\n", $link->errno, $link->error);
        }

-       file_put_contents('bug53503.data', "1\n2\n3\n");
+       if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+               printf("[004] Failed to create CVS file\n");

-       $link->query("SELECT 1 FROM DUAL");
+       if (!$link->query("SELECT 1 FROM DUAL"))
+               printf("[005] [%d] %s\n", $link->errno, $link->error);

-       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
tlocaldata")) {
+       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
test")) {
+               printf("[006] [%d] %s\n", $link->errno, $link->error);
                echo "bug";
        } else {
                echo "done";
@@ -41,7 +54,7 @@
                $host, $user, $db, $port, $socket);
 }

-if (!$link->query($link, 'DROP TABLE IF EXISTS tlocaldata')) {
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
        printf("[clean] Failed to drop old test table: [%d] %s\n", 
mysqli_errno($link), mysqli_error($link));
 }


Modified: php/php-src/trunk/ext/mysqli/tests/bug53503.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug53503.phpt    2011-09-01 15:45:47 UTC 
(rev 315998)
+++ php/php-src/trunk/ext/mysqli/tests/bug53503.phpt    2011-09-01 16:35:13 UTC 
(rev 315999)
@@ -4,6 +4,16 @@
 <?php
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
+
+if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+       die("skip Cannot connect to MySQL");
+
+include_once("local_infile_tools.inc");
+if ($msg = check_local_infile_support($link, $engine))
+       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+
+mysqli_close($link);
+
 ?>
 --FILE--
 <?php
@@ -13,19 +23,22 @@
                printf("[001] Connect failed, [%d] %s\n", 
mysqli_connect_errno(), mysqli_connect_error());
        }

-       if (!$link->query("DROP TABLE IF EXISTS tlocaldata")) {
+       if (!$link->query("DROP TABLE IF EXISTS test")) {
                printf("[002] [%d] %s\n", $link->errno, $link->error);
        }

-       if (!$link->query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
+       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL 
PRIMARY KEY) ENGINE=" . $engine)) {
                printf("[003] [%d] %s\n", $link->errno, $link->error);
        }

-       file_put_contents('bug53503.data', "1\n2\n3\n");
+       if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+               printf("[004] Failed to create CVS file\n");

-       $link->query("SELECT 1 FROM DUAL");
+       if (!$link->query("SELECT 1 FROM DUAL"))
+               printf("[005] [%d] %s\n", $link->errno, $link->error);

-       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
tlocaldata")) {
+       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE 
test")) {
+               printf("[006] [%d] %s\n", $link->errno, $link->error);
                echo "bug";
        } else {
                echo "done";
@@ -41,7 +54,7 @@
                $host, $user, $db, $port, $socket);
 }

-if (!$link->query($link, 'DROP TABLE IF EXISTS tlocaldata')) {
+if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
        printf("[clean] Failed to drop old test table: [%d] %s\n", 
mysqli_errno($link), mysqli_error($link));
 }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to