From 52ca2abf69525dc78512935c75dee7cac7629f47 Mon Sep 17 00:00:00 2001 From: Joseph Yasi Date: Fri, 10 Jul 2020 23:10:33 +0200 Subject: [PATCH] Quote some more MySQL8 Reserved keywords See: https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/1859295/comments/1 https://github.com/ZoneMinder/zoneminder/issues/2659 https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/1859295 --- scripts/ZoneMinder/lib/ZoneMinder/Database.pm | 10 +++++----- utils/zm-alarm.pl | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index 9a1c79237..827936b86 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -146,15 +146,15 @@ sub zmDbGetMonitors { if ( $function ) { if ( $function == DB_MON_CAPT ) { - $sql .= " where Function >= 'Monitor'"; + $sql .= " where `Function` >= 'Monitor'"; } elsif ( $function == DB_MON_ACTIVE ) { - $sql .= " where Function > 'Monitor'"; + $sql .= " where `Function` > 'Monitor'"; } elsif ( $function == DB_MON_MOTION ) { - $sql .= " where Function = 'Modect' or Function = 'Mocord'"; + $sql .= " where `Function` = 'Modect' or Function = 'Mocord'"; } elsif ( $function == DB_MON_RECORD ) { - $sql .= " where Function = 'Record' or Function = 'Mocord'"; + $sql .= " where `Function` = 'Record' or Function = 'Mocord'"; } elsif ( $function == DB_MON_PASSIVE ) { - $sql .= " where Function = 'Nodect'"; + $sql .= " where `Function` = 'Nodect'"; } } my $sth = $dbh->prepare_cached( $sql ); diff --git a/utils/zm-alarm.pl b/utils/zm-alarm.pl index d68c82663..92171db99 100755 --- a/utils/zm-alarm.pl +++ b/utils/zm-alarm.pl @@ -16,7 +16,7 @@ my @monitors; my $dbh = zmDbConnect(); my $sql = "SELECT * FROM Monitors - WHERE find_in_set( Function, 'Modect,Mocord,Nodect' )". + WHERE find_in_set( `Function`, 'Modect,Mocord,Nodect' )". ( $Config{ZM_SERVER_ID} ? 'AND ServerId=?' : '' ) ;