release 2.1.6
[m6w6/ext-pq] / tests / stm_bound001.phpt
1 --TEST--
2 statement w/ bound vars
3 --SKIPIF--
4 <?php
5 include "_skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 echo "Test\n";
10 include "_setup.inc";
11
12 $c = new pq\Connection(PQ_DSN);
13 $s = new pq\Statement($c, "bound1", "SELECT \$1::text, \$2::text, \$3::text");
14 $s->bind(0, $_1);
15 $s->bind(1, $_2);
16 $s->bind(2, $_3);
17 $r = $s->exec();
18 var_dump($r->fetchAll());
19 $_1 = "\$1";
20 $_2 = "\$2";
21 $_3 = "\$3";
22 $r = $s->exec();
23 var_dump($r->fetchAll());
24 ?>
25 Done
26 --EXPECT--
27 Test
28 array(1) {
29 [0]=>
30 array(3) {
31 [0]=>
32 NULL
33 [1]=>
34 NULL
35 [2]=>
36 NULL
37 }
38 }
39 array(1) {
40 [0]=>
41 array(3) {
42 [0]=>
43 string(2) "$1"
44 [1]=>
45 string(2) "$2"
46 [2]=>
47 string(2) "$3"
48 }
49 }
50 Done