mysql-如何禁用Apache :: DBI中的ping?
作者:互联网
我在禁用Apache :: DBI中的连接验证时遇到问题.
从perldoc:
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.
我尝试使用与connect()中相同的$data_source调用setPingTimeOut,但是它不起作用.有人设法禁用ping吗?
解决方法:
需要说明的是,code具有:
# 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;
}
}
注意“健全性检查”.因此,对带有大写字母“ DBI:”的数据源名称执行ping超时将被静默忽略.
标签:dbi,mod-perl2,persistence,mysql,perl 来源: https://codeday.me/bug/20191105/1996236.html