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

上一篇:正则表达式一:从宏观上认识正则表达式


下一篇:yum报错:othing provides module(perl:5.26) needed by module perl-DBD-SQLite