uw                                       Tue, 08 Jun 2010 15:47:51 +0000

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

Log:
Make the tests pass with sql strict mode enabled

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_array.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_field.phpt
    U   php/php-src/trunk/ext/mysql/tests/mysql_fetch_array.phpt
    U   php/php-src/trunk/ext/mysql/tests/mysql_fetch_field.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_array.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_array.phpt 
2010-06-08 15:13:25 UTC (rev 300281)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_array.phpt 
2010-06-08 15:47:51 UTC (rev 300282)
@@ -50,7 +50,7 @@
 if (!$res = mysql_query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C", $link)) {
        printf("[012] Cannot run query, [%d] %s\n",
                mysql_errno($link), $mysql_error($link));
-exit(1);
+       exit(1);
 }

 do {
@@ -76,7 +76,6 @@
        }

        if (!mysql_query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, 
label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine), $link)) {
-               print $sql;
                // don't bail, engine might not support the datatype
                return false;
        }
@@ -225,11 +224,11 @@
 func_mysql_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
 func_mysql_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);

-$string65k = func_mysql_fetch_array_make_string(65535);
+$string65k = func_mysql_fetch_array_make_string(65400);

 func_mysql_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
 func_mysql_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 
590);
-func_mysql_fetch_array($link, $engine, "VARCHAR(65635)", $string65k, 
$string65k, 600);
+func_mysql_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, 
$string65k, 600);
 func_mysql_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
 func_mysql_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);


Modified: php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_field.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_field.phpt 
2010-06-08 15:13:25 UTC (rev 300281)
+++ php/php-src/branches/PHP_5_3/ext/mysql/tests/mysql_fetch_field.phpt 
2010-06-08 15:47:51 UTC (rev 300282)
@@ -51,6 +51,7 @@
                'BIT'               => array(1, 'int'),
                'TINYINT'           => array(1, 'int'),
                'BOOL'              => array('true', 'int'),
+               'BOOL'              => array(1, 'int'),
                'SMALLINT'          => array(32767, 'int'),
                'MEDIUMINT'         => array(8388607, 'int'),
                'INT'               => array(100, 'int'),
@@ -86,7 +87,17 @@
                        // server and/or engine might not support the data type
                        continue;
                }
-               if (!mysql_query(sprintf("INSERT INTO test(id, label) VALUES 
(1, '%s')", $type_desc[0]), $link)) {
+
+               if (is_string($type_desc[0]))
+                       $insert = sprintf("INSERT INTO test(id, label) VALUES 
(1, '%s')", $type_desc[0]);
+               else
+                       $insert = sprintf("INSERT INTO test(id, label) VALUES 
(1, %s)", $type_desc[0]);
+
+               if (!mysql_query($insert, $link)) {
+                       if (1366 == mysql_errno($link)) {
+                               /* Strict SQL mode - 1366, Incorrect integer 
value: 'true' for column 'label' at row 1 */
+                               continue;
+                       }
                        printf("[009/%s] [%d] %s\n", $type_name, 
mysql_errno($link), mysql_error($link));
                        continue;
                }

Modified: php/php-src/trunk/ext/mysql/tests/mysql_fetch_array.phpt
===================================================================
--- php/php-src/trunk/ext/mysql/tests/mysql_fetch_array.phpt    2010-06-08 
15:13:25 UTC (rev 300281)
+++ php/php-src/trunk/ext/mysql/tests/mysql_fetch_array.phpt    2010-06-08 
15:47:51 UTC (rev 300282)
@@ -50,7 +50,7 @@
 if (!$res = mysql_query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C", $link)) {
        printf("[012] Cannot run query, [%d] %s\n",
                mysql_errno($link), $mysql_error($link));
-exit(1);
+       exit(1);
 }

 do {
@@ -76,7 +76,6 @@
        }

        if (!mysql_query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, 
label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine), $link)) {
-               print $sql;
                // don't bail, engine might not support the datatype
                return false;
        }
@@ -225,11 +224,11 @@
 func_mysql_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
 func_mysql_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);

-$string65k = func_mysql_fetch_array_make_string(65535);
+$string65k = func_mysql_fetch_array_make_string(65400);

 func_mysql_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
 func_mysql_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 
590);
-func_mysql_fetch_array($link, $engine, "VARCHAR(65635)", $string65k, 
$string65k, 600);
+func_mysql_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, 
$string65k, 600);
 func_mysql_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
 func_mysql_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);


Modified: php/php-src/trunk/ext/mysql/tests/mysql_fetch_field.phpt
===================================================================
--- php/php-src/trunk/ext/mysql/tests/mysql_fetch_field.phpt    2010-06-08 
15:13:25 UTC (rev 300281)
+++ php/php-src/trunk/ext/mysql/tests/mysql_fetch_field.phpt    2010-06-08 
15:47:51 UTC (rev 300282)
@@ -51,6 +51,7 @@
                'BIT'               => array(1, 'int'),
                'TINYINT'           => array(1, 'int'),
                'BOOL'              => array('true', 'int'),
+               'BOOL'              => array(1, 'int'),
                'SMALLINT'          => array(32767, 'int'),
                'MEDIUMINT'         => array(8388607, 'int'),
                'INT'               => array(100, 'int'),
@@ -86,7 +87,17 @@
                        // server and/or engine might not support the data type
                        continue;
                }
-               if (!mysql_query(sprintf("INSERT INTO test(id, label) VALUES 
(1, '%s')", $type_desc[0]), $link)) {
+
+               if (is_string($type_desc[0]))
+                       $insert = sprintf("INSERT INTO test(id, label) VALUES 
(1, '%s')", $type_desc[0]);
+               else
+                       $insert = sprintf("INSERT INTO test(id, label) VALUES 
(1, %s)", $type_desc[0]);
+
+               if (!mysql_query($insert, $link)) {
+                       if (1366 == mysql_errno($link)) {
+                               /* Strict SQL mode - 1366, Incorrect integer 
value: 'true' for column 'label' at row 1 */
+                               continue;
+                       }
                        printf("[009/%s] [%d] %s\n", $type_name, 
mysql_errno($link), mysql_error($link));
                        continue;
                }

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

Reply via email to