|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-01-20 09:59 UTC] scottmac@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 08:00:01 2025 UTC | 
Description: ------------ A database connection to SQLite3 can not be closed if I create a prepared statement without executing it. Of course, I have already closed that statement explicitly before closing the database connection handler. I had this warning: Unable to close due to unfinalised statements. It means that an invocation to close() on a statement handler does not work. Reproduce code: --------------- <?php // By default, open uses SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE. $db = new SQLite3('./test.db'); $sql = 'SELECT 1'; $stmt = $db->prepare($sql); // Commenting out the line intentionally // $rs = $stmt->execute(); if (true === $stmt->close()) { echo 'Statement is already closed but in this case it is not. '; } if (false === $db->close()) { echo 'But database connection can not be closed due to an error: '.$db->lastErrorMsg(); } ?> Expected result: ---------------- Database connection should be closed as usual Actual result: -------------- The error message: Statement is already closed but in this case it is not. Warning: SQLite3::close() [sqlite3.close]: Unable to close database: 5, Unable to close due to unfinalised statements in D:\wvbsrc\repos\pone\trunk\tests\Plugin\test2_sqlite3.php on line 18 But database connection can not be closed due to an error: Unable to close due to unfinalised statements