gpt4 book ai didi

mysql - 如何在 Apache::DBI 中禁用 ping?

转载 作者:可可西里 更新时间:2023-11-01 08:08:06 26 4
gpt4 key购买 nike

我在 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 超时将被静默忽略。

关于mysql - 如何在 Apache::DBI 中禁用 ping?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4461730/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com