Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SQLite3::enableExceptions test
3: --CREDITS--
4: Thijs Feryn <thijs@feryn.eu>
5: #TestFest PHPBelgium 2009
6: --SKIPIF--
7: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
8: --FILE--
9: <?php
10:
11: $db = new SQLite3(':memory:');
12: var_dump($db->enableExceptions(true));
13: try{
14: $db->query("SELECT * FROM non_existent_table");
15: } catch(Exception $e) {
16: echo $e->getMessage().PHP_EOL;
17: }
18: var_dump($db->enableExceptions(false));
19: $db->query("SELECT * FROM non_existent_table");
20: var_dump($db->enableExceptions("wrong_type","wrong_type"));
21: echo "Closing database\n";
22: var_dump($db->close());
23: echo "Done\n";
24: ?>
25: --EXPECTF--
26: bool(false)
27: no such table: non_existent_table
28: bool(true)
29:
30: Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d
31:
32: Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s on line %d
33: NULL
34: Closing database
35: bool(true)
36: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>