Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: dan [...] dormonts.com
Cc:
AdminCc:

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



Subject: segfault when executing empty statement with "do"
Greetings, Running DBD-SQLite-0.31 Executing $dbh->do("") segfaults perl; should probably return undef. I tried it on open of both an existing db and a new one. $ perl -MDBD::SQLite -MDBI my $dbh = DBI->connect("dbi:SQLite:dbname=nonexist.db") or die; $dbh->do(""); Segmentation fault $ perl -v This is perl, v5.8.3 built for i386-linux-thread-multi $ uname -a Linux dhcppc1 2.4.22-1.2115.nptlsmp #1 SMP Wed Oct 29 15:20:01 EST 2003 i686 athlon i386 GNU/Linux Cheers, Dan
Subject: Quick patch to throw exception on empty query
From: david_dick [...] iprimus.com.au
based on the example set by DBD::mysql, this patch will cause DBD::SQLite to throw an exception if an $sth->execute() method is called on an empty query (and therefore by extension $dbh->do("") will also be covered
diff -Naur DBD-SQLite-0.31/dbdimp.c new/dbdimp.c --- DBD-SQLite-0.31/dbdimp.c 2004-02-15 04:36:38.000000000 +1100 +++ new/dbdimp.c 2004-04-22 13:39:17.000000000 +1000 @@ -323,6 +323,9 @@ int _sqlite_fetch_row (imp_sth_t *imp_sth) { + if (imp_sth->vm == NULL) { + die("Query was empty"); + } while (1) { imp_sth->retval = sqlite_step(imp_sth->vm,