bug 983992

This commit is contained in:
Marc Delisle
2004-07-05 14:55:59 +00:00
parent a4e95ef78a
commit 3f7382d386
2 changed files with 20 additions and 7 deletions

View File

@@ -1498,14 +1498,24 @@ if ($is_minimum_common == FALSE) {
if ($in_bracket) {
$foreign[$foreign_key_number]['ref_index_list'][] = $identifier;
} else {
// identifier can be table or db.table
$db_table = explode('.',$identifier);
if (isset($db_table[1])) {
$foreign[$foreign_key_number]['ref_db_name'] = $db_table[0];
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[1];
// for MySQL 4.0.18, identifier is
// `table` or `db`.`table`
// first pass will pick the db name
// next pass will execute the else and pick the
// db name in $db_table[0]
if ($arr[$i+1]['type'] == 'punct_qualifier') {
$foreign[$foreign_key_number]['ref_db_name'] = $identifier;
} else {
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[0];
}
// for MySQL 4.0.16, identifier is
// `table` or `db.table`
$db_table = explode('.',$identifier);
if (isset($db_table[1])) {
$foreign[$foreign_key_number]['ref_db_name'] = $db_table[0];
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[1];
} else {
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[0];
}
}
}
}
}