Unexpected error with DBD::SQLite

Unexpected error with DBD::SQLite

am 14.03.2007 02:40:41 von oudeis

This program produces an error which looks wrong to me:

-------------------------------------------------------
#!/usr/bin/env perl
use strict;
use DBI;

my $dbh = DBI->connect('dbi:SQLite:test.db', '', '',
{ AutoCommit => 1,
PrintError => 0,
RaiseError => 1 });

eval { $dbh->do("drop table X"); };

$dbh->do("create table X(a TEXT, b TEXT, unique(a, b))");

my $sth = $dbh->prepare("insert into X(a, b) values('N', ?)");

$sth->execute('1.1');
$sth->execute('1.10');
-------------------------------------------------------

When run, I see:

$ ./test-sqlite.pl
DBD::SQLite::st execute failed: columns a, b are not unique(1) at
dbdimp.c line 401 at ./test-sqlite.pl line 17.

Is this correct behaviour?

- Will

RE: Unexpected error with DBD::SQLite

am 14.03.2007 14:11:52 von Philip.Garrett

This works on my (admittedly ancient) DBD::SQLite v1.11.

However, if you're running version 2, this looks like it might be a bug
in DBD::SQLite, based on the first section of "5.0 Examples" here:
http://www.sqlite.org/datatypes.html.

It might be helpful to submit a defect on rt.cpan.org per the
DBD::SQLite docs.

- Philip=20

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Will Parsons
Sent: Tuesday, March 13, 2007 9:41 PM
To: dbi-users@perl.org
Subject: Unexpected error with DBD::SQLite

This program produces an error which looks wrong to me:

-------------------------------------------------------
#!/usr/bin/env perl
use strict;
use DBI;

my $dbh =3D DBI->connect('dbi:SQLite:test.db', '', '',
{ AutoCommit =3D> 1,
PrintError =3D> 0,
RaiseError =3D> 1 });

eval { $dbh->do("drop table X"); };

$dbh->do("create table X(a TEXT, b TEXT, unique(a, b))");

my $sth =3D $dbh->prepare("insert into X(a, b) values('N', ?)");

$sth->execute('1.1');
$sth->execute('1.10');
-------------------------------------------------------

When run, I see:

$ ./test-sqlite.pl=20
DBD::SQLite::st execute failed: columns a, b are not unique(1) at=20
dbdimp.c line 401 at ./test-sqlite.pl line 17.

Is this correct behaviour?

- Will