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