1--TEST--
2SQLite3Stmt::getSQL expanded test
3--EXTENSIONS--
4sqlite3
5--SKIPIF--
6<?php
7if (SQLite3::version()['versionNumber'] < 3014000) {
8    die('skip SQLite < 3.14 installed, requires SQLite >= 3.14');
9}
10?>
11--FILE--
12<?php
13
14require_once(__DIR__ . '/new_db.inc');
15
16$db->enableExceptions(true);
17
18$stmt = $db->prepare('SELECT :a, :b, ?;');
19
20$stmt->bindValue(':a', 42);
21$stmt->bindValue(':b', 'php');
22$stmt->bindValue(3, 43);
23
24echo "Getting expanded SQL statement\n";
25var_dump($stmt->getSQL(true));
26
27echo "Execute statement\n";
28var_dump($res = $stmt->execute());
29
30echo "Statement result\n";
31var_dump($res->fetchArray(SQLITE3_NUM));
32
33$stmt->reset();
34
35echo "Change binded values\n";
36$stmt->bindValue(':a', 'TEST');
37$stmt->bindValue(':b', '!!!');
38$stmt->bindValue(3, 40);
39
40echo "Getting expanded SQL statement\n";
41var_dump($stmt->getSQL(true));
42
43echo "Closing DB\n";
44var_dump($db->close());
45
46echo "Done\n";
47?>
48--EXPECT--
49Getting expanded SQL statement
50string(21) "SELECT 42, 'php', 43;"
51Execute statement
52object(SQLite3Result)#3 (0) {
53}
54Statement result
55array(3) {
56  [0]=>
57  int(42)
58  [1]=>
59  string(3) "php"
60  [2]=>
61  int(43)
62}
63Change binded values
64Getting expanded SQL statement
65string(25) "SELECT 'TEST', '!!!', 40;"
66Closing DB
67bool(true)
68Done
69