[Bast-commits] r3315 -
branches/DBIx-Class-current/lib/DBIx/Class/Storage
blblack at dev.catalyst.perl.org
blblack at dev.catalyst.perl.org
Mon May 14 23:59:07 GMT 2007
Author: blblack
Date: 2007-05-14 23:59:07 +0100 (Mon, 14 May 2007)
New Revision: 3315
Modified:
branches/DBIx-Class-current/lib/DBIx/Class/Storage/DBI.pm
Log:
default AutoCommit to 1 if not explicitly set, and stop warning about it
Modified: branches/DBIx-Class-current/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- branches/DBIx-Class-current/lib/DBIx/Class/Storage/DBI.pm 2007-05-14 22:45:29 UTC (rev 3314)
+++ branches/DBIx-Class-current/lib/DBIx/Class/Storage/DBI.pm 2007-05-14 22:59:07 UTC (rev 3315)
@@ -335,8 +335,9 @@
recommend that you always explicitly set C<AutoCommit> to either
C<0> or C<1>. L<DBIx::Class> further recommends that it be set
to C<1>, and that you perform transactions via our L</txn_do>
-method. L<DBIx::Class> will emit a warning if you fail to explicitly
-set C<AutoCommit> one way or the other. See below for more details.
+method. L<DBIx::Class> will set it to C<1> if you do not do explicitly
+set it to zero. This is the default for most DBDs. See below for more
+details.
In either case, if the final argument in your connect_info happens
to be a hashref, C<connect_info> will look there for several
@@ -482,15 +483,23 @@
pop(@$info) if !keys %$last_info;
}
- # Now check the (possibly new) final argument for AutoCommit,
- # but not in the coderef case, obviously.
if(ref $info->[0] ne 'CODE') {
- $last_info = $info->[3];
- warn "You *really* should explicitly set AutoCommit "
- . "(preferably to 1) in your db connect info"
- if !$last_info
- || ref $last_info ne 'HASH'
- || !defined $last_info->{AutoCommit};
+ # Extend to 3 arguments with undefs, if necessary
+ while(scalar(@$info) < 3) { push(@$info, undef) }
+
+ # Complain if 4th argument is defined and is not a HASH
+ if(defined $info->[3] && ref $info->[3] ne 'HASH') {
+ warn "4th argument of DBI connect info is defined "
+ . " but is not a hashref!";
+ }
+
+ # Set AutoCommit to 1 if not specified manually
+ else {
+ $info->[3] ||= {};
+ if(!defined $info->[3]->{AutoCommit}) {
+ $info->[3]->{AutoCommit} = 1;
+ }
+ }
}
$self->_connect_info($info);
More information about the Bast-commits
mailing list