#define SQLITE3_CHECK_INITIALIZED(db_obj, member, class_name) \
if (!(db_obj) || !(member)) { \
- php_sqlite3_error(db_obj, "The " #class_name " object has not been correctly initialised"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "The " #class_name " object has not been correctly initialised or is already closed"); \
+ RETURN_THROWS(); \
}
#define SQLITE3_CHECK_INITIALIZED_STMT(member, class_name) \
if (!(member)) { \
- php_error_docref(NULL, E_WARNING, "The " #class_name " object has not been correctly initialised"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "The " #class_name " object has not been correctly initialised or is already closed"); \
+ RETURN_THROWS(); \
}
/* {{{ PHP_INI */
// Close the database connection and free the internal sqlite3_stmt object
$db->close();
// Access the sqlite3_stmt object via the php_sqlite3_stmt container
-$stmt->reset();
+try {
+ $stmt->reset();
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
---EXPECTF--
-Warning: SQLite3Stmt::reset(): The SQLite3 object has not been correctly initialised in %s
+--EXPECT--
+The SQLite3 object has not been correctly initialised or is already closed
echo "Closing database\n";
var_dump($db->close());
echo "Check db was closed\n";
-var_dump($results->numColumns());
+try {
+ var_dump($results->numColumns());
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "Done\n";
?>
--EXPECTF--
Closing database
bool(true)
Check db was closed
-
-Warning: SQLite3Result::numColumns(): The SQLite3Result object has not been correctly initialised in %s on line %d
-bool(false)
+The SQLite3Result object has not been correctly initialised or is already closed
Done