prepare v2.2.3
[m6w6/ext-pq] / tests / gh-issue015_statements.phpt
1 --TEST--
2 restore statements on reset
3 --SKIPIF--
4 <?php
5 include "_skipif.inc";
6 ?>
7 --INI--
8 date.timezone=UTC
9 --FILE--
10 <?php
11 echo "Test\n";
12
13 include "_setup.inc";
14
15 $c = new pq\Connection(PQ_DSN);
16
17 $s = $c->prepare("test", "SELECT 1");
18 $c->on(pq\Connection::EVENT_RESET, function($conn) {
19 printf("Connection was reset\n");
20 });
21
22 var_dump($s->exec()->fetchRow());
23
24 $c->reset();
25
26 // Fatal error: Uncaught exception 'pq\Exception\DomainException' with message 'ERROR: prepared statement "test" does not exist'
27 var_dump($s->exec()->fetchRow());
28
29 ?>
30 ===DONE===
31 --EXPECT--
32 Test
33 array(1) {
34 [0]=>
35 int(1)
36 }
37 Connection was reset
38 array(1) {
39 [0]=>
40 int(1)
41 }
42 ===DONE===