|
Hi,
I'm experiencing an issue with the DBD - SQLite (Perl 5.8.8, DBI 1.52 and DBD-SQLite-1.13) when using prepare(), execute(), commit() sequence in AutoCommit = 0 mode. The problem is quite simple: even after a successful commit the database hasn't been updated. Only the do() followed by commit() update properly the database, but since I'm doing recursively a 10000+ insert, the do() method should be avoid.
Here is the (simplify) section of code which causes the problem:
my $dbh= DBI->connect("dbi:SQLite:$DB_PATH","","",{ AutoCommit => 0});
[...]
my $sql = "INSERT INTO disks VALUES (?, ?, ?, ?)";
my $sth = $dbh->prepare($sql);
for (...)
{
$sth->execute(@arrayOf4Elements);
}
$dbh->commit();
I've test every return values of these call (prepare, execute, commit), all of them return success (1). This sequence work very well if I enable AutoCommit (but I don't want AutoCommit enable because that kills perf). Is there something missing?
This little turn around with do() works properly though (if the commit() isn`t call the database isn't modified, and is modified when called... so I observe a perfectly normal behavior that way but I don't want to do that like this).
my $dbh= DBI->connect("dbi:SQLite:$DB_PATH","","",{ AutoCommit => 0})
[...]
for (...)
{
$dbh->do("INSERT INTO disk VALUES(".join(",",@listOf4Elements).")");
}
$dbh->commit();
Any ideas would be greatly appreciated?
|