Thread

Posted on Wed Feb 7 22:23:15 2007 by vaewyn
Auto rollback?
Is there a way to always rollback on dbh destruction? We had (wrongly) assumed that autocommit set off would rollback statements on disconnect. However that does not appear to be the case.

Basically I am trying to NEVER commit unless it is explicitly asked for. Thanks for any info!
Direct Responses: 4282 | Write a response
Posted on Wed Feb 7 22:31:42 2007 by byterock in response to 4281
Re: Auto rollback?
get a connection using AutoCommit => 0 like this $dbh = DBI->connect(DBD::Oracle,$db_user."@".$db_name,$db_password, { AutoCommit => 0} ) by the way few people read this except for me and that is not every day for better and quicker answers try perl.dbi.users user group
Direct Responses: 4283 | Write a response
Posted on Wed Feb 7 22:41:55 2007 by vaewyn in response to 4282
Re: Auto rollback?
Ummm that doesn't work like you think it does...
AutoCommit => 0
just makes it so that each statement doesn't commit itself. Mainly for use in batching and speedups.

From the DBI manpage:
"The transaction behaviour of the "disconnect" method is, sadly, undefined. Some database systems (such as Oracle and Ingres) will automatically commit any outstanding changes, but others (such as Informix) will rollback any outstanding changes. Applications not using "AutoCommit" should explicitly call "commit" or "rollback" before calling "disconnect"."
Even with
AutoCommit=>0
a database handle disconnect of any kind commits any non-rolled-back statements in Oracle.... which is what I am trying to avoid :P

I will check out the other list for help also... thanks!
Write a response