Subject: | multiple INSERTIONs won't work if you have more than 1 STH opened/cached |
I'm sending to you a script that shows a strange error when using insertions. The problems exits when you open a STH for insertion, create and execute a 2nd STH, than you execute the 1st STH.
When I was using DBD::SQlite 0.25 everything worked fine, but from version 0.27 not! I tested with this versions:
0.25 - OK
0.26 - OK
0.27 - ERROR
0.29 - ERROR
0.31 - ERROR
I'm on Win32 with Perl-5.6.1 (standart).
I also have tested with DBI 1.37 and 1.42, and the DBI version is not influencing in the error. I tried to isolate the error in the script attached to help in the fix.
Thanks to turn SQLITE available for the Perl community.
Best regards,
Graciliano M. P.
use DBI ;
my $db = 'testerror.db' ;
unlink($db) ;
my $dbh = DBI->connect("dbi:SQLite:dbname=$db", '' , '' , { RaiseError => 0 , PrintError => 1 , AutoCommit => 1 }) ;
$dbh->do('CREATE TABLE words (word TEXT , ids TEXT , id INTEGER PRIMARY KEY)') ;
for (1..3) {
print "______________________________________\n" ;
print "LOOP $_\n" ;
my $sth = $dbh->prepare('INSERT INTO words VALUES (?,?,?)') ;
$sth->{ShowErrorStatement} = 1 ;
my $sth2 ;
$sth2 = $dbh->prepare( 'SELECT * FROM words LIMIT 1' ) ;
$sth2->execute ;
$sth->execute('q',2,undef) ;
}