How to disable pings in Apache :: DBI?

I have a problem with disabling connection check in Apache::DBI.
From perldoc :

Apache :: DBI-> setPingTimeOut ($ data_source, $ Timeout)

This sets up the use of the ping method to verify the connection. Setting the timeout to 0 will always check the database connection using the ping method (default). Setting a timeout <0 will deactivate the validation of the database descriptor.

I tried calling setPingTimeOutwith the same $ data_source as in connect(), but that didn't work. Could anyone disable ping?

+3
source share
1 answer

, 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;
    }
}

" ". , - ping "DBI:" .

+4

Source: https://habr.com/ru/post/1780690/


All Articles