开发者

How can I disable pings in Apache::DBI?

I have a problem disabling validation of the connection in Apache::DBI.

From the 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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜