Cleanup exception handling
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI.pm
index b75ac87..e33b77f 100644 (file)
@@ -1002,6 +1002,8 @@ sub _connect {
             $weak_self->throw_exception("DBI Exception: $_[0]");
           }
           else {
+            # the handler may be invoked by something totally out of
+            # the scope of DBIC
             croak ("DBI Exception: $_[0]");
           }
       };
@@ -1339,12 +1341,7 @@ sub insert_bulk {
   my %colvalues;
   my $table = $source->from;
   @colvalues{@$cols} = (0..$#$cols);
-
-  my ($sql, $bind) = $self->_prep_for_execute (
-    'insert', undef, $source, [\%colvalues]
-  );
-  my @bind = @$bind
-    or croak 'Cannot insert_bulk without support for placeholders';
+  my ($sql, @bind) = $self->sql_maker->insert($table, \%colvalues);
 
   $self->_query_start( $sql, @bind );
   my $sth = $self->sth($sql);
@@ -1376,7 +1373,6 @@ sub insert_bulk {
     $placeholder_index++;
   }
   my $rv = eval { $sth->execute_array({ArrayTupleStatus => $tuple_status}) };
-  $sth->finish;
   if (my $err = $@) {
     my $i = 0;
     ++$i while $i <= $#$tuple_status && !ref $tuple_status->[$i];