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();