summaryrefslogtreecommitdiff
path: root/ext/mysql
diff options
context:
space:
mode:
authorUlf Wendel <uw@php.net>2010-06-08 15:47:51 +0000
committerUlf Wendel <uw@php.net>2010-06-08 15:47:51 +0000
commit20f6aaeca9cddf57e9aa9e9fab6856a3764e6791 (patch)
treef8250ef09c24acc0efd9649b4edb8a2d7163c1d8 /ext/mysql
parentaeae0d1bad1cab9261dbfa8397db3131a4a852b9 (diff)
downloadphp-git-20f6aaeca9cddf57e9aa9e9fab6856a3764e6791.tar.gz
Make the tests pass with sql strict mode enabled
Diffstat (limited to 'ext/mysql')
-rw-r--r--ext/mysql/tests/mysql_fetch_array.phpt7
-rw-r--r--ext/mysql/tests/mysql_fetch_field.phpt13
2 files changed, 15 insertions, 5 deletions
diff --git a/ext/mysql/tests/mysql_fetch_array.phpt b/ext/mysql/tests/mysql_fetch_array.phpt
index 635e6d1097..362cf99ddc 100644
--- a/ext/mysql/tests/mysql_fetch_array.phpt
+++ b/ext/mysql/tests/mysql_fetch_array.phpt
@@ -50,7 +50,7 @@ mysql_free_result($res);
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 @@ function func_mysql_fetch_array($link, $engine, $sql_type, $sql_value, $php_valu
}
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(255)", $string255, $string255, 550
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);
diff --git a/ext/mysql/tests/mysql_fetch_field.phpt b/ext/mysql/tests/mysql_fetch_field.phpt
index 65c44edc5e..ef03279087 100644
--- a/ext/mysql/tests/mysql_fetch_field.phpt
+++ b/ext/mysql/tests/mysql_fetch_field.phpt
@@ -51,6 +51,7 @@ require_once('skipifconnectfailure.inc');
'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 @@ require_once('skipifconnectfailure.inc');
// 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;
}