From: Peter Rabbitson Date: Wed, 5 Aug 2009 10:49:06 +0000 (+0000) Subject: Clarify autocommit default X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d9ab8aefaa5fac33c8fd72f7fd90cd295305bcb;p=dbsrgits%2FDBIx-Class-Historic.git Clarify autocommit default --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index a91346c..109802f 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -441,14 +441,17 @@ sub connect_info { # _connect() never looks past $args[0] in this case %attrs = () } else { - %attrs = (%{ $self->_dbi_connect_attributes }, %attrs); + %attrs = ( + %{ $self->_default_dbi_connect_attributes || {} }, + %attrs, + ); } $self->_dbi_connect_info([@args, keys %attrs ? \%attrs : ()]); $self->_connect_info; } -sub _dbi_connect_attributes { +sub _default_dbi_connect_attributes { return { AutoCommit => 1 }; } @@ -2426,7 +2429,7 @@ sub DESTROY { DBIx::Class can do some wonderful magic with handling exceptions, disconnections, and transactions when you use C<< AutoCommit => 1 >> -combined with C for transaction support. +(the default) combined with C for transaction support. If you set C<< AutoCommit => 0 >> in your connect info, then you are always in an assumed transaction between commits, and you're telling us you'd @@ -2438,7 +2441,6 @@ cases if you choose the C<< AutoCommit => 0 >> path, just as you would be with raw DBI. - =head1 AUTHORS Matt S. Trout