Christoph Biedl wrote:
Package: libdbd-sqlite3-perl
Version: 1.08-1
Severity: normal

To my big surprise I cannot issue an "ALTER TABLE table ADD" command
using the Perl library.

The sqlite3 command line tool works fine:

$ sqlite3 test2.db
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> CREATE TABLE data (foo INTEGER);
sqlite> ALTER TABLE data ADD bar INTEGER;
sqlite> .schema data
CREATE TABLE data (foo INTEGER, bar INTEGER);

Now the same in a perl script using libdbd-sqlite3-perl:
---------------------------------------------------------------
#!/usr/bin/perl -w

use DBI;

use strict;

sub docmd ($);

my $dbh = DBI -> connect('dbi:SQLite:dbname=test.db', '', '') or die;

docmd ('CREATE TABLE data (foo INTEGER)');
docmd ("ALTER TABLE data ADD bar INTEGER");

sub docmd ($) {
    my $q = $_[0];
    my $sth;
    ($sth  = $dbh -> prepare ($q)) ||
        die "cannot prepare $q: $DBI::errstr";
    ($sth -> execute ()) ||
        die "cannot execute $q: $DBI::errstr";
}
---------------------------------------------------------------
This results in:

$ perl -w /tmp/test_sqlite DBD::SQLite::db prepare failed: near "ADD": syntax error(1) at dbdimp.c
line 268 at /tmp/test_sqlite line 17.
cannot prepare ALTER TABLE data ADD bar INTEGER: near "ADD": syntax
error(1) at dbdimp.c line 268 at /tmp/test_sqlite line 17.

Please assist. I need the ability to add columns add a later time.


Cannot confirm. Your example:


[EMAIL PROTECTED]:/tmp$ perl ./test.pl
[EMAIL PROTECTED]:/tmp$ sqlite3 test.db
SQLite version 3.2.8
Enter ".help" for instructions
sqlite> .schema data
CREATE TABLE data (foo INTEGER, bar INTEGER);

Please check if DBD::SQLite came from libdbd-sqlite3-perl

  eloy
--
[EMAIL PROTECTED]

       jak to dobrze, że są oceany - bez nich byłoby jeszcze smutniej

Reply via email to