remove _pretty_print
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase.pm
index fc5ae30..eeb4f01 100644 (file)
@@ -9,8 +9,9 @@ use base qw/
 /;
 use mro 'c3';
 use Carp::Clan qw/^DBIx::Class/;
-use List::Util ();
-use Sub::Name ();
+use List::Util();
+use Sub::Name();
+use Data::Dumper::Concise();
 
 __PACKAGE__->mk_group_accessors('simple' =>
     qw/_identity _blob_log_on_update _writer_storage _is_extra_storage
@@ -508,13 +509,13 @@ EOF
   if (not $use_bulk_api) {
     my $blob_cols = $self->_remove_blob_cols_array($source, $cols, $data);
 
-    my $dumb_last_insert_id =
-         $identity_col
-      && (not $is_identity_insert)
-      && ($self->_identity_method||'') ne '@@IDENTITY';
+# _execute_array uses a txn anyway, but it ends too early in case we need to
+# select max(col) to get the identity for inserting blobs.
+    ($self, my $guard) = $self->{transaction_depth} == 0 ? 
+      ($self->_writer_storage, $self->_writer_storage->txn_scope_guard)
+      :
+      ($self, undef);
 
-    $self     = $self->_writer_storage;
-    my $guard = $self->txn_scope_guard;
     local $self->{insert_bulk} = 1;
 
     $self->next::method(@_);
@@ -543,7 +544,8 @@ EOF
       }
     }
 
-    $guard->commit;
+    $guard->commit if $guard;
+
     return;
   }
 
@@ -660,6 +662,15 @@ EOF
   }
 }
 
+sub _dbh_execute_array {
+  my ($self, $sth, $tuple_status, $cb) = @_;
+
+  my $rv = $self->next::method($sth, $tuple_status);
+  $cb->() if $cb;
+
+  return $rv;
+}
+
 # Make sure blobs are not bound as placeholders, and return any non-empty ones
 # as a hash.
 sub _remove_blob_cols {
@@ -769,7 +780,7 @@ sub _insert_blobs {
 
       $self->throw_exception(
           "Could not find row in table '$table' for blob update:\n"
-        . $self->_pretty_print (\%where)
+        . Data::Dumper::Concise::Dumper (\%where)
       );
     }