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

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-06-27 Michal Cihar <nijel@users.sourceforge.net>
* libraries/display_tbl.lib.php3, libraries/relation.lib.php3: Added some
checks to avoid trying to use relations when no table (bug #761835).
2003-06-27 Marc Delisle <lem9@users.sourceforge.net>
* sql.php3: bug 760648: incorrect result count on MySQL 3

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

View File

@@ -305,7 +305,7 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
} // end while
}
if ($source == 'both' || $source == 'innodb') {
if (($source == 'both' || $source == 'innodb') && !empty($table)) {
$show_create_table_query = 'SHOW CREATE TABLE '
. PMA_backquote($db) . '.' . PMA_backquote($table);
$show_create_table_res = PMA_mysql_query($show_create_table_query);