Is it a bug in DBD::SQLite?



While developing, I gave DBD::SQLite a bad SQL statement like "select
'eek" (quoted string not terminated). It worked and gave a weird
answer. Is that something I should be expecting? Some oddity of
SQLite?

The following test script was run
#!/usr/bin/perl

use DBI;
use DBD::SQLite;
use Test::More tests => 5;

diag("\$DBI::VERSION: $DBI::VERSION, \$DBD::SQLite::VERSION:
$DBD::SQLite::VERSION\n");

my $dbh = DBI->connect('dbi:SQLite:dbname=t.db');
ok($dbh, 'defined $dbh');

# this is bad SQL
my $sql = "select 'eek";
my $sth = $dbh->prepare($sql);
ok($sth, "defined \$sth (SQL: $sql) ?!");
ok($sth->execute, "execute ok ?!");
my @row = $sth->fetchrow_array;
is(scalar @row, 1, 'one column fetched');
is($row[0], 'eekk', 'returning "eekk", arghh!');

and gave the output

$ perl bug.pl
1..5
# $DBI::VERSION: 1.48, $DBD::SQLite::VERSION: 1.09
ok 1 - defined $dbh
ok 2 - defined $sth (SQL: select 'eek) ?!
ok 3 - execute ok ?!
ok 4 - one column fetched
ok 5 - returning "eekk", arghh!

$ perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int

$ uname -a
CYGWIN_NT-5.0 INF-020 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown
unknown Cygwin
.



Relevant Pages

  • Re: FYI: DBD::SQLite V 1.07 and Windows
    ... > This is Perl 5.8.4. ... > My conclusion regarding the warning messages is the SQLite cannot be relied upon, under Windows, and hence should not be used in production. ... > One test I could do is export the SQLite database as a text file, and compare with an export from the MySQL version. ...
    (perl.dbi.users)
  • Re: List Variable becomes undefined inexplicably
    ... could run the test script to reproduce the problem. ... It is certainly not the root cause. ... Perl could, were it implemented that way, but it was not and does not. ...
    (comp.lang.perl.misc)
  • Re: DBD::CSV doesnt do Unicode?
    ... amonotod wrote: ... > I would prefer to use the CSV driver to do so ... Also your version of perl is very relevant since different perls handle ... I think the test script I wrote conclusively proved the issue ...
    (perl.dbi.users)
  • Re: SQLite - problem connecting to database (or doing a select)
    ... >>I've having a problem running a tiny snippet of test code that uses ... >>SQLite to connect to a local database (I'm running xampp on my local ... > SQLite doesn't connect to other RDBMS... ... I just want to be able to access an sql database from perl. ...
    (comp.lang.perl.misc)
  • List Variable becomes undefined inexplicably
    ... Using Perl v5.8.4 ... I was able to reproduce it with the test script below. ... subroutine A, iterated over in a foreach loop in subroutine B, is then ... sub ITERATE_HOSTS { ...
    (comp.lang.perl.misc)