Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: a.r.ferreira [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: Accepting bad SQL "select 'eek"
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
Subject: Accepting bad SQL "select 'eek"
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
Date: Fri, 21 Oct 2005 13:02:35 -0200
From: Adriano Ferreira <a.r.ferreira [...] gmail.com>
To: dbi-users [...] perl.org, Matt Sergeant <matt [...] sergeant.org>, bug-DBD-SQLite [...] rt.cpan.org
Subject: Re: Is it a bug in DBD::SQLite? [cpan #15166]
RT-Send-Cc:
Actually this seems an issue with SQLite 3.2. DBD::SQLite 1.09 uses 3.2.2. And it is reproducible with the Java wrapper over 3.2.1. A statement like SELECT 'a which should be a syntax error, doubles the last character, returning (in this example) a row with one column 'aa'. On 10/20/05, Adriano Ferreira <a.r.ferreira@gmail.com> wrote: Show quoted text
> 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 >
Looks like it's an SQLite issue, not a driver issue.