Escape identifiers in table column metrics

Otherwise some queries may fail if reserved words were used as field, table or
database names.
This commit is contained in:
Eduardo Broto 2019-07-10 17:25:23 +02:00
parent 42a9586aaf
commit ece5671292

View file

@ -5994,7 +5994,7 @@ sub mysql_tables {
my $current_type = my $current_type =
uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" ); uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" );
my $optimal_type = select_str_g( "Optimal_fieldtype", my $optimal_type = select_str_g( "Optimal_fieldtype",
"SELECT $_ FROM $dbname.$tbname PROCEDURE ANALYSE(100000)" "SELECT \\`$_\\` FROM \\`$dbname\\`.\\`$tbname\\` PROCEDURE ANALYSE(100000)"
); );
if ( not defined($optimal_type) or $optimal_type eq '' ) { if ( not defined($optimal_type) or $optimal_type eq '' ) {
infoprint " Current Fieldtype: $current_type"; infoprint " Current Fieldtype: $current_type";
@ -6006,7 +6006,7 @@ sub mysql_tables {
badprint badprint
"Consider changing type for column $_ in table $dbname.$tbname"; "Consider changing type for column $_ in table $dbname.$tbname";
push( @generalrec, push( @generalrec,
"ALTER TABLE $dbname.$tbname MODIFY $_ $optimal_type;" "ALTER TABLE \`$dbname\`.\`$tbname\` MODIFY \`$_\` $optimal_type;"
); );
} }