summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pdo_mysql/tests/bug_42499.phpt4
-rw-r--r--ext/pdo_mysql/tests/bug_pecl_12925.phpt6
-rw-r--r--ext/pdo_mysql/tests/mysql_pdo_test.inc4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt10
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt6
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_commit.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec.phpt18
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt12
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt6
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt8
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_rollback.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt6
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt13
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt15
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_types.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt9
30 files changed, 98 insertions, 79 deletions
diff --git a/ext/pdo_mysql/tests/bug_42499.phpt b/ext/pdo_mysql/tests/bug_42499.phpt
index dece019a9f..4ce497ebf9 100644
--- a/ext/pdo_mysql/tests/bug_42499.phpt
+++ b/ext/pdo_mysql/tests/bug_42499.phpt
@@ -27,7 +27,7 @@ $db = MySQLPDOTest::factory();
function bug_42499($db) {
$db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ("a")');
+ $db->exec("CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ('a')");
$stmt = $db->query('SELECT id AS _id FROM test');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
@@ -35,7 +35,7 @@ function bug_42499($db) {
// You must not use exec() to run statements that create a result set!
$db->exec('SELECT id FROM test');
// This will bail at you because you have not fetched the SELECT results: this is not a bug!
- $db->exec('INSERT INTO test(id) VALUES ("b")');
+ $db->exec("INSERT INTO test(id) VALUES ('b')");
}
diff --git a/ext/pdo_mysql/tests/bug_pecl_12925.phpt b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
index 1867868ecb..dc6933d4b9 100644
--- a/ext/pdo_mysql/tests/bug_pecl_12925.phpt
+++ b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
@@ -17,10 +17,10 @@ function bug_pecl_1295($db) {
$db->exec('DROP TABLE IF EXISTS test');
$db->exec('CREATE TABLE test(id CHAR(1))');
- $db->exec('INSERT INTO test(id) VALUES ("a")');
- $stmt = $db->prepare('UPDATE test SET id = "b"');
+ $db->exec("INSERT INTO test(id) VALUES ('a')");
+ $stmt = $db->prepare("UPDATE test SET id = 'b'");
$stmt->execute();
- $stmt = $db->prepare('UPDATE test SET id = "c"');
+ $stmt = $db->prepare("UPDATE test SET id = 'c'");
$stmt->execute();
$stmt = $db->prepare('SELECT id FROM test');
$stmt->execute();
diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc
index 7367919338..01c4cb9aaf 100644
--- a/ext/pdo_mysql/tests/mysql_pdo_test.inc
+++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc
@@ -38,7 +38,7 @@ class MySQLPDOTest extends PDOTest {
$db->exec('DROP TABLE IF EXISTS test');
$db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine);
- $db->exec('INSERT INTO test(id, label) VALUES (1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e"), (6, "f")');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')");
}
static function getTableEngine() {
@@ -159,7 +159,7 @@ class MySQLPDOTest extends PDOTest {
}
static function dropTestTable($db = NULL) {
- if (is_null($db))
+ if (is_null($db))
$db = self::factory();
$db->exec('DROP TABLE IF EXISTS test');
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
index b1e5507f67..9a73f1b296 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
@@ -57,7 +57,7 @@ $db = MySQLPDOTest::factory();
$row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
$num = $row['_num'];
- $db->query('INSERT INTO test(id, label) VALUES (100, "z")');
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
$num++;
$row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
if ($row['_num'] != $num)
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
index 618d9e65e4..8ce8af4a85 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
@@ -26,7 +26,7 @@ $db = MySQLPDOTest::factory();
var_dump($known[$default]);
// lets see what the default is...
- if (!is_object($stmt = $db->query('SELECT id, id AS "ID_UPPER", label FROM test ORDER BY id ASC LIMIT 2')))
+ if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label FROM test ORDER BY id ASC LIMIT 2")))
printf("[002] %s - %s\n",
var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
@@ -48,7 +48,7 @@ $db = MySQLPDOTest::factory();
printf("[006] Cannot add column %s - %s\n",
var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (!is_object($stmt = $db->query('SELECT id, id AS "ID_UPPER", label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2')))
+ if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2")))
printf("[007] %s - %s\n",
var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
@@ -62,7 +62,7 @@ $db = MySQLPDOTest::factory();
printf("[009] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
var_export($tmp, true));
- if (!is_object($stmt = $db->query('SELECT id, label, MiXeD, MYUPPER, MYUPPER AS "lower" FROM test ORDER BY id ASC LIMIT 1')))
+ if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, MYUPPER AS 'lower' FROM test ORDER BY id ASC LIMIT 1")))
printf("[010] %s - %s\n",
var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
@@ -76,12 +76,12 @@ $db = MySQLPDOTest::factory();
printf("[012] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
var_export($tmp, true));
- if (!is_object($stmt = $db->query('SELECT id, label, MiXeD, MYUPPER, id AS "ID" FROM test ORDER BY id ASC LIMIT 1')))
+ if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, id AS 'ID' FROM test ORDER BY id ASC LIMIT 1")))
printf("[013] %s - %s\n",
var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
-
+
print "done!";
?>
--CLEAN--
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
index cdc0b26431..182080440b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
@@ -24,11 +24,11 @@ MySQLPDOTest::skip();
printf("[003] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
- $stmt = $db->query('SELECT NULL AS z, "" AS a, " " AS b, TRIM(" ") as c, " d" AS d, "' . chr(0) . ' e" AS e');
+ $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 0);
- $stmt = $db->query('SELECT NULL AS z, "" AS a, " " AS b, TRIM(" ") as c, " d" AS d, "' . chr(0) . ' e" AS e');
+ $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
@@ -43,7 +43,7 @@ MySQLPDOTest::skip();
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) &&
- (false !== $db->exec('CREATE PROCEDURE p() BEGIN SELECT NULL as z, "" AS a, " " AS b, TRIM(" ") as c, " d" AS d, " e" AS e; END;'))) {
+ (false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) {
// requires MySQL 5+
$stmt = $db->prepare('CALL p()');
$stmt->execute();
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
index 558ab232eb..3c21d0f321 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
@@ -27,7 +27,7 @@ $db = MySQLPDOTest::factory();
printf("[003] Did we change it from '%s' to '%s'?\n", $info, $info);
// lets hope we always run this in the same second as we did run the server info request...
- if (!$stmt = $db->query('SHOW STATUS LIKE "%uptime%"'))
+ if (!$stmt = $db->query("SHOW STATUS LIKE '%uptime%'"))
printf("[004] Cannot run SHOW STATUS, [%s]\n", $db->errorCode());
else {
if (!$row = $stmt->fetch(PDO::FETCH_NUM))
diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
index 8871a3170a..ac9f8a3114 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
@@ -59,7 +59,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
if (!$db->beginTransaction())
printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $db->exec(sprintf('INSERT INTO test(id, label) VALUES (%d, "z")', $row['id']));
+ $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id']));
if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
@@ -166,7 +166,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
printf("[035] Cannot start a transaction, [%s] [%s]\n",
$db->errorCode(), implode(' ', $db->errorInfo()));
- if (0 == $db->exec('INSERT INTO test(id, label) VALUES (1, "a")'))
+ if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')"))
printf("[036] Cannot insert data, [%s] [%s]\n",
$db->errorCode(), implode(' ', $db->errorInfo()));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
index e213f66ea9..f3cd530f2f 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
@@ -37,7 +37,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
if (true !== ($tmp = $db->beginTransaction()))
printf("[004] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- $db->exec('INSERT INTO test(id, label) VALUES (100, "z")');
+ $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
if (true !== ($tmp = $db->commit()))
printf("[005] No commit allowed? [%s] %s\n",
@@ -59,7 +59,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
if (true !== ($tmp = $db->beginTransaction()))
printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- $db->exec('INSERT INTO test(id, label) VALUES (100, "z")');
+ $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
if (true !== ($tmp = $db->commit()))
printf("[008] No commit allowed? [%s] %s\n",
$db->errorCode(), implode(' ', $db->errorInfo()));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
index 381a2b51df..2a0f527180 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
@@ -38,14 +38,14 @@ MySQLPDOTest::skip();
exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(4, $db, 'INSERT INTO test(id, col1) VALUES (1, "a")', 1);
- exec_and_count(5, $db, 'INSERT INTO test(id, col1) VALUES (2, "b"), (3, "c")', 2);
- exec_and_count(6, $db, 'UPDATE test SET id = 4 WHERE id = 3', 1);
- exec_and_count(7, $db, 'INSERT INTO test(id, col1) VALUES (1, "d") ON DUPLICATE KEY UPDATE id = 3', 2);
- exec_and_count(8, $db, 'UPDATE test SET id = 5 WHERE id = 5', 0);
- exec_and_count(9, $db, 'INSERT INTO test(id, col1) VALUES (5, "e") ON DUPLICATE KEY UPDATE id = 6', 1);
- exec_and_count(10, $db, 'REPLACE INTO test(id, col1) VALUES (5, "f")', 2);
- exec_and_count(11, $db, 'REPLACE INTO test(id, col1) VALUES (6, "g")', 1);
+ exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
+ exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2);
+ exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1);
+ exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3", 2);
+ exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0);
+ exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6", 1);
+ exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2);
+ exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1);
exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4);
exec_and_count(13, $db, 'DROP TABLE test', 0);
exec_and_count(14, $db, 'SET @myvar = 1', 0);
@@ -54,7 +54,7 @@ MySQLPDOTest::skip();
printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(37, $db, 'INSERT INTO test(id, col1) VALUES (1, "a")', 1);
+ exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
// Results may vary. Typically you will get 1. But the MySQL 5.1 manual states: Truncation operations do not return the number of deleted rows.
// Don't rely on any return value!
exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL);
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
index 1310c0e643..37de557527 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
@@ -57,7 +57,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- $stmt = $db->query('SHOW VARIABLES LIKE "secure_file_priv"');
+ $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
} else {
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
index ef85fabe6f..d0e0ffcba7 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
@@ -38,19 +38,19 @@ MySQLPDOTest::skip();
exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(4, $db, 'INSERT INTO test(id, col1) VALUES (1, "a")', 1);
+ exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
// question is: will the result set be cleaned up, will it be possible to run more queries on the line?
// buffered or unbuffered does not matter!
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
exec_and_count(5, $db, 'SELECT id FROM test', 0);
- exec_and_count(6, $db, 'INSERT INTO test(id, col1) VALUES (2, "b")', 1);
+ exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1);
} catch (PDOException $e) {
printf("[001] %s, [%s] %s\n",
$e->getMessage(),
$db->errorCode(), implode(' ', $db->errorInfo()));
}
-
+
print "done!";
?>
--CLEAN--
@@ -61,5 +61,5 @@ $db = MySQLPDOTest::factory();
?>
--EXPECTF--
Warning: PDO::exec(): SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in %s on line %d
-[006] Expecting '1'/integer got ''/boolean when running 'INSERT INTO test(id, col1) VALUES (2, "b")', [HY000] HY000 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
+[006] Expecting '1'/integer got ''/boolean when running 'INSERT INTO test(id, col1) VALUES (2, 'b')', [HY000] HY000 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
done! \ No newline at end of file
diff --git a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
index 2bb5573f3b..313b20d189 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
@@ -34,7 +34,7 @@ $db = MySQLPDOTest::factory();
printf("[005] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
// no auto increment column
- $db->exec('INSERT INTO test(id, col1) VALUES (100, "a")');
+ $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
if ('0' !== ($tmp = $db->lastInsertId()))
printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
@@ -43,17 +43,17 @@ $db = MySQLPDOTest::factory();
printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
// duplicate key
- @$db->exec('INSERT INTO test(id, col1) VALUES (100, "a")');
+ @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
if ('0' !== ($tmp = $db->lastInsertId()))
printf("[007] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
- $db->exec('INSERT INTO test(id, col1) VALUES (101, "b")');
+ $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')");
if ('101' !== ($tmp = $db->lastInsertId()))
printf("[008] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
$db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE');
// replace = delete + insert -> new auto increment value
- $db->exec('REPLACE INTO test(col1) VALUES ("b")');
+ $db->exec("REPLACE INTO test(col1) VALUES ('b')");
$next_id = (int)$db->lastInsertId();
if ($next_id <= 101)
@@ -67,7 +67,7 @@ $db = MySQLPDOTest::factory();
$last_id, $next_id);
}
- $db->exec('INSERT INTO test(col1) VALUES ("c"), ("d"), ("e")');
+ $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')");
$next_id = (int)$db->lastInsertId();
if ($next_id <= $last_id)
printf("[011] Expecting at least %d, got %d\n", $last_id + 1, $next_id);
@@ -91,7 +91,7 @@ $db = MySQLPDOTest::factory();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$last_id = $row['_last_id'];
- $db->exec('INSERT INTO test(col1) VALUES ("z")');
+ $db->exec("INSERT INTO test(col1) VALUES ('z')");
$next_id = (int)$db->lastInsertId();
if ($next_id < ($last_id + $inc))
printf("[012] Expecting at least %d, got %d\n", $last_id + $inc, $next_id);
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
index 4447146eef..b2db0d9eed 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
@@ -98,12 +98,12 @@ $db = MySQLPDOTest::factory();
prepex(5, $db, 'DROP TABLE IF EXISTS test');
prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(7, $db, 'INSERT INTO test(id, label) VALUES(1, ":placeholder")');
+ prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
$stmt = prepex(8, $db, 'SELECT label FROM test');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
prepex(9, $db, 'DELETE FROM test');
- prepex(10, $db, 'INSERT INTO test(id, label) VALUES(1, ":placeholder")',
+ prepex(10, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')",
array(':placeholder' => 'first row'));
$stmt = prepex(11, $db, 'SELECT label FROM test');
@@ -200,12 +200,12 @@ $db = MySQLPDOTest::factory();
// and now, the same with anonymous placeholders...
prepex(45, $db, 'DROP TABLE IF EXISTS test');
prepex(46, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(47, $db, 'INSERT INTO test(id, label) VALUES(1, "?")');
+ prepex(47, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
$stmt = prepex(48, $db, 'SELECT label FROM test');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
prepex(49, $db, 'DELETE FROM test');
- prepex(50, $db, 'INSERT INTO test(id, label) VALUES(1, "?")',
+ prepex(50, $db, "INSERT INTO test(id, label) VALUES(1, '?')",
array('first row'));
$stmt = prepex(51, $db, 'SELECT label FROM test');
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
index c382025ba7..c6b299e076 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
@@ -20,7 +20,7 @@ $db = MySQLPDOTest::factory();
$db->exec('DROP TABLE IF EXISTS test');
$db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES(1, "?")');
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
// you can bind as many values as you want no matter if they can be replaced or not
$stmt->execute(array('first row'));
if ('00000' !== $stmt->errorCode())
@@ -39,7 +39,7 @@ $db = MySQLPDOTest::factory();
printf("[004] Unable to switch off emulated prepared statements, test will fail\n");
$db->exec('DELETE FROM test');
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES(1, "?")');
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
// you can bind as many values as you want no matter if they can be replaced or not
$stmt->execute(array('first row'));
if ('00000' !== $stmt->errorCode())
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
index e8f7d39840..3a77d5eee1 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
@@ -20,7 +20,7 @@ MySQLPDOTest::skip();
$db->exec('DROP TABLE IF EXISTS test');
$db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $db->exec('INSERT INTO test(id, label) VALUES (1, "row1")');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
// So, what will happen? More placeholder but values and
// placeholders in interesting places...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
index b8b77ff5db..37d9cbdb77 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
@@ -60,7 +60,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- $stmt = $db->query('SHOW VARIABLES LIKE "secure_file_priv"');
+ $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
$filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
} else {
@@ -82,7 +82,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
}
// Check the line
- $stmt = $db->query('SELECT 1 as "one"');
+ $stmt = $db->query("SELECT 1 as 'one'");
if ($stmt->errorCode() != '0000') {
printf("[005] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
} else {
@@ -100,7 +100,7 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1'))
implode(' ', $db->errorInfo()),
(isset($stmt)) ? implode(' ', $stmt->errorInfo()) : 'N/A');
}
-
+
print "done!";
?>
--CLEAN--
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
index b9027c8980..43006c6d58 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
@@ -119,7 +119,7 @@ $db = MySQLPDOTest::factory();
prepex(5, $db, 'DROP TABLE IF EXISTS test');
prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(7, $db, 'INSERT INTO test(id, label) VALUES(1, ":placeholder")');
+ prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
$stmt = prepex(8, $db, 'SELECT label FROM test ORDER BY id ASC');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
@@ -183,8 +183,8 @@ $db = MySQLPDOTest::factory();
}
$db->exec('DELETE FROM test');
- $db->exec('INSERT INTO test(id, label) VALUES (1, "row1")');
- $db->exec('INSERT INTO test(id, label) VALUES (2, "row2")');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
+ $db->exec("INSERT INTO test(id, label) VALUES (2, 'row2')");
$sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)",
$db->quote('%ro%'));
@@ -201,7 +201,7 @@ $db = MySQLPDOTest::factory();
// and now, the same with anonymous placeholders...
prepex(33, $db, 'DROP TABLE IF EXISTS test');
prepex(34, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(35, $db, 'INSERT INTO test(id, label) VALUES(1, "?")');
+ prepex(35, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
$stmt = prepex(36, $db, 'SELECT label FROM test');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
index 8c367af249..42c3d074ad 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
@@ -23,7 +23,7 @@ $db = MySQLPDOTest::factory();
printf("[002] Unable to turn on emulated prepared statements\n");
// INSERT a single row
- $db->exec('INSERT INTO test(id, label) VALUES (1, "row1")');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
$stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC');
$stmt->execute(array(':placeholder' => 0));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
index c9d122a813..e382dff375 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
@@ -60,7 +60,7 @@ $db = MySQLPDOTest::factory();
//
$db->exec('DELETE FROM test');
- $db->exec('INSERT INTO test (id, label1, label2) VALUES (1, "row1", "row2")');
+ $db->exec("INSERT INTO test (id, label1, label2) VALUES (1, 'row1', 'row2')");
$sql = "SELECT id, label1 FROM test WHERE id = :placeholder AND label1 = (SELECT label1 AS 'SELECT' FROM test WHERE id = :placeholder)";
// emulated...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
index c4a74eadfa..530170d576 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
@@ -22,7 +22,7 @@ $db = MySQLPDOTest::factory();
printf("[002] Unable to turn off emulated prepared statements\n");
// INSERT a single row
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (100, ":placeholder")');
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES (100, ':placeholder')");
// Yes, there is no placeholder to bind to and named placeholder
// do not work with MySQL native PS, but lets see what happens!
@@ -45,7 +45,7 @@ $db = MySQLPDOTest::factory();
printf("[004] Unable to turn on emulated prepared statements\n");
// Note that the "named placeholder" is enclosed by double quotes.
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES(101, ":placeholder")');
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(101, ':placeholder')");
// No replacement shall be made
$stmt->execute(array(':placeholder' => 'row1'));
// Again, I'd like to see an error message
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
index 0f8c8880e3..dbff9c4b95 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
@@ -18,7 +18,7 @@ $db = MySQLPDOTest::factory();
$db->exec('DROP TABLE IF EXISTS test');
$db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $db->exec('INSERT INTO test(id, label) VALUES (1, "row1")');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
$stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC');
$stmt->execute(array('id', 'label', 'label'));
diff --git a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
index 193b1a159c..c0737b2ecc 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
@@ -20,7 +20,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
$row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
$num = $row['_num'];
- $db->query('INSERT INTO test(id, label) VALUES (100, "z")');
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
$num++;
$row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
if ($row['_num'] != $num)
@@ -33,7 +33,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
printf("[002] ROLLBACK has failed\n");
$db->beginTransaction();
- $db->query('INSERT INTO test(id, label) VALUES (100, "z")');
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
$db->query('DROP TABLE IF EXISTS test2');
$db->query('CREATE TABLE test2(id INT)');
$num++;
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
index 85985dde89..54b433f3cc 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
@@ -22,7 +22,7 @@ $db = MySQLPDOTest::factory();
if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
printf("[002] Unable to turn on emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id, label, "?" as foo FROM test');
+ $stmt = $db->prepare("SELECT id, label, '?' as foo FROM test");
$stmt->execute();
var_dump($stmt->columnCount());
@@ -40,7 +40,7 @@ $db = MySQLPDOTest::factory();
if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
printf("[004] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id, label, "?" as foo, "TODO - Stored Procedure" as bar FROM test');
+ $stmt = $db->prepare("SELECT id, label, '?' as foo, 'TODO - Stored Procedure' as bar FROM test");
$stmt->execute();
var_dump($stmt->columnCount());
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
index 928e90de62..fa4b122ef2 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
@@ -70,7 +70,7 @@ MySQLPDOTest::skip();
printf("[011] Unable to turn off emulated prepared statements\n");
$native_support = 'no';
- if ($db->exec('PREPARE mystmt FROM "DESCRIBE test id"')) {
+ if ($db->exec("PREPARE mystmt FROM 'DESCRIBE test id'")) {
$native_support = 'yes';
$db->exec('DEALLOCATE PREPARE mystmt');
}
@@ -104,7 +104,7 @@ MySQLPDOTest::skip();
$native_support = 'no';
- if ($db->exec('PREPARE mystmt FROM "SHOW ENGINES"')) {
+ if ($db->exec("PREPARE mystmt FROM 'SHOW ENGINES'")) {
$native_support = 'yes';
$db->exec('DEALLOCATE PREPARE mystmt');
}
@@ -137,7 +137,7 @@ MySQLPDOTest::skip();
var_export($show_native, true));
$native_support = 'no';
- if ($db->exec('PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) {
+ if ($db->exec("PREPARE mystmt FROM 'EXPLAIN SELECT id FROM test'")) {
$native_support = 'yes';
$db->exec('DEALLOCATE PREPARE mystmt');
}
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
index e9b231cfdd..a935e1aca0 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
@@ -45,7 +45,7 @@ if (version_compare(PHP_VERSION, '5.1.0', '<'))
printf("\nAnd now magic PDO using fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE)...\n");
$db->exec('DROP TABLE IF EXISTS test');
$db->exec(sprintf('CREATE TABLE test(myobj BLOB) ENGINE=%s', MySQLPDOTest::getTableEngine()));
- $db->exec('INSERT INTO test(myobj) VALUES ("Data fetched from DB to be given to unserialize()")');
+ $db->exec("INSERT INTO test(myobj) VALUES ('Data fetched from DB to be given to unserialize()')");
$stmt = $db->prepare('SELECT myobj FROM test');
$stmt->execute();
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
index 99bade2a68..2e278b1afb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
@@ -6,6 +6,16 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
$db = MySQLPDOTest::factory();
+
+try {
+ $query = "SELECT '', NULL, \"\" FROM DUAL";
+ $stmt = $db->prepare($query);
+ $ok = @$stmt->execute();
+} catch (PDOException $e) {
+ die("skip: Test cannot be run with SQL mode ANSI");
+}
+if (!$ok)
+ die("skip: Test cannot be run with SQL mode ANSI");
?>
--FILE--
<?php
@@ -15,7 +25,6 @@ MySQLPDOTest::createTestTable($db);
try {
- // default settings
$query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3";
$stmt = $db->prepare($query);
@@ -39,7 +48,7 @@ try {
$this->not_a_magic_one();
printf("myclass::__set(%s, -%s-) %d\n",
$prop, var_export($value, true), $this->set_calls, self::$static_set_calls);
- if ("" != $prop)
+ if ("" != $prop)
$this->{$prop} = $value;
}
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
index 19ae1951dc..0fef334878 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
@@ -76,7 +76,7 @@ try {
return true;
}
- if (!$db->exec(sprintf('INSERT INTO test(id, label) VALUES (1, "%s")', $value))) {
+ if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) {
printf("[%03d] + 1] Insert failed, %d - %s\n", $offset,
$db->errorCode(), var_export($db->errorInfo(), true));
return false;
@@ -141,6 +141,11 @@ try {
return true;
}
+ $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
+
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
$is_mysqlnd = MySQLPDOTest::isPDOMySQLnd();
test_meta($db, 20, 'BIT(8)', 1, NULL, ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
@@ -160,10 +165,10 @@ try {
test_meta($db, 120, 'BIGINT', -9223372036854775808, 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
test_meta($db, 130, 'BIGINT UNSIGNED', 18446744073709551615, 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
- test_meta($db, 130, 'REAL', -1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 140, 'REAL UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 150, 'REAL ZEROFILL', -1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 150, 'REAL ZEROFILL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR);
test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR);
diff --git a/ext/pdo_mysql/tests/pdo_mysql_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_types.phpt
index 3629ab9a34..22c6b66c98 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_types.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_types.phpt
@@ -103,8 +103,8 @@ MySQLPDOTest::skip();
test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608');
test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215');
- test_type($db, 100, 'INT', -2147483648,
- ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648',
+ test_type($db, 100, 'INT', -2147483648,
+ ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648',
NULL, ($is_mysqlnd) ? 'integer' : NULL);
test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295');
diff --git a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
index 7c0ec3701a..f97bd1bbe2 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
@@ -91,9 +91,14 @@ MySQLPDOTest::skip();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
+
test_type($db, 100, 'REAL ZEROFILL', -1.01, NULL, '/^[0]*0$/');
- test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
- test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
+ test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\.0.*$/' : '/^[0]*1\.01$/');
+ test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\..*$/' : '/^[0]*1\.01$/');
test_type($db, 130, 'DOUBLE ZEROFILL', -1.01, NULL, '/^[0]*0$/');
test_type($db, 140, 'DOUBLE ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');