[Bast-commits] r7748 - 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
Wed Sep 30 01:48:38 GMT 2009


Author: caelum
Date: 2009-09-30 01:48:38 +0000 (Wed, 30 Sep 2009)
New Revision: 7748

Modified:
   DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
fix insert_bulk when not using bulk api inside a txn

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-30 00:35:26 UTC (rev 7747)
+++ DBIx-Class/0.08/branches/sybase_bulkinsert_support/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-30 01:48:38 UTC (rev 7748)
@@ -513,8 +513,11 @@
       && (not $is_identity_insert)
       && ($self->_identity_method||'') ne '@@IDENTITY';
 
-    $self     = $self->_writer_storage;
-    my $guard = $self->txn_scope_guard;
+    ($self, my $guard) = $self->{transaction_depth} == 0 ? 
+      ($self->_writer_storage, $self->_writer_storage->txn_scope_guard)
+      :
+      ($self, undef);
+
     local $self->{insert_bulk} = 1;
 
     $self->next::method(@_);
@@ -543,7 +546,8 @@
       }
     }
 
-    $guard->commit;
+    $guard->commit if $guard;
+
     return;
   }
 




More information about the Bast-commits mailing list