diff --git a/ChangeLog b/ChangeLog index 8d3af87ca..ffe6ed140 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ $Source$ 2002-09-20 Marc Delisle * libraries/display_tbl.lib.php3: bug 612117, vertical view and buttons as links + * libraries/tbl_change.js, tbl_change.php3, tbl_replace.php3: + patch 612202: NULL for foreign keys, thanks to Markus L. Noga 2002-09-19 Marc Delisle * libraries/sqlparser.lib.php3: bug 608459: syntax coloring and diff --git a/libraries/tbl_change.js b/libraries/tbl_change.js index fe90ffea7..959d10bb7 100644 --- a/libraries/tbl_change.js +++ b/libraries/tbl_change.js @@ -18,8 +18,9 @@ function nullify(theType, urlField, md5Field) rowForm.elements['funcs[' + urlField + ']'].selectedIndex = -1; } - // "SET" field or "ENUM" field with more than 20 characters - if (theType == 1 || theType == 3) { + // "SET" field , "ENUM" field with more than 20 characters + // or foreign key field + if (theType == 1 || theType == 3 || theType == 4) { rowForm.elements['field_' + md5Field + '[]'].selectedIndex = -1; } // Other "ENUM" field @@ -31,7 +32,7 @@ function nullify(theType, urlField, md5Field) } // end for } // Other field types - else /*if (theType == 4)*/ { + else /*if (theType == 5)*/ { rowForm.elements['fields[' + urlField + ']'].value = ''; } // end if... else if... else diff --git a/tbl_change.php3 b/tbl_change.php3 index 1db848825..5086471fd 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -377,8 +377,10 @@ for ($i = 0; $i < $fields_cnt; $i++) { } } else if (strstr($row_table_def['True_Type'], 'set')) { $onclick .= '3, '; - } else { + } else if ($foreigners && isset($foreigners[$field])) { $onclick .= '4, '; + } else { + $onclick .= '5, '; } $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n"; echo $onclick; @@ -418,19 +420,25 @@ for ($i = 0; $i < $fields_cnt; $i++) { $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); + . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table) + . ' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display); $disp = PMA_mysql_query($dispsql); } } // end if $foreigners if (isset($disp) && $disp) { - echo ' ' . "\n"; - echo ' ' . $backup_field . "\n"; - echo ' +