Make sure do_query retries on potentially disconnected $dbh
Peter Rabbitson [Sun, 18 Mar 2012 19:29:46 +0000 (20:29 +0100)]
lib/DBIx/Class/Storage/DBI.pm

index b7e969f..f31056f 100644 (file)
@@ -1216,9 +1216,11 @@ sub _do_query {
     my $attrs = shift @do_args;
     my @bind = map { [ undef, $_ ] } @do_args;
 
-    $self->_query_start($sql, \@bind);
-    $self->_get_dbh->do($sql, $attrs, @do_args);
-    $self->_query_end($sql, \@bind);
+    $self->dbh_do(sub {
+      $_[0]->_query_start($sql, \@bind);
+      $_[1]->do($sql, $attrs, @do_args);
+      $_[0]->_query_end($sql, \@bind);
+    });
   }
 
   return $self;