prepare v2.2.3
[m6w6/ext-pq] / tests / async010.phpt
1 --TEST--
2 asnyc query not cleaned before sync exec
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8 include "_setup.inc";
9
10 $c = new pq\Connection(PQ_DSN);
11
12 var_dump([
13 "async" => $c->execAsync("select clock_timestamp(), pg_sleep(0.1), clock_timestamp()", function($r) {
14 var_dump([
15 "cb" => $r->fetchRow()
16 ]);
17 })
18 ]);
19
20 var_dump([
21 "execParams" => $c->execParams("select \$1::int4", [123])->fetchRow()
22 ]);
23 ?>
24 DONE
25 --EXPECTF--
26 Test
27 array(1) {
28 ["async"]=>
29 NULL
30 }
31 array(1) {
32 ["cb"]=>
33 array(3) {
34 [0]=>
35 object(pq\DateTime)#%d (4) {
36 ["format"]=>
37 string(14) "Y-m-d H:i:s.uO"
38 ["date"]=>
39 string(26) "%s"
40 ["timezone_type"]=>
41 int(1)
42 ["timezone"]=>
43 string(6) "%s"
44 }
45 [1]=>
46 string(0) ""
47 [2]=>
48 object(pq\DateTime)#%d (4) {
49 ["format"]=>
50 string(14) "Y-m-d H:i:s.uO"
51 ["date"]=>
52 string(26) "%s"
53 ["timezone_type"]=>
54 int(1)
55 ["timezone"]=>
56 string(6) "%s"
57 }
58 }
59 }
60 array(1) {
61 ["execParams"]=>
62 array(1) {
63 [0]=>
64 int(123)
65 }
66 }
67 DONE