Re: Is it a bug in DBD::SQLite? [cpan #15166]



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@xxxxxxxxx> wrote:
> 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: Unicode Character not displaying on Dialog Screen
    ... the Microsoft C compiler can accept in a quoted string any character in the ... the tab character in my career, and only use it in very limited contexts, usually using it ...
    (microsoft.public.vc.mfc)
  • Re: Protocols to exchange messages via a socket
    ... protocols are best suitable: ... This solution works but doubles the message length :-( ... number of consecutive 0xff's in the real message, ... You only need to reserve one character as a separator. ...
    (comp.unix.programmer)
  • Re: What I have learned today
    ... Eek! ... >>> bunch of sliced up veggies going to waste. ... >>I wonder if it has a paper doll system. ... I love paper dolling my character. ...
    (rec.games.computer.ultima.dragons)
  • Re: FWD: Hogzilla?
    ... doubles" for long shots, and shots in which a "big" character was in a ... life sized" doubles, and the Hobbits and Gimli had midget doubles. ...
    (sci.space.history)
  • Re: Help with a Reg Ex
    ... A backslash before a normal character in ... this is not a double quoted string but a RE character class. ... backslash would be taken literally ARAIR. ...
    (comp.lang.perl.misc)