From 8f617842f318c46b13ad561fac2884a67ffd515d Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Tue, 7 Jul 2009 11:31:45 +0000 Subject: Fixing tests to run with SQL_MODE=ANSI_QUOTES as well. --- ext/mysql/tests/connect.inc | 2 +- ext/mysql/tests/mysql_affected_rows.phpt | 6 +++--- ext/mysql/tests/mysql_field_flags.phpt | 10 +++++----- ext/mysql/tests/mysql_info.phpt | 6 +++--- ext/mysql/tests/mysql_query.phpt | 8 ++++---- ext/mysql/tests/mysql_unbuffered_query.phpt | 6 +++--- ext/mysql/tests/skipif.inc | 2 +- ext/mysql/tests/table.inc | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc index 86bf7a9acd..70017b9e26 100755 --- a/ext/mysql/tests/connect.inc +++ b/ext/mysql/tests/connect.inc @@ -62,4 +62,4 @@ $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) false; $IS_MYSQLND = stristr(mysql_get_client_info(), "mysqlnd"); -?> +?> \ No newline at end of file diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt index ecf0b5d855..3001bf14ce 100644 --- a/ext/mysql/tests/mysql_affected_rows.phpt +++ b/ext/mysql/tests/mysql_affected_rows.phpt @@ -35,18 +35,18 @@ if (!mysql_query('DROP TABLE IF EXISTS test', $link)) if (!mysql_query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine, $link)) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); -if (!mysql_query('INSERT INTO test(id, label) VALUES (1, "a")', $link)) +if (!mysql_query("INSERT INTO test(id, label) VALUES (1, 'a')", $link)) printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (1 !== ($tmp = mysql_affected_rows($link))) printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented -@mysql_query('INSERT INTO test(id, label) VALUES (1, "a")', $link); +@mysql_query("INSERT INTO test(id, label) VALUES (1, 'a')", $link); if (-1 !== ($tmp = mysql_affected_rows($link))) printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp); -if (!mysql_query('INSERT INTO test(id, label) VALUES (1, "a") ON DUPLICATE KEY UPDATE id = 4', $link)) +if (!mysql_query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4", $link)) printf("[012] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (2 !== ($tmp = mysql_affected_rows($link))) diff --git a/ext/mysql/tests/mysql_field_flags.phpt b/ext/mysql/tests/mysql_field_flags.phpt index 75872182ff..6489affc16 100644 --- a/ext/mysql/tests/mysql_field_flags.phpt +++ b/ext/mysql/tests/mysql_field_flags.phpt @@ -53,11 +53,11 @@ $tables = array( 'label' => array(($version < 500) ? 'multiple_key' : 'unique_key') ), 'labela INT, label2 CHAR(1), KEY keyname (labela, label2)' => array( - array('labela, label2', '1, "a"'), + array('labela, label2', "1, 'a'"), 'labela' => array('multiple_key'), ), 'label1 BLOB' => array( - array('label1', '"blob"'), + array('label1', "'blob'"), 'label1' => array('blob', 'binary'), ), 'label1 INT UNSIGNED' => array( @@ -70,15 +70,15 @@ $tables = array( 'unsigned'), ), 'label1 ENUM("a", "b")' => array( - array('label1', '"a"'), + array('label1', "'a'"), 'label1' => array('enum'), ), 'label1 SET("a", "b")' => array( - array('label1', '"a"'), + array('label1', "'a'"), 'label1' => array('set'), ), 'label1 TIMESTAMP' => array( - array('label1', sprintf('"%s"', @date("Y-m-d H:i:s"))), + array('label1', sprintf("'%s'", @date("Y-m-d H:i:s"))), 'label1' => array( 'timestamp', 'unsigned', diff --git a/ext/mysql/tests/mysql_info.phpt b/ext/mysql/tests/mysql_info.phpt index 757c7fac81..464578c8a5 100644 --- a/ext/mysql/tests/mysql_info.phpt +++ b/ext/mysql/tests/mysql_info.phpt @@ -16,13 +16,13 @@ if (NULL !== ($tmp = @mysql_info(NULL))) printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); require "table.inc"; -if (!$res = mysql_query('INSERT INTO test(id, label) VALUES (100, "a")', $link)) +if (!$res = mysql_query("INSERT INTO test(id, label) VALUES (100, 'a')", $link)) printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (false !== ($tmp = mysql_info($link))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); -if (!$res = mysql_query('INSERT INTO test(id, label) VALUES (101, "a"), (102, "b")', $link)) +if (!$res = mysql_query("INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')", $link)) printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) @@ -40,7 +40,7 @@ if (!$res = mysql_query('ALTER TABLE test MODIFY label CHAR(2)', $link)) if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); -if (!$res = mysql_query('UPDATE test SET label = "b" WHERE id >= 100', $link)) +if (!$res = mysql_query("UPDATE test SET label = 'b' WHERE id >= 100", $link)) printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) diff --git a/ext/mysql/tests/mysql_query.phpt b/ext/mysql/tests/mysql_query.phpt index 9bfca97b6f..a5978a6c11 100644 --- a/ext/mysql/tests/mysql_query.phpt +++ b/ext/mysql/tests/mysql_query.phpt @@ -26,26 +26,26 @@ if (NULL !== ($tmp = @mysql_query("SELECT 1 AS a", $link, "foo"))) if (false !== ($tmp = mysql_query('THIS IS NOT SQL', $link))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); -if (false !== ($tmp = mysql_query('SELECT "this is sql but with backslash g"\g', $link))) +if (false !== ($tmp = mysql_query("SELECT 'this is sql but with backslash g'\g", $link))) printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if ((0 === mysql_errno($link)) || ('' == mysql_error($link))) printf("[006] mysql_errno()/mysql_error should return some error\n"); -if (!$res = mysql_query('SELECT "this is sql but with semicolon" AS valid ; ', $link)) +if (!$res = mysql_query("SELECT 'this is sql but with semicolon' AS valid ; ", $link)) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); -if (!$res = mysql_query('SELECT "a" AS ""', $link)) +if (!$res = mysql_query("SELECT 'a' AS ''", $link)) printf("[007a] [%d] %s\n", mysql_errno($link), mysql_error($link)); var_dump($tmp = mysql_fetch_assoc($res)); var_dump($tmp[""]); mysql_free_result($res); -if (false !== ($res = mysql_query('SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES', $link))) +if (false !== ($res = mysql_query("SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES", $link))) printf("[008] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (mysql_query('DROP PROCEDURE IF EXISTS p', $link)) { diff --git a/ext/mysql/tests/mysql_unbuffered_query.phpt b/ext/mysql/tests/mysql_unbuffered_query.phpt index b234f2008d..ad9b4fbc52 100644 --- a/ext/mysql/tests/mysql_unbuffered_query.phpt +++ b/ext/mysql/tests/mysql_unbuffered_query.phpt @@ -23,19 +23,19 @@ if (NULL !== ($tmp = @mysql_unbuffered_query("SELECT 1 AS a", $link, "foo"))) if (false !== ($tmp = mysql_unbuffered_query('THIS IS NOT SQL', $link))) printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); -if (false !== ($tmp = mysql_unbuffered_query('SELECT "this is sql but with backslash g"\g', $link))) +if (false !== ($tmp = mysql_unbuffered_query("SELECT 'this is sql but with backslash g'\g", $link))) printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); if ((0 === mysql_errno($link)) || ('' == mysql_error($link))) printf("[005] mysql_errno()/mysql_error should return some error\n"); -if (!$res = mysql_unbuffered_query('SELECT "this is sql but with semicolon" AS valid ; ', $link)) +if (!$res = mysql_unbuffered_query("SELECT 'this is sql but with semicolon' AS valid ; ", $link)) printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); var_dump(mysql_fetch_assoc($res)); mysql_free_result($res); -if (false !== ($res = mysql_unbuffered_query('SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES', $link))) +if (false !== ($res = mysql_unbuffered_query("SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES", $link))) printf("[007] [%d] %s\n", mysql_errno($link), mysql_error($link)); if (mysql_unbuffered_query('DROP PROCEDURE IF EXISTS p', $link)) { diff --git a/ext/mysql/tests/skipif.inc b/ext/mysql/tests/skipif.inc index ab720c2d3d..0f932892ca 100755 --- a/ext/mysql/tests/skipif.inc +++ b/ext/mysql/tests/skipif.inc @@ -1,6 +1,6 @@ diff --git a/ext/mysql/tests/table.inc b/ext/mysql/tests/table.inc index ddfbe430c0..b5cacc2fe9 100644 --- a/ext/mysql/tests/table.inc +++ b/ext/mysql/tests/table.inc @@ -18,7 +18,7 @@ if (!mysql_query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGI exit(1); } -if (!mysql_query('INSERT INTO test(id, label) VALUES (1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e"), (6, "f")', $link)) { +if (!mysql_query("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')", $link)) { printf("[%d] %s\n", mysql_errno($link), mysql_error($link)); } ?> \ No newline at end of file -- cgit v1.2.1