ci: add 8.1
[m6w6/ext-pq] / tests / async005.phpt
1 --TEST--
2 async prepared statement
3 --SKIPIF--
4 <?php include "_skipif.inc"; ?>
5 --FILE--
6 <?php
7 echo "Test\n";
8
9 include "_setup.inc";
10
11 function complete($s) {
12 do {
13 while ($s->connection->busy) {
14 $r = array($s->connection->socket);
15 $w = $e = null;
16 if (stream_select($r, $w, $e, null)) {
17 $s->connection->poll();
18 }
19 }
20 } while ($s->connection->getResult());
21 }
22
23 $c = new pq\Connection(PQ_DSN);
24 $t = new pq\Types($c);
25 $s = $c->prepareAsync("test", "SELECT \$1,\$2::int4", array($t["int4"]->oid));
26
27 complete($s);
28
29 $s->execAsync(array(1,2), function ($res) {
30 var_dump($res);
31 });
32
33 complete($s);
34
35 ?>
36 DONE
37 --EXPECTF--
38 Test
39 object(pq\Result)#%d (9) {
40 ["status"]=>
41 int(2)
42 ["statusMessage"]=>
43 string(9) "TUPLES_OK"
44 ["errorMessage"]=>
45 string(0) ""
46 ["diag"]=>
47 array(17) {
48 ["severity"]=>
49 NULL
50 ["sqlstate"]=>
51 NULL
52 ["message_primary"]=>
53 NULL
54 ["message_detail"]=>
55 NULL
56 ["message_hint"]=>
57 NULL
58 ["statement_position"]=>
59 NULL
60 ["internal_position"]=>
61 NULL
62 ["internal_query"]=>
63 NULL
64 ["context"]=>
65 NULL
66 ["schema_name"]=>
67 NULL
68 ["table_name"]=>
69 NULL
70 ["column_name"]=>
71 NULL
72 ["datatype_name"]=>
73 NULL
74 ["constraint_name"]=>
75 NULL
76 ["source_file"]=>
77 NULL
78 ["source_line"]=>
79 NULL
80 ["source_function"]=>
81 NULL
82 }
83 ["numRows"]=>
84 int(1)
85 ["numCols"]=>
86 int(2)
87 ["affectedRows"]=>
88 int(%d)
89 ["fetchType"]=>
90 int(0)
91 ["autoConvert"]=>
92 int(65535)
93 }
94 DONE