support PostgreSQL down to 9.0; JSON is optional
[m6w6/ext-pq] / tests / async004.phpt
1 --TEST--
2 async exec params
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 $c = new pq\Connection(PQ_DSN);
12 $t = new pq\Types($c);
13 $c->execParamsAsync("SELECT \$1,\$2::int4", array(1,2), array($t["int4"]->oid), function ($res) {
14 var_dump($res);
15 });
16 do {
17 while ($c->busy) {
18 $r = array($c->socket);
19 $w = $e = null;
20 if (stream_select($r, $w, $e, null)) {
21 $c->poll();
22 }
23 }
24 } while ($c->getResult());
25
26 ?>
27 DONE
28 --EXPECTF--
29 Test
30 object(pq\Result)#%d (8) {
31 ["status"]=>
32 int(2)
33 ["statusMessage"]=>
34 string(9) "TUPLES_OK"
35 ["errorMessage"]=>
36 string(0) ""
37 ["numRows"]=>
38 int(1)
39 ["numCols"]=>
40 int(2)
41 ["affectedRows"]=>
42 int(%d)
43 ["fetchType"]=>
44 int(0)
45 ["autoConvert"]=>
46 int(65535)
47 }
48 DONE