Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: michael [...] schweisguth.com
Cc:
AdminCc:

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



Subject: prepared statement not finalized in sqlite_st_finish
Download (untitled) / with headers
text/plain 1.2k
Hello, I have an SQLite program that manages about 256 Sqlite databases. Now, I tried to close them with disconnect but that didn't work. I went to the proc filesystem and noticed that the number of file handles was growing! So, I went to the source and found out that sqlite3_close was returning a "5" and the sqlite3.h file noted that it was probably because a prepared handle wasn't being finalized. That rang a bell since I was using prepared statements! So I checked the source and, as far as I could tell, if you use "prepare" and don't fetch all the rows, then the prepared statement isn't finalized in sqlite_st_finish. That rang a bell too since I was bailing out after I found the row I wanted! So I hacked the code a bit and added a DBIc_ACTIVE_on(imp_sth) in the sqlite_st_prepare function. My problems went away. I haven't analyzed the code enough to know if this is a bad thing, somehow... This is the change I made to dbdimp.c (I added only one line): DBIc_ACTIVE_on(imp_sth); DBIc_NUM_PARAMS(imp_sth) = sqlite3_bind_parameter_count(imp_sth->stmt); DBIc_NUM_FIELDS(imp_sth) = sqlite3_column_count(imp_sth->stmt); DBIc_IMPSET_on(imp_sth); I hope you find this useful! I attached my modified dbdimp.c file.
Download dbdimp.c
text/x-csrc 26.5k

Message body is not shown because it is too large.

Subject: DBD::Sqlite doesn't close databases
Download (untitled) / with headers
text/plain 410b
I attached the files with the patches I made to the PERL sqlite dbdimp.c file and include a test case, the output and the updated file. Essentially, before I made the patch, the prepared statements weren't being finalized, and so, sqlite wouldn't close the database. My patch makes the prepared statement active so it is a candidate for finalization. Ultimately, this means that the database will be closed!
Download sqlite_patches.tar.gz
application/x-gzip-compressed 6.4k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 224b
[MSERGEANT - Mon Feb 21 18:03:41 2005]: Show quoted text
> I cannot replicate this with the current CVS code, so I'm closing it > as resolved. New 1.08 will > be out today and may fix this...
Never mind - managed to replicate it after all.
Cleaner fix found, and applied.
Download (untitled) / with headers
text/plain 112b
[MSERGEANT - Mon Feb 21 18:14:08 2005]: Show quoted text
> Cleaner fix found, and applied.
Any news on this? It's still broken.
From: Jörg Mensmann
Download (untitled) / with headers
text/plain 451b
Somehow related, I was getting "closing dbh with active statement handles", when preparing a statement but not using it. The following code spits out that warning: use DBI; $dbh = DBI->connect("dbi:SQLite:dbname=test.db", "", ""); $dbh->do("CREATE TEMP TABLE test (a INTEGER, b INTEGER)"); $sth = $dbh->prepare("INSERT INTO test VALUES(?,?)"); As a workaround I added $sth->{Active} = 1; $sth->finish; which makes the warning disappear.
Download (untitled) / with headers
text/plain 224b
[guest - Wed May 4 07:31:39 2005]: Show quoted text
> [MSERGEANT - Mon Feb 21 18:14:08 2005]: >
> > Cleaner fix found, and applied.
> > Any news on this? It's still broken.
I just got bitten by this one with 1.0.9. (edwin@mavetju.org)
Marking as fixed in 1.13. Please re-open if that release doesn't fix your bug(s).


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.