Skip to content
Snippets Groups Projects
Commit 843eec00 authored by Graham McVicker's avatar Graham McVicker
Browse files

DBConnection::disconnect_if_idle now uses $dbh->{Kids} instead of...

DBConnection::disconnect_if_idle now uses $dbh->{Kids} instead of $dbh->{ActiveKids} to prevent problems with multiple prepared statement handles
parent c14e1a2a
No related branches found
No related tags found
No related merge requests found
......@@ -179,12 +179,14 @@ sub connect {
$dbh = DBI->connect($dsn,
$self->username(),
$self->password(),
{RaiseError => 1});
{'RaiseError' => 1});
};
$dbh || throw("Could not connect to database " . $self->dbname() .
" as user " . $self->username() .
" using [$dsn] as a locator:\n" . $DBI::errstr);
if(!$dbh || $@) {
throw("Could not connect to database " . $self->dbname() .
" as user " . $self->username() .
" using [$dsn] as a locator:\n" . $DBI::errstr);
}
$self->db_handle($dbh);
......@@ -446,7 +448,6 @@ sub prepare {
# return an overridden statement handle that provides us with
# the means to disconnect inactive statement handles automatically
bless $sth, "Bio::EnsEMBL::DBSQL::StatementHandle";
$sth->dbc($self);
return $sth;
......@@ -516,7 +517,7 @@ sub do {
sub disconnect_if_idle {
my $self = shift;
if(!$self->db_handle()->{'ActiveKids'} &&
if(!$self->db_handle()->{'Kids'} &&
!$self->db_handle()->{'InactiveDestroy'}) {
$self->db_handle->disconnect();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment