private function _loadRelationsForTable(&$relations, $oneTable)
{
$relations[$oneTable] = array();
$foreigners = PMA_getForeigners($GLOBALS['db'], $oneTable);
foreach ($foreigners as $field => $foreigner) {
// Foreign keys data
if ($field == 'foreign_keys_data') {
foreach ($foreigner as $oneKey) {
$clauses = array();
// There may be multiple column relations
foreach ($oneKey['index_list'] as $index => $oneField) {
$clauses[] = Util::backquote($oneTable) . "." . Util::backquote($oneField) . " = " . Util::backquote($oneKey['ref_table_name']) . "." . Util::backquote($oneKey['ref_index_list'][$index]);
}
// Combine multiple column relations with AND
$relations[$oneTable][$oneKey['ref_table_name']] = implode(" AND ", $clauses);
}
} else {
// Internal relations
$relations[$oneTable][$foreigner['foreign_table']] = Util::backquote($oneTable) . "." . Util::backquote($field) . " = " . Util::backquote($foreigner['foreign_table']) . "." . Util::backquote($foreigner['foreign_field']);
}
}
}