summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/mysqli_fetch_array.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/tests/mysqli_fetch_array.phpt')
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array.phpt54
1 files changed, 27 insertions, 27 deletions
diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt
index cff314166..aa19ff6eb 100644
--- a/ext/mysqli/tests/mysqli_fetch_array.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array.phpt
@@ -77,26 +77,28 @@ require_once('skipifconnectfailure.inc');
}
if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- print $sql;
- // don't bail, engine might not support the datatype
- return false;
- }
-
- if (is_null($php_value) && !mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
+ // don't bail, engine might not support the datatype
+ return false;
}
- if (!is_null($php_value)) {
- if (is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- } else if (!is_int($sql_value) && !mysqli_query($link, sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $sql_value))) {
+ if (is_null($php_value)) {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
return false;
}
+ } else {
+ if (is_string($sql_value)) {
+ if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql);
+ return false;
+ }
+ } else {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
}
-
if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
return false;
@@ -107,8 +109,6 @@ require_once('skipifconnectfailure.inc');
return false;
}
-
-
if ($regexp_comparison) {
if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
@@ -179,31 +179,31 @@ require_once('skipifconnectfailure.inc');
func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", 4294967295, "4294967295", 230);
+ func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
if ($IS_MYSQLND ||
((mysqli_get_server_version($link) >= 51000) &&
(mysqli_get_client_version($link) >= 51000))) {
- func_mysqli_fetch_array($link, $engine, "BIGINT", -9223372036854775808, "-9223372036854775808", 250);
+ func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", 18446744073709551615, "18446744073709551615", 260);
+ func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260);
func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
}
- func_mysqli_fetch_array($link, $engine, "FLOAT", -9223372036854775808 - 1.1, "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", 18446744073709551615 + 1.1, "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", -99999999.99, "-99999999.99", 330);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", 99999999.99, "99999999.99", 350);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", -99999999.99, "-99999999.99", 370);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", 99999999.99, "99999999.99", 390);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
// don't care about date() strict TZ warnings...
@@ -233,10 +233,10 @@ require_once('skipifconnectfailure.inc');
func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
- $string65k = func_mysqli_fetch_array_make_string(65535);
+ $string65k = func_mysqli_fetch_array_make_string(65400);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(65635)", $string65k, $string65k, 600);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);