[Bast-commits] r8459 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Jan 28 10:13:16 GMT 2010
Author: ribasushi
Date: 2010-01-28 10:13:16 +0000 (Thu, 28 Jan 2010)
New Revision: 8459
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Consolidate insert_bulk guards (and make them show up correctly in the trace)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2010-01-27 20:38:42 UTC (rev 8458)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2010-01-28 10:13:16 UTC (rev 8459)
@@ -1468,9 +1468,13 @@
);
}
+ # neither _execute_array, nor _execute_inserts_with_no_binds are
+ # atomic (even if _execute _array is a single call). Thus a safety
+ # scope guard
+ my $guard = $self->txn_scope_guard unless $self->{transaction_depth} != 0;
+
$self->_query_start( $sql, ['__BULK__'] );
my $sth = $self->sth($sql);
-
my $rv = do {
if ($empty_bind) {
# bind_param_array doesn't work if there are no binds
@@ -1484,14 +1488,15 @@
$self->_query_end( $sql, ['__BULK__'] );
+
+ $guard->commit if $guard;
+
return (wantarray ? ($rv, $sth, @bind) : $rv);
}
sub _execute_array {
my ($self, $source, $sth, $bind, $cols, $data, @extra) = @_;
- my $guard = $self->txn_scope_guard unless $self->{transaction_depth} != 0;
-
## This must be an arrayref, else nothing works!
my $tuple_status = [];
@@ -1540,9 +1545,6 @@
}),
);
}
-
- $guard->commit if $guard;
-
return $rv;
}
@@ -1555,8 +1557,6 @@
sub _dbh_execute_inserts_with_no_binds {
my ($self, $sth, $count) = @_;
- my $guard = $self->txn_scope_guard unless $self->{transaction_depth} != 0;
-
eval {
my $dbh = $self->_get_dbh;
local $dbh->{RaiseError} = 1;
@@ -1572,8 +1572,6 @@
$self->throw_exception($exception) if $exception;
- $guard->commit if $guard;
-
return $count;
}
More information about the Bast-commits
mailing list