xref: /PHP-8.1/ext/sqlite3/tests/bug45798.phpt (revision 7f2f0c00)
1--TEST--
2Bug #45798 (sqlite3 doesn't notice if variable was bound)
3--EXTENSIONS--
4sqlite3
5--FILE--
6<?php
7
8require_once(__DIR__ . '/new_db.inc');
9
10$db->exec('CREATE TABLE test (time INTEGER, id STRING)');
11
12$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
13$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");
14
15$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
16
17$stmt->bindParam(1, $foo, SQLITE3_TEXT);
18$results = $stmt->execute();
19
20while ($result = $results->fetchArray(SQLITE3_NUM)) {
21    var_dump($result);
22}
23
24$results->finalize();
25
26$db->close();
27
28print "done";
29
30?>
31--EXPECT--
32done
33