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 {
}
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;
}
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);
'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'),
// 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;
}