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