FIX: Don't mistake \ for _ in dev/build

The query SHOW TABLES LIKE 'some_thing' will match the table some\thing.

This causes issues when the namespace separator has changed.

The fix is to escape the _s in this LIKE statement, as done here.
This commit is contained in:
Sam Minnee 2017-03-28 18:14:32 +13:00
parent 6f6a53c17c
commit 59a5eb4308

View File

@ -185,7 +185,8 @@ class MySQLSchemaManager extends DBSchemaManager
public function hasTable($table)
{
// MySQLi doesn't like parameterised queries for some queries
$sqlTable = $this->database->quoteString($table);
// underscores need to be escaped in a SHOW TABLES LIKE query
$sqlTable = str_replace('_', '\\_', $this->database->quoteString($table));
return (bool) ($this->query("SHOW TABLES LIKE $sqlTable")->value());
}