bug #1614004 [relation] foreign key spanning multiple columns are incorrectly displayed
This commit is contained in:
@@ -390,13 +390,16 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
|
||||
|
||||
foreach ($analyzed_sql[0]['foreign_keys'] AS $one_key) {
|
||||
|
||||
// the analyzer may return more than one column name in the
|
||||
// index list or the ref_index_list
|
||||
foreach ($one_key['index_list'] AS $i => $field) {
|
||||
// The analyzer may return more than one column name in the
|
||||
// index list or the ref_index_list; if this happens,
|
||||
// the current logic just discards the whole index; having
|
||||
// more than one index field is currently unsupported (see FAQ 3.6)
|
||||
if (count($one_key['index_list']) == 1) {
|
||||
foreach ($one_key['index_list'] AS $i => $field) {
|
||||
|
||||
// If a foreign key is defined in the 'internal' source (pmadb)
|
||||
// and in 'innodb', we won't get it twice if $source='both'
|
||||
// because we use $field as key
|
||||
// If a foreign key is defined in the 'internal' source (pmadb)
|
||||
// and in 'innodb', we won't get it twice if $source='both'
|
||||
// because we use $field as key
|
||||
|
||||
// The parser looks for a CONSTRAINT clause just before
|
||||
// the FOREIGN KEY clause. It finds it (as output from
|
||||
@@ -405,22 +408,23 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
|
||||
// In those cases, the FOREIGN KEY parsing will put numbers
|
||||
// like -1, 0, 1... instead of the constraint number.
|
||||
|
||||
if (isset($one_key['constraint'])) {
|
||||
$foreign[$field]['constraint'] = $one_key['constraint'];
|
||||
}
|
||||
if (isset($one_key['constraint'])) {
|
||||
$foreign[$field]['constraint'] = $one_key['constraint'];
|
||||
}
|
||||
|
||||
if (isset($one_key['ref_db_name'])) {
|
||||
$foreign[$field]['foreign_db'] = $one_key['ref_db_name'];
|
||||
} else {
|
||||
$foreign[$field]['foreign_db'] = $db;
|
||||
}
|
||||
$foreign[$field]['foreign_table'] = $one_key['ref_table_name'];
|
||||
$foreign[$field]['foreign_field'] = $one_key['ref_index_list'][$i];
|
||||
if (isset($one_key['on_delete'])) {
|
||||
$foreign[$field]['on_delete'] = $one_key['on_delete'];
|
||||
}
|
||||
if (isset($one_key['on_update'])) {
|
||||
$foreign[$field]['on_update'] = $one_key['on_update'];
|
||||
if (isset($one_key['ref_db_name'])) {
|
||||
$foreign[$field]['foreign_db'] = $one_key['ref_db_name'];
|
||||
} else {
|
||||
$foreign[$field]['foreign_db'] = $db;
|
||||
}
|
||||
$foreign[$field]['foreign_table'] = $one_key['ref_table_name'];
|
||||
$foreign[$field]['foreign_field'] = $one_key['ref_index_list'][$i];
|
||||
if (isset($one_key['on_delete'])) {
|
||||
$foreign[$field]['on_delete'] = $one_key['on_delete'];
|
||||
}
|
||||
if (isset($one_key['on_update'])) {
|
||||
$foreign[$field]['on_update'] = $one_key['on_update'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user