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