From 4973d8c74cb8a55ad972c336227fc84eb52ec849 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 15 Jan 2017 10:54:46 -0500 Subject: [PATCH] add support for connect options --- scripts/ZoneMinder/lib/ZoneMinder/Database.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index 0ab2aee3b..b2c625071 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -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} );