escape table columns for mysql8

This commit is contained in:
Isaac Connor 2020-03-03 17:29:31 -05:00
parent 7046612b65
commit 576e3149d6
1 changed files with 5 additions and 5 deletions

View File

@ -214,7 +214,7 @@ sub getUUID {
$uuid = $Config{ZM_TELEMETRY_UUID} = $sth->fetchrow_array(); $uuid = $Config{ZM_TELEMETRY_UUID} = $sth->fetchrow_array();
$sth->finish(); $sth->finish();
$sql = q`UPDATE Config set Value = ? WHERE Name = 'ZM_TELEMETRY_UUID'`; $sql = q`UPDATE Config SET Value = ? WHERE Name = 'ZM_TELEMETRY_UUID'`;
$sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
$res = $sth->execute( "$uuid" ) or die( "Can't execute: ".$sth->errstr() ); $res = $sth->execute( "$uuid" ) or die( "Can't execute: ".$sth->errstr() );
$sth->finish(); $sth->finish();
@ -250,9 +250,9 @@ sub countQuery {
my $dbh = shift; my $dbh = shift;
my $table = shift; my $table = shift;
my $sql = "SELECT count(*) FROM $table"; my $sql = "SELECT count(*) FROM `$table`";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached($sql) or die "Can't prepare '$sql': ".$dbh->errstr();
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); my $res = $sth->execute() or die 'Can\'t execute: '.$sth->errstr();
my $count = $sth->fetchrow_array(); my $count = $sth->fetchrow_array();
$sth->finish(); $sth->finish();
@ -263,7 +263,7 @@ sub countQuery {
sub getMonitorRef { sub getMonitorRef {
my $dbh = shift; my $dbh = shift;
my $sql = 'SELECT Id,Name,Type,Function,Width,Height,Colours,MaxFPS,AlarmMaxFPS FROM Monitors'; my $sql = 'SELECT `Id`,`Name`,`Type`,`Function`,`Width`,`Height`,`Colours`,`MaxFPS`,`AlarmMaxFPS` FROM `Monitors`';
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() ); my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
my $arrayref = $sth->fetchall_arrayref({}); my $arrayref = $sth->fetchall_arrayref({});