Added some checks to avoid trying to use relations when no table (bug #761835).

This commit is contained in:
Michal Čihař
2003-06-27 13:58:45 +00:00
parent f320c80dee
commit dd4295651c
3 changed files with 18 additions and 10 deletions

View File

@@ -1625,15 +1625,19 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
$tabs = '(\'' . join('\',\'', $target) . '\')';
if ($cfgRelation['displaywork']) {
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
while (list($master_field,$rel) = each($exist_rel)) {
$display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'],
$rel['foreign_field'],
$display_field,
$rel['foreign_db']);
} // end while
if (empty($table)) {
$exist_rel = FALSE;
} else {
$exist_rel = PMA_getForeigners($db, $table, '', 'both');
if ($exist_rel) {
while (list($master_field,$rel) = each($exist_rel)) {
$display_field = PMA_getDisplayField($rel['foreign_db'],$rel['foreign_table']);
$map[$master_field] = array($rel['foreign_table'],
$rel['foreign_field'],
$display_field,
$rel['foreign_db']);
} // end while
} // end if
} // end if
} // end if
// end 2b