Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 95359
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: bitcard.10.drkshadow [...] spamgourmet.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.35
  • 1.40
Fixed in: (no value)



Subject: AutoCommit, begin_work documentation/code conflict
According to http://search.cpan.org/~ishigaki/DBD-SQLite-1.42/lib/DBD/SQLite.pm#Transactions , the default, and preferred, behavior is $dbh->{AutoCommit} = 1. According to this documentation, you can start a transaction to temporarily disable AutoCommit with $dbh->begin_work, and gives an example of doing so. The actual behavior, however, throws an error: my $dbs = $dbh->prepare('SELECT...'); $dbs->execute; ... $dbh->begin_work; DBD::SQLite::db begin_work failed: Already in a transaction at script.pl line XYZ So to get around this, I thought that may be the SELECT statements were causing a transaction to be started. I tried, my $dbs = $dbh->prepare('SELECT...'); $dbs->execute; ... $dbh->commit; $dbh->begin_work; DBD::SQLite::db begin_work failed: Already in a transaction at script.pl line XYZ As you can see, ->begin_work does _not_ suspend AutoCommit (at least, not silently) to start a new transaction. I suspect (but haven't tested) that it doesn't start a transaction encompassing more than the single next statement.
From: bitcard.10.drkshadow [...] spamgourmet.com
Show quoted text
> As you can see, ->begin_work does _not_ suspend AutoCommit
My mistake -- this happens only when ->{AutoCommit} = 0.