Merge pull request #454 from MorpheusXAUT/bug-452

Properly quoted database name during USE queries to avoid MySQL parse errors
This commit is contained in:
Mark Friedrich
2017-03-11 13:35:50 +01:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -925,7 +925,7 @@ class Setup extends Controller {
$checkTables = [];
if($db){
// set/change default "character set" and "collation"
$db->exec('ALTER DATABASE ' . $db->name()
$db->exec('ALTER DATABASE ' . $db->quotekey($db->name())
. ' CHARACTER SET ' . self::getRequiredMySqlVariables('CHARACTER_SET_DATABASE')
. ' COLLATE ' . self::getRequiredMySqlVariables('COLLATION_DATABASE')
);

View File

@@ -52,7 +52,7 @@ class TableModifier extends SQL\TableModifier {
':constraint_name' => $constraintName
]);
// switch back to current DB
$this->db->exec("USE " . $this->db->name());
$this->db->exec("USE " . $this->db->quotekey($this->db->name()));
$constraints = [];
foreach($constraintsData as $data){