Skip Menu |
 

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 40383
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: janus [...] errornet.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.14
Fixed in: (no value)



Subject: Patch to fix "closing dbh with active statement handles"
Download (untitled) / with headers
text/plain 1.4k
Hi, i've seen those warnings numerous times, just like many other people: closing dbh with active statement handles at test.pl line 24. Now a friend proposed a workaround for another module where those warnings were seen and i was fed up and started to investigate. I found the solution in the SQLite documentation <http://sqlite.org/c3ref/close.html> where a function is used that occurred in version 3.6.0 of sqlite. The fix itself is pretty small: --- dbdimp.c.orig Fri Aug 24 04:51:25 2007 +++ dbdimp.c Sat Oct 25 22:31:04 2008 @@ -151,8 +151,13 @@ sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh) } if (sqlite3_close(imp_dbh->db) == SQLITE_BUSY) { + sqlite3_stmt *pStmt; /* active statements! */ - warn("closing dbh with active statement handles"); + + while ((pStmt = sqlite3_next_stmt(imp_dbh->db, NULL)) != NULL) + sqlite3_finalize(pStmt); + + sqlite3_close(imp_dbh->db); } imp_dbh->db = NULL; A greater problem was to get it working with a system-wide installed sqlite library as the local header files get picked up instead of the system-wide installed headers. Besides that the local version wouldn't work anymore just with the above patch. So i also had to update the local version of sqlite. The resulting patch is obviously pretty big as it updates the whole sqlite distribution coming with DBD::SQLite. I really hope this can finally close this long standing bug. Kind regards, Simon
Subject: DBD-SQLite-1.14.diff.gz
Download DBD-SQLite-1.14.diff.gz
application/gzip 716.1k

Message body not shown because it is not plain text.

Subject: patch-dbdimp_c.diff
Download patch-dbdimp_c.diff
text/x-diff 525b
--- dbdimp.c.orig Fri Aug 24 04:51:25 2007 +++ dbdimp.c Sat Oct 25 22:31:04 2008 @@ -151,8 +151,13 @@ sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh) } if (sqlite3_close(imp_dbh->db) == SQLITE_BUSY) { + sqlite3_stmt *pStmt; /* active statements! */ - warn("closing dbh with active statement handles"); + + while ((pStmt = sqlite3_next_stmt(imp_dbh->db, NULL)) != NULL) + sqlite3_finalize(pStmt); + + sqlite3_close(imp_dbh->db); } imp_dbh->db = NULL;
This appears to have been resolved by a different patch.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.