From: Rafael Kitover Date: Wed, 30 Sep 2009 01:48:38 +0000 (+0000) Subject: fix insert_bulk when not using bulk api inside a txn X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8195240c3f2be9f5731a0812f7868cbc23ba83e8;p=dbsrgits%2FDBIx-Class-Historic.git fix insert_bulk when not using bulk api inside a txn --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index fc5ae30..3a8531d 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -513,8 +513,11 @@ EOF && (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 @@ EOF } } - $guard->commit; + $guard->commit if $guard; + return; }