From: Peter Rabbitson Date: Sun, 18 Mar 2012 19:29:46 +0000 (+0100) Subject: Make sure do_query retries on potentially disconnected $dbh X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=18b0c40a973837e575c9bca14fc1f9ef48d7e482;p=dbsrgits%2FDBIx-Class-Historic.git Make sure do_query retries on potentially disconnected $dbh --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index b7e969f..f31056f 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -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;