#47159 [Opn->Csd]: Creating a prepared statement without executing it makes database unclosable
| From: | scottmac@php.net | Date: | Tue, 20 Jan 2009 09:59:05 +0000 |
| Subject: | #47159 [Opn->Csd]: Creating a prepared statement without executing it makes database unclosable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133048@lists.php.net to get a copy of this message | ||
ID: 47159
Updated by: scottmac@php.net
Reported By: pcdinh at gmail dot com
-Status: Open
+Status: Closed
Bug Type: SQLite related
Operating System: Windows XP SP3
PHP Version: 5.3.0alpha3
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
This is loosely related to bug #47145 which I fixed last night.
I've however checked all the prepare calls now to make sure things are
free'd
Previous Comments:
------------------------------------------------------------------------
[2009-01-20 03:38:36] pcdinh at gmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47159&edit=1