[Melbourne-pm] DBI don't start transaction

scottp at dd.com.au scottp at dd.com.au
Mon Jun 8 21:04:31 PDT 2009

Hey Guys 

I have a basic database ($dbh) like this: 

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

I want to do an SQLite attach, which requires no transaction. But DBI automatically does a begin on a do or prepare if no begin was run. I can reconnect to the database withou AutoCommit => 1, do the attach, disconnect, reconnect with AutoCommit => 0, but that is a slow process. 

Example of the error: 
$dbh->do('ATTACH DATABASE "/path/to/other.db" as other'); 
error = "cannot ATTACH database within transaction(1) at dbdimp.c line 403 ..." 

Does anyone know how I can do a "do" without a begin if AutoCommit is off? 


scottp at dd.com.au 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090608/a8c5e121/attachment.html>

More information about the Melbourne-pm mailing list