From: Sébastien Santoro Date: Thu, 31 Jan 2019 01:50:01 +0000 (-0500) Subject: Bug 1497042 - Enclose table names in CREATE queries X-Git-Tag: release-5.0.6~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62d5637a4c96abbcde6f308421d676a0336d8e25;p=thirdparty%2Fbugzilla.git Bug 1497042 - Enclose table names in CREATE queries --- diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index b5bebad305..0af73cc8f0 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -135,8 +135,12 @@ sub _get_create_table_ddl { my $charset = Bugzilla->dbh->bz_db_is_utf8 ? "CHARACTER SET utf8" : ''; my $type = grep($_ eq $table, MYISAM_TABLES) ? 'MYISAM' : 'InnoDB'; - return ( - $self->SUPER::_get_create_table_ddl($table) . " ENGINE = $type $charset"); + + my $ddl = $self->SUPER::_get_create_table_ddl($table); + $ddl =~ s/CREATE TABLE (.*) \(/CREATE TABLE `$1` (/; + $ddl .= " ENGINE = $type $charset"; + + return $ddl; } #eosub--_get_create_table_ddl @@ -151,7 +155,7 @@ sub _get_create_index_ddl { my $sql = "CREATE "; $sql .= "$index_type " if ($index_type eq 'UNIQUE' || $index_type eq 'FULLTEXT'); - $sql .= "INDEX \`$index_name\` ON $table_name \(" + $sql .= "INDEX \`$index_name\` ON \`$table_name\` \(" . join(", ", @$index_fields) . "\)"; return ($sql);