1--TEST--
2Bug #68849 bindValue is not using the right data type
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8$db = new SQLite3(':memory:');
9
10$db->exec("CREATE TABLE test (a INTEGER, b TEXT, c REAL);" .
11	    "INSERT INTO test VALUES (1, 'hello', 3.14);" .
12	    "INSERT INTO test VALUES (3, 'world', 3.15);" .
13	    "INSERT INTO test VALUES (0, '42', 0.42);"
14);
15
16$s = $db->prepare('SELECT * FROM test WHERE (a+2) = ?;');
17$s->bindValue(1, 3);
18$r = $s->execute();
19var_dump($r->fetchArray(SQLITE3_ASSOC));
20
21$s = $db->prepare('SELECT * FROM test WHERE a = ?;');
22$s->bindValue(1, true);
23$r = $s->execute();
24var_dump($r->fetchArray(SQLITE3_ASSOC));
25
26$s = $db->prepare('SELECT * FROM test WHERE a = ?;');
27$s->bindValue(1, false);
28$r = $s->execute();
29var_dump($r->fetchArray(SQLITE3_ASSOC));
30
31$s = $db->prepare('SELECT * FROM test WHERE c = ?;');
32$s->bindValue(1, 3.15);
33$r = $s->execute();
34var_dump($r->fetchArray(SQLITE3_ASSOC));
35
36?>
37==DONE==
38--EXPECTF--
39array(3) {
40  ["a"]=>
41  int(1)
42  ["b"]=>
43  string(5) "hello"
44  ["c"]=>
45  float(3.14)
46}
47array(3) {
48  ["a"]=>
49  int(1)
50  ["b"]=>
51  string(5) "hello"
52  ["c"]=>
53  float(3.14)
54}
55array(3) {
56  ["a"]=>
57  int(0)
58  ["b"]=>
59  string(2) "42"
60  ["c"]=>
61  float(0.42)
62}
63array(3) {
64  ["a"]=>
65  int(3)
66  ["b"]=>
67  string(5) "world"
68  ["c"]=>
69  float(3.15)
70}
71==DONE==
72