From: Peter Rabbitson Date: Tue, 26 Jan 2010 09:10:11 +0000 (+0000) Subject: Fix txn_begin on external non-AC coderef regression X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3eee36aa81bcc92e08856b64a08ea099316b55ff;p=dbsrgits%2FDBIx-Class-Historic.git Fix txn_begin on external non-AC coderef regression --- diff --git a/Changes b/Changes index f4fdf02..ef4b4a3 100644 --- a/Changes +++ b/Changes @@ -1,18 +1,15 @@ Revision history for DBIx::Class - - FAQ "Custom methods in Result classes" - Perl 5.8.1 is now the minimum supported version - Subqueries no longer marked experimental - might_have/has_one now warn if applied calling class's column has is_nullable set to true. - Fixed regression in deploy() with a {sources} table limit applied (RT#52812) - - Cookbook POD fix for add_drop_table instead of add_drop_tables - Views without a view_definition will throw an exception when parsed by SQL::Translator::Parser::DBIx::Class - Stop the SQLT parser from auto-adding indexes identical to the Primary Key - - Schema POD improvement for dclone - Fix ResultSetColumn improperly selecting more than the requested column when +columns/+select is present - Fix regression in context sensitiveness of deployment_statements @@ -27,6 +24,10 @@ Revision history for DBIx::Class - New MSSQL specific resultset attribute to allow hacky ordered subquery support - Fix nasty schema/dbhandle leak due to SQL::Translator + - Fix regression on externally supplied $dbh with AutoCommit=0 + - FAQ "Custom methods in Result classes" + - Cookbook POD fix for add_drop_table instead of add_drop_tables + - Schema POD improvement for dclone 0.08115 2009-12-10 09:02:00 (CST) - Real limit/offset support for MSSQL server (via Row_Number) diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 846decc..a4e3964 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -493,7 +493,7 @@ sub connect_info { sub _normalize_connect_info { my ($self, $info_arg) = @_; my %info; - + my @args = @$info_arg; # take a shallow copy for further mutilation # combine/pre-parse arguments depending on invocation style @@ -1050,7 +1050,7 @@ sub _connect { eval { if(ref $info[0] eq 'CODE') { - $dbh = &{$info[0]} + $dbh = $info[0]->(); } else { $dbh = DBI->connect(@info); @@ -1172,6 +1172,11 @@ sub _svp_generate_name { sub txn_begin { my $self = shift; + + # this means we have not yet connected and do not know the AC status + # (e.g. coderef $dbh) + $self->ensure_connected if (! defined $self->_dbh_autocommit); + if($self->{transaction_depth} == 0) { $self->debugobj->txn_begin() if $self->debug;