I have a problem disabling validation of the connection in Apache::DBI
.
Apache::DBI->setPingTimeOut($data_source, $timeout)
This configures the usage of the ping method, to validate a connection. Setting the timeout to 0 will always validate the database connection using the ping method (default). Setting the timeout < 0 开发者_如何学编程will de-activate the validation of the database handle.
I tried calling setPingTimeOut
with the same $data_source as in connect()
but it didn't work. Did anyone manage to disable the pings?
To clarify, the code has:
# use a DSN without attribute settings specified within !
sub setPingTimeOut {
my $class = shift;
my $data_source = shift;
my $timeout = shift;
# sanity check
if ($data_source =~ /dbi:\w+:.*/ and $timeout =~ /\-*\d+/) {
$PingTimeOut{$data_source} = $timeout;
}
}
Note the 'sanity check'. Hence ping timeout for a data source name with uppercase 'DBI:' will be silently ignored.
精彩评论