diff options
author | 2019-01-30 20:50:01 -0500 | |
---|---|---|
committer | 2019-01-30 20:50:01 -0500 | |
commit | 62d5637a4c96abbcde6f308421d676a0336d8e25 (patch) | |
tree | 9fc19ace7c1badd036fa80f1cb712b86a93cc9e5 | |
parent | update release notes (diff) | |
download | bugzilla-62d5637a4c96abbcde6f308421d676a0336d8e25.tar.gz bugzilla-62d5637a4c96abbcde6f308421d676a0336d8e25.tar.bz2 bugzilla-62d5637a4c96abbcde6f308421d676a0336d8e25.zip |
Bug 1497042 - Enclose table names in CREATE queries
-rw-r--r-- | Bugzilla/DB/Schema/Mysql.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index b5bebad30..0af73cc8f 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); |