bug 772765

This commit is contained in:
Marc Delisle
2003-07-24 12:59:28 +00:00
parent d80881a55c
commit fd979ea10b
4 changed files with 17 additions and 11 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-07-24 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.lib.php3 /relation.lib.php3 /get_foreign.lib.php3:
bug 772765, InnoDB and multi-columns foreign key
2003-07-23 Alexander M. Turek <rabus@users.sourceforge.net>
* libraries/mysql_charsets.lib.php3:
- better method for retrieving the supported MySQL charsets;

View File

@@ -31,11 +31,12 @@
if ($the_total < 200) {
// foreign_display can be FALSE if no display field defined:
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table)
. ' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display);
. (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display));
$disp = PMA_mysql_query($dispsql);
}
else {

View File

@@ -314,9 +314,9 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
while (list(,$one_key) = each ($analyzed_sql[0]['foreign_keys'])) {
// TODO: the analyzer may return more than one column name in the
// index list or the ref_index_list but for now we take the first
$field = $one_key['index_list'][0];
// the analyzer may return more than one column name in the
// index list or the ref_index_list
while (list($i,$field) = each($one_key['index_list'])) {
// TODO: SHOW CREATE TABLE does not return the db name in
// the REFERENCES, so we assume the same db as master
@@ -325,9 +325,10 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
// and in 'innodb', we won't get it twice if $source='both'
// because we use $field as key
$foreign[$field]['foreign_db'] = $db;
$foreign[$field]['foreign_table'] = $one_key['ref_table_name'];
$foreign[$field]['foreign_field'] = $one_key['ref_index_list'][0];
$foreign[$field]['foreign_db'] = $db;
$foreign[$field]['foreign_table'] = $one_key['ref_table_name'];
$foreign[$field]['foreign_field'] = $one_key['ref_index_list'][$i];
}
}
}

View File

@@ -699,7 +699,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
* I create all sub-values empty, even if they are
* not present (for example no select_expression alias).
*
* There is a debug section at the end of the main loop, if you want to
* There is a debug section at the end of loop #1, if you want to
* see the exact contents of select_expr and table_ref
*
* lem9: queryflags
@@ -1183,7 +1183,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$in_from = FALSE;
for ($i = 0; $i < $size; $i++) {
//echo "trace loop2 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br>";
//DEBUG echo "trace loop2 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br>";
// need_confirm
//
@@ -1369,6 +1369,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
if ($upper_data == 'FOREIGN') {
$seen_foreign = TRUE;
$seen_references = FALSE;
$foreign_key_number++;
}
if ($upper_data == 'REFERENCES') {
$seen_foreign = FALSE;
@@ -1392,8 +1393,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
if ($seen_foreign && $in_bracket) {
// remove backquotes
$identifier = str_replace('`','',$arr[$i]['data']);
// new foreign key
$foreign_key_number++;
//$foreign_key_number++;
$foreign[$foreign_key_number]['index_list'][] = $identifier;
}