From: Dobrica Pavlinusic Date: Mon, 19 Apr 2010 13:48:35 +0000 (+0000) Subject: use connect_cached so we will reconnect when mysql drops connection X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=commitdiff_plain;h=455a72f2613cd8b182b03972cdd1160a40198dc6;ds=sidebyside use connect_cached so we will reconnect when mysql drops connection --- diff --git a/lib/LDAP/Koha.pm b/lib/LDAP/Koha.pm index b0c726c..540d278 100644 --- a/lib/LDAP/Koha.pm +++ b/lib/LDAP/Koha.pm @@ -39,8 +39,6 @@ $SIG{__DIE__} = sub { require 'config.pl' if -e 'config.pl'; -my $dbh = DBI->connect($dsn . $database, $user,$passwd, { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr; - # we need reverse LDAP -> SQL mapping for where clause my $ldap_sql_mapping = { @@ -208,6 +206,7 @@ sub search { ; warn "# SQL:\n$sql\n# DATA: ",dump( @values ); + my $dbh = DBI->connect_cached($dsn . $database, $user,$passwd, { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr; my $sth = $dbh->prepare( $sql ); $sth->execute( @values );