[Bast-commits] r7745 - in DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage: . DBI

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Tue Sep 29 18:38:15 GMT 2009


Author: caelum
Date: 2009-09-29 18:38:14 +0000 (Tue, 29 Sep 2009)
New Revision: 7745

Modified:
   DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
make insert_bulk atomic

Modified: DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-29 18:16:03 UTC (rev 7744)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-29 18:38:14 UTC (rev 7745)
@@ -512,15 +512,8 @@
       && (not $is_identity_insert)
       && ($self->_identity_method||'') ne '@@IDENTITY';
 
-    ($self, my ($guard)) = do {
-      if ($self->{transaction_depth} == 0 && $blob_cols &&
-          $dumb_last_insert_id) {
-        ($self->_writer_storage, $self->_writer_storage->txn_scope_guard);
-      }
-      else {
-        ($self, undef);
-      }
-    };
+    $self     = $self->_writer_storage;
+    my $guard = $self->txn_scope_guard;
 
     $self->next::method(@_);
 
@@ -548,7 +541,7 @@
       }
     }
 
-    $guard->commit if $guard;
+    $guard->commit;
     return;
   }
 

Modified: DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm	2009-09-29 18:16:03 UTC (rev 7744)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI.pm	2009-09-29 18:38:14 UTC (rev 7745)
@@ -1393,6 +1393,8 @@
 sub _execute_array {
   my ($self, $source, $sth, $bind, $cols, $data, $after_exec_cb) = @_;
 
+  my $guard = $self->txn_scope_guard unless $self->{transaction_depth} != 0;
+
   ## This must be an arrayref, else nothing works!
   my $tuple_status = [];
 
@@ -1444,11 +1446,16 @@
     );
   }
 
+  $guard->commit if $guard;
+
   return $rv;
 }
 
 sub _execute_array_empty {
   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;
@@ -1474,6 +1481,8 @@
 
   $self->throw_exception($exception) if $exception;
 
+  $guard->commit if $guard;
+
   return $count;
 }
 




More information about the Bast-commits mailing list