die early if db connection fails

This commit is contained in:
Isaac Connor 2020-06-07 11:57:20 -04:00
parent d59697b9b5
commit 58ae7bb342
1 changed files with 3 additions and 0 deletions

View File

@ -119,6 +119,9 @@ GetOptions(
) or pod2usage(-exitstatus => -1); ) or pod2usage(-exitstatus => -1);
my $dbh = zmDbConnect(undef, { mysql_multi_statements=>1 } ); my $dbh = zmDbConnect(undef, { mysql_multi_statements=>1 } );
if ( !$dbh ) {
die "Unable to connect to db\n";
}
$Config{ZM_DB_USER} = $dbUser; $Config{ZM_DB_USER} = $dbUser;
$Config{ZM_DB_PASS} = $dbPass; $Config{ZM_DB_PASS} = $dbPass;
# we escape dbpass with single quotes so that $ in the password has no effect, but dbpass could have a ' in it. # we escape dbpass with single quotes so that $ in the password has no effect, but dbpass could have a ' in it.