xref: /PHP-8.0/ext/sqlite3/tests/bug73068.phpt (revision 26dfce7f)
1--TEST--
2Bug #73068 SQLite3 may fail to DELETE
3--SKIPIF--
4<?php
5require_once(__DIR__ . '/skipif.inc');
6$version = SQLite3::version()['versionNumber'];
7if ($version >= 3011000 && $version < 3014002) die('skip libsqlite 3.11.0 to 3.14.1 exhibit erroneous behavior');
8?>
9--FILE--
10<?php
11
12$db = new \SQLite3(':memory:') ;
13
14$db->exec("CREATE TABLE IF NOT EXISTS t1(a INT UNIQUE, b INT)");
15$db->exec("INSERT OR REPLACE INTO t1(a,b) VALUES('1','2')");
16
17$r = $db->query("SELECT * FROM t1 WHERE a='1' AND b='2'");
18var_dump($r->fetchArray());
19
20$db->exec("DELETE FROM t1 WHERE a='1' AND b='2'");
21
22$r = $db->query("SELECT * FROM t1;");
23var_dump($r->fetchArray());
24
25$db->close();
26
27?>
28==OK==
29--EXPECT--
30array(4) {
31  [0]=>
32  int(1)
33  ["a"]=>
34  int(1)
35  [1]=>
36  int(2)
37  ["b"]=>
38  int(2)
39}
40bool(false)
41==OK==
42