From 67faaa1cae6ba8083fbc2eaa2e1ec9bcfbf4fc90 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Thu, 1 Sep 2011 15:45:47 +0000 Subject: [PATCH] Fixing error handling. Skip if load data is not allowed --- ext/mysql/tests/bug53649.phpt | 36 ++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/ext/mysql/tests/bug53649.phpt b/ext/mysql/tests/bug53649.phpt index 126f34b738..70bf9bed36 100644 --- a/ext/mysql/tests/bug53649.phpt +++ b/ext/mysql/tests/bug53649.phpt @@ -4,28 +4,46 @@ Bug #53649 (mysql_query with "load data" unable to save result set) --FILE-- errno, $link->error); + if (!mysql_query("DROP TABLE IF EXISTS test", $link)) { + printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link)); } - if (!mysql_query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link)) { - printf("[003] [%d] %s\n", $link->errno, $link->error); + if (!mysql_query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link)) { + printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); } - file_put_contents('bug53649.data', "1\n2\n3\n"); + if (false === file_put_contents('bug53649.data', "1\n2\n3\n")) + printf("[004] Failed to create data file\n"); - mysql_query("SELECT 1 FROM DUAL", $link); + if (!mysql_query("SELECT 1 FROM DUAL", $link)) + printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link)); - if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE tlocaldata", $link)) { + if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE test", $link)) { + printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); echo "bug"; } else { echo "done"; @@ -41,7 +59,7 @@ if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) { $host, $user, $db, $port, $socket); } -if (!mysql_query($link, 'DROP TABLE IF EXISTS tlocaldata', $link)) { +if (!mysql_query($link, 'DROP TABLE IF EXISTS test', $link)) { printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } -- 2.50.1