File: gh-issue015_statements.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 (42 lines) | stat: -rw-r--r-- 659 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
--TEST--
restore statements on reset
--SKIPIF--
<?php
include "_skipif.inc";
?>
--INI--
date.timezone=UTC
--FILE--
<?php
echo "Test\n";

include "_setup.inc";

$c = new pq\Connection(PQ_DSN);

$s = $c->prepare("test", "SELECT 1");
$c->on(pq\Connection::EVENT_RESET, function($conn) {
	printf("Connection was reset\n");
});

var_dump($s->exec()->fetchRow());

$c->reset();

// Fatal error: Uncaught exception 'pq\Exception\DomainException' with message 'ERROR:  prepared statement "test" does not exist'
var_dump($s->exec()->fetchRow());

?>
===DONE===
--EXPECT--
Test
array(1) {
  [0]=>
  int(1)
}
Connection was reset
array(1) {
  [0]=>
  int(1)
}
===DONE===