diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index 724a3315de..e3c8cd2865 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -91,8 +91,8 @@ class PMA_DatabaseInterface * Caches table data so PMA_Table does not require to issue * SHOW TABLE STATUS again * - * @param array $tables information for tables of some databases - * @param string|bool $table table name or false + * @param array $tables information for tables of some databases + * @param string $table table name * * @return void */ @@ -304,16 +304,16 @@ class PMA_DatabaseInterface /** * returns a segment of the SQL WHERE clause regarding table name and type * - * @param string|bool $table table or false - * @param boolean $tbl_is_group $table is a table group - * @param string $table_type whether table or view + * @param string $table table + * @param boolean $tbl_is_group $table is a table group + * @param string $table_type whether table or view * * @return string a segment of the WHERE clause */ private function _getTableCondition($table, $tbl_is_group, $table_type) { // get table information from information_schema - if ($table && is_string($table)) { + if ($table) { if (true === $tbl_is_group) { $sql_where_table = 'AND t.`TABLE_NAME` LIKE \'' . PMA_Util::escapeMysqlWildcards( @@ -445,7 +445,7 @@ class PMA_DatabaseInterface * * * @param string $database database - * @param string|bool $table table name or false + * @param string $table table name * @param boolean $tbl_is_group $table is a table group * @param mixed $link mysql link * @param integer $limit_offset zero-based offset for the count @@ -458,7 +458,7 @@ class PMA_DatabaseInterface * * @return array list of tables in given db(s) */ - public function getTablesFull($database, $table = false, + public function getTablesFull($database, $table = '', $tbl_is_group = false, $link = null, $limit_offset = 0, $limit_count = false, $sort_by = 'Name', $sort_order = 'ASC', $table_type = null diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 0c11678d0d..6cd6787469 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -757,7 +757,7 @@ class PMA_Util if ($tables === null) { $tables = $GLOBALS['dbi']->getTablesFull( - $db, false, false, null, $limit_offset, $limit_count + $db, '', false, null, $limit_offset, $limit_count ); if ($GLOBALS['cfg']['NaturalOrder']) { uksort($tables, 'strnatcasecmp'); diff --git a/libraries/tbl_relation.lib.php b/libraries/tbl_relation.lib.php index 8179b05608..44faf5c94e 100644 --- a/libraries/tbl_relation.lib.php +++ b/libraries/tbl_relation.lib.php @@ -1108,24 +1108,24 @@ function PMA_handleUpdateForForeignKey($multi_edit_columns_name, $master_field_m $existrel_foreign[$master_field_md5]['on_update']) ? $existrel_foreign[$master_field_md5]['on_update'] : 'RESTRICT'; - } - if (! isset($existrel_foreign[$master_field_md5])) { + if ($ref_db_name != $foreign_db + || $existrel_foreign[$master_field_md5]['ref_table_name'] != $foreign_table + || $existrel_foreign[$master_field_md5]['ref_index_list'] != $foreign_field + || $existrel_foreign[$master_field_md5]['index_list'] != $master_field + || $_REQUEST['constraint_name'][$master_field_md5] != $constraint_name + || ($_REQUEST['on_delete'][$master_field_md5] != $on_delete) + || ($_REQUEST['on_update'][$master_field_md5] != $on_update) + ) { + // another foreign key is already defined for this field + // or an option has been changed for ON DELETE or ON UPDATE + $drop = true; + $create = true; + } // end if... else.... + } else { // no key defined for this field(s) $create = true; - } elseif ($ref_db_name != $foreign_db - || $existrel_foreign[$master_field_md5]['ref_table_name'] != $foreign_table - || $existrel_foreign[$master_field_md5]['ref_index_list'] != $foreign_field - || $existrel_foreign[$master_field_md5]['index_list'] != $master_field - || $_REQUEST['constraint_name'][$master_field_md5] != $constraint_name - || ($_REQUEST['on_delete'][$master_field_md5] != $on_delete) - || ($_REQUEST['on_update'][$master_field_md5] != $on_update) - ) { - // another foreign key is already defined for this field - // or an option has been changed for ON DELETE or ON UPDATE - $drop = true; - $create = true; - } // end if... else.... + } } elseif (isset($existrel_foreign[$master_field_md5])) { $drop = true; } // end if... else....