Skip Menu |

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

Report information
The Basics
Id: 30656
Status: resolved
Priority: 0/
Queue: DBD-SQLite2

People
Owner: Nobody in particular
Requestors: pratik9 [...] gmail.com
Cc:
AdminCc:

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



Subject: "IF [NOT] EXISTS" reporting errors with DROP TABLE and CREATE TABLE
The attached script dbtest2.pl gives the following errors with DBD-SQLite2-0.33: DBD::SQLite2::db do failed: near "EXISTS": syntax error(1) at dbdimp.c line 412 at dbtest2.pl line 12. DBD::SQLite2::db do failed: near "NOT": syntax error(1) at dbdimp.c line 412 at dbtest2.pl line 13. However the same script with DBD-SQLite-1.13 appropriately does not generate any errors.
Subject: dbTest2.pl
#!/usr/bin/perl use strict; use DBI; my $dbargs = {AutoCommit => 0, PrintError => 1}; my $dbh = DBI->connect("dbi:SQLite2:dbname=foo.db","","",$dbargs) or die "Couldn't connect to database: ".DBI->errstr; $dbh->do("DROP TABLE IF EXISTS table1"); $dbh->do("CREATE TABLE IF NOT EXISTS table1 (bar1 INTEGER, bar2 TEXT)"); $dbh->disconnect();
On Sun Nov 11 22:10:11 2007, pratikDas wrote: Show quoted text
> The attached script dbtest2.pl gives the following errors with > DBD-SQLite2-0.33: > > DBD::SQLite2::db do failed: near "EXISTS": syntax error(1) at dbdimp.c > line 412 at dbtest2.pl line 12. > DBD::SQLite2::db do failed: near "NOT": syntax error(1) at dbdimp.c line > 412 at dbtest2.pl line 13. > > However the same script with DBD-SQLite-1.13 appropriately does not > generate any errors.
Of course. DBD-SQLite uses the latest sqlite3 which understands those keywords, DBD-SQLite2 uses the old sqlite2 which does not understand this syntax. -- Reini Urban
Not fixable with sqlite2, use the new DBD::SQLite instead -- Reini Urban