Commit 3a698bd6 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #856 from easybiblabs/f/fix-mysql-foreign-all-tables

MySQL getListTableForeignKeysSQL: use current database if null passed
parents cc2d5038 94a6787c
......@@ -189,10 +189,9 @@ class MySqlPlatform extends AbstractPlatform
" c.constraint_name = k.constraint_name AND ".
" c.table_name = '$table' */ WHERE k.table_name = '$table'";
if ($database) {
$sql .= " AND k.table_schema = '$database' /*!50116 AND c.constraint_schema = '$database' */";
}
$databaseNameSql = null === $database ? "'$database'" : 'DATABASE()';
$sql .= " AND k.table_schema = $databaseNameSql /*!50116 AND c.constraint_schema = $databaseNameSql */";
$sql .= " AND k.`REFERENCED_COLUMN_NAME` is not NULL";
return $sql;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment