FAQ
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 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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedOct 21, '05 at 3:02p
activeOct 21, '05 at 3:02p
posts1
users1
websitedbi.perl.org

1 user in discussion

Adriano Ferreira: 1 post

People

Translate

site design / logo © 2023 Grokbase