Skip to content

Commit 050c586

Browse files
committed
Switch sqlite tests from " to ' for strings
This behavior is discouraged and seems to be disabled by default in new versions. https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted
1 parent c456b83 commit 050c586

22 files changed

+36
-40
lines changed

ext/pdo_sqlite/tests/bug38334.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pdo_sqlite
77

88
$db = new PDO('sqlite::memory:');
99
$db->exec('CREATE TABLE test_38334 (i INTEGER , f DOUBLE, s VARCHAR(255))');
10-
$db->exec('INSERT INTO test_38334 VALUES (42, 46.7, "test")');
10+
$db->exec('INSERT INTO test_38334 VALUES (42, 46.7, \'test\')');
1111
var_dump($db->query('SELECT * FROM test_38334')->fetch(PDO::FETCH_ASSOC));
1212

1313
// Check handling of integers larger than 32-bit.
14-
$db->exec('INSERT INTO test_38334 VALUES (10000000000, 0.0, "")');
14+
$db->exec('INSERT INTO test_38334 VALUES (10000000000, 0.0, \'\')');
1515
$i = $db->query('SELECT i FROM test_38334 WHERE f = 0.0')->fetchColumn(0);
1616
if (PHP_INT_SIZE >= 8) {
1717
var_dump($i === 10000000000);
@@ -20,8 +20,8 @@ if (PHP_INT_SIZE >= 8) {
2020
}
2121

2222
// Check storing of strings into integer/float columns.
23-
$db->exec('INSERT INTO test_38334 VALUES ("test", "test", "x")');
24-
var_dump($db->query('SELECT * FROM test_38334 WHERE s = "x"')->fetch(PDO::FETCH_ASSOC));
23+
$db->exec('INSERT INTO test_38334 VALUES (\'test\', \'test\', \'x\')');
24+
var_dump($db->query('SELECT * FROM test_38334 WHERE s = \'x\'')->fetch(PDO::FETCH_ASSOC));
2525

2626
?>
2727
--EXPECT--

ext/pdo_sqlite/tests/bug_42589.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(!in_array('ENABLE_COLUMN_METADATA', $options, true))
1515
$db = new PDO("sqlite::memory:");
1616

1717
$db->exec('CREATE TABLE test_42589 (field1 VARCHAR(10))');
18-
$db->exec('INSERT INTO test_42589 VALUES("test")');
18+
$db->exec('INSERT INTO test_42589 VALUES(\'test\')');
1919

2020
$result = $db->query('SELECT * FROM test_42589 t1 LEFT JOIN test_42589 t2 ON t1.field1 = t2.field1');
2121
$meta1 = $result->getColumnMeta(0);

ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $db = new PDO('sqlite::memory:');
99
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
1010

1111
$db->exec('CREATE TABLE test_fetch_func_001 (id INTEGER , name VARCHAR)');
12-
$db->exec('INSERT INTO test_fetch_func_001 VALUES(1, "php"), (2, "")');
12+
$db->exec('INSERT INTO test_fetch_func_001 VALUES(1, \'php\'), (2, \'\')');
1313

1414
$st = $db->query('SELECT * FROM test_fetch_func_001');
1515
$st->fetchAll(

ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $db = new PDO('sqlite::memory:');
99

1010
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate (id INT AUTO INCREMENT, name TEXT)');
1111

12-
$db->query('INSERT INTO test_pdo_sqlite_createaggregate VALUES (NULL, "PHP"), (NULL, "PHP6")');
12+
$db->query('INSERT INTO test_pdo_sqlite_createaggregate VALUES (NULL, \'PHP\'), (NULL, \'PHP6\')');
1313

1414
$db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; });
1515

ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
1010

1111
$db->query('CREATE TABLE test_pdo_sqlite_createcollation (id INT AUTO INCREMENT, name TEXT)');
1212

13-
$db->query('INSERT INTO test_pdo_sqlite_createcollation VALUES (NULL, "1"), (NULL, "2"), (NULL, "10")');
13+
$db->query('INSERT INTO test_pdo_sqlite_createcollation VALUES (NULL, \'1\'), (NULL, \'2\'), (NULL, \'10\')');
1414

1515
$db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); });
1616

ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $db = new PDO('sqlite::memory:');
99

1010
$db->query('CREATE TABLE test_pdo_sqlite_createfunction (id INT AUTO INCREMENT, name TEXT)');
1111

12-
$db->query('INSERT INTO test_pdo_sqlite_createfunction VALUES (NULL, "PHP"), (NULL, "PHP6")');
12+
$db->query('INSERT INTO test_pdo_sqlite_createfunction VALUES (NULL, \'PHP\'), (NULL, \'PHP6\')');
1313

1414

1515
$db->sqliteCreateFunction('testing', function($v) { return strtolower($v); });

ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $db = new PDO('sqlite::memory:');
1313

1414
$db->query('CREATE TABLE test_pdo_sqlite_createfunction_with_flags (id INT AUTO INCREMENT, name TEXT)');
1515

16-
$db->query('INSERT INTO test_pdo_sqlite_createfunction_with_flags VALUES (NULL, "PHP"), (NULL, "PHP6")');
16+
$db->query('INSERT INTO test_pdo_sqlite_createfunction_with_flags VALUES (NULL, \'PHP\'), (NULL, \'PHP6\')');
1717

1818

1919
$db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }, 1, PDO::SQLITE_DETERMINISTIC);

ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pdo_sqlite
77

88
$db = new PDO('sqlite::memory:');
99
$db->query('CREATE TABLE test_pdo_sqlite_lastinsertid (id INT AUTO INCREMENT, name TEXT)');
10-
$db->query('INSERT INTO test_pdo_sqlite_lastinsertid VALUES (NULL, "PHP"), (NULL, "PHP6")');
10+
$db->query('INSERT INTO test_pdo_sqlite_lastinsertid VALUES (NULL, \'PHP\'), (NULL, \'PHP6\')');
1111
var_dump($db->query('SELECT * FROM test_pdo_sqlite_lastinsertid'));
1212
var_dump($db->errorInfo());
1313
var_dump($db->lastInsertId());

ext/pdo_sqlite/tests/pdo_sqlite_parser.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ foreach ($queries as $k => $query) {
3131
// One parameter
3232
$queries = [
3333
"SELECT * FROM {$table} WHERE '1' = ?",
34-
"SELECT * FROM {$table} WHERE \"?\" IN (?, \"?\")",
3534
"SELECT * FROM {$table} WHERE `a``?` = ?",
36-
"SELECT * FROM {$table} WHERE \"a`?\" = ?",
3735
"SELECT * FROM {$table} WHERE [a`?] = ?",
3836
];
3937

@@ -58,5 +56,3 @@ bool(true)
5856
bool(true)
5957
bool(true)
6058
bool(true)
61-
bool(true)
62-
bool(true)

ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $db->query('CREATE TABLE test_pdo_sqlite_transaction (id INT AUTO INCREMENT, nam
1414
$db->commit();
1515

1616
$db->beginTransaction();
17-
$db->query('INSERT INTO test_pdo_sqlite_transaction VALUES (NULL, "PHP"), (NULL, "PHP6")');
17+
$db->query('INSERT INTO test_pdo_sqlite_transaction VALUES (NULL, \'PHP\'), (NULL, \'PHP6\')');
1818
$db->rollback();
1919

2020
$r = $db->query('SELECT COUNT(*) FROM test_pdo_sqlite_transaction');

0 commit comments

Comments
 (0)