[Dbix-class] warning for txn_begin() with AutoCommit => 0?

apv apv at sedition.com
Fri Jan 20 01:54:36 CET 2006


I accidentally sent this to Matt as well, resent to the list:

On Thursday, January 19, 2006, at 04:38  PM, apv wrote:
> I added a txn_begin to my tests
>  ok( Ego::DB->txn_begin )
> and the test failed. Looking at the code for DBIx::Class::Storage::DBI
> I see it was because I had AutoCommit off.
>
> sub txn_begin {
>   $_[0]->dbh->begin_work if $TRANSACTION++ == 0 and 
> $_[0]->dbh->{AutoCommit};
> }
>
> Mabye it's a good place for a warning? Something like--
>
> sub txn_begin {
>   warn "Useless use of txn_begin with AutoCommit off"
>     unless $_[0]->dbh->{AutoCommit};
>   $_[0]->dbh->begin_work if $TRANSACTION++ == 0 and 
> $_[0]->dbh->{AutoCommit};
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 682 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060119/3b250a5c/attachment-0001.bin


More information about the Dbix-class mailing list