1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-26 20:04:44 +01:00
ext-pq/tests/exceptions002.phpt

27 lines
445 B
Plaintext
Raw Normal View History

2013-02-14 14:54:22 +01:00
--TEST--
sql exception
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
try {
$r = $c->exec("SELECT 1 FROM probably_non_existent_table");
} catch (pq\Exception $e) {
var_dump($e instanceof pq\Exception\DomainException);
var_dump($e->getCode() == pq\Exception::SQL);
var_dump($e->sqlstate);
}
?>
DONE
--EXPECT--
Test
bool(true)
bool(true)
string(5) "42P01"
DONE