File: async010.phpt

package info (click to toggle)
php-pq 2.2.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 788 kB
  • sloc: ansic: 8,210; xml: 175; sh: 102; awk: 40; pascal: 9; makefile: 1
file content (67 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--TEST--
asnyc query not cleaned before sync exec
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";

$c = new pq\Connection(PQ_DSN);

var_dump([
	"async" => $c->execAsync("select clock_timestamp(), pg_sleep(0.1), clock_timestamp()", function($r) {
		var_dump([
			"cb" => $r->fetchRow()
		]);
	})
]);

var_dump([
	"execParams" => $c->execParams("select \$1::int4", [123])->fetchRow()
]);
?>
DONE
--EXPECTF--
Test
array(1) {
  ["async"]=>
  NULL
}
array(1) {
  ["cb"]=>
  array(3) {
    [0]=>
    object(pq\DateTime)#%d (4) {
      ["format"]=>
      string(14) "Y-m-d H:i:s.uO"
      ["date"]=>
      string(26) "%s"
      ["timezone_type"]=>
      int(1)
      ["timezone"]=>
      string(6) "%s"
    }
    [1]=>
    string(0) ""
    [2]=>
    object(pq\DateTime)#%d (4) {
      ["format"]=>
      string(14) "Y-m-d H:i:s.uO"
      ["date"]=>
      string(26) "%s"
      ["timezone_type"]=>
      int(1)
      ["timezone"]=>
      string(6) "%s"
    }
  }
}
array(1) {
  ["execParams"]=>
  array(1) {
    [0]=>
    int(123)
  }
}
DONE