add support for connect options

This commit is contained in:
Isaac Connor 2017-01-15 10:54:46 -05:00
parent d24d151f53
commit 4973d8c74c
1 changed files with 3 additions and 1 deletions

View File

@ -75,6 +75,8 @@ sub zmDbConnect {
if ( $force ) {
zmDbDisconnect();
}
my $options = shift;
if ( ( ! defined( $dbh ) ) or ! $dbh->ping() ) {
my ( $host, $portOrSocket ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
my $socket;
@ -89,7 +91,7 @@ sub zmDbConnect {
$socket = ";host=".$Config{ZM_DB_HOST};
}
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
.$socket
.$socket . ($options?'.'.join(';', map { $_.'='.$$options{$_} } keys %{$options} ))
, $Config{ZM_DB_USER}
, $Config{ZM_DB_PASS}
);