]> granicus.if.org Git - php/commitdiff
MFH. Fixing tests to run with SQL_MODE=ANSI_QUOTES as well.
authorUlf Wendel <uw@php.net>
Tue, 7 Jul 2009 11:32:17 +0000 (11:32 +0000)
committerUlf Wendel <uw@php.net>
Tue, 7 Jul 2009 11:32:17 +0000 (11:32 +0000)
ext/mysql/tests/mysql_affected_rows.phpt
ext/mysql/tests/mysql_field_flags.phpt
ext/mysql/tests/mysql_info.phpt
ext/mysql/tests/mysql_query.phpt
ext/mysql/tests/mysql_unbuffered_query.phpt
ext/mysql/tests/table.inc

index ecf0b5d855d4b2d5f92199dde385b70f28e475b0..3001bf14ce8af92db5b0c6986edc460c282a1180 100644 (file)
@@ -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)))
index 75872182ff1210ae7c2ecaf9a7e83bec8aba3474..6489affc16e6a2c936962e76164606127885f50c 100644 (file)
@@ -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',
index 757c7fac818078d06829a22e1fab2a6afa69f07a..464578c8a568a4e31405ced3faa1591918335007 100644 (file)
@@ -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))
index 9bfca97b6f54c7ca99e16cefb48c6c82859d9824..a5978a6c11817dc1c79e0e929b7ab1429939c22c 100644 (file)
@@ -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)) {
index b234f2008d14b24ef21b091e3c47d9a8208cd699..ad9b4fbc5240a20ea2fcadade15b793ccec12327 100644 (file)
@@ -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)) {
index ddfbe430c063ebf9e508f7c0f54fd948c7426959..b5cacc2fe964e86d923f79b11cfd054c46c64615 100644 (file)
@@ -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