diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index 094b588..a105d60 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -952,6 +952,34 @@ Note that this works only when all of the connections use the same (non-deferred) transaction. See L for locking details. +=head2 C<< $sth->finish >> and Transaction Rollback + +As the L doc says, you almost certainly do B need to +call L method if you fetch all rows (probably in a loop). +However, there are several exceptions to this rule, and rolling-back +of an unfinished C statements in +a transaction (See L for +details). So you need to call C before you issue a rollback. + + $sth = $dbh->prepare("SELECT * FROM t"); + $dbh->begin_work; + eval { + $sth->execute; + $row = $sth->fetch; + ... + die "For some reason"; + ... + }; + if($@) { + $sth->finish; # You need this for SQLite + $dbh->rollback; + } else { + $dbh->commit; + } + =head2 Processing Multiple Statements At A Time L's statement handle is not supposed to process multiple