diff --git a/ChangeLog b/ChangeLog index f616ac3f9..3002dc02d 100755 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ $Source$ #1191792). * tbl_properties.inc.php: Remove unused code, show only available engines, remember value of seleted engine (bug #1239580). + * browse_foreigners.php, libraries/get_foreign.lib.php: Support for + searching in foreign keys (RFE #871091). 2005-10-08 Marc Delisle * libraries/session.inc.php: workaround for warnings on session_start() diff --git a/browse_foreigners.php b/browse_foreigners.php index 56e6f3b01..715a73cfc 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -99,6 +99,11 @@ if (isset($pk)) { } ?> + + + +
+ $per_page)) { @@ -117,6 +122,7 @@ if ($the_total > $per_page) { '&' . PMA_generate_common_url($db, $table) . $pk_uri . '&fieldkey=' . (isset($fieldkey) ? $fieldkey : '') . + '&foreign_filter=' . (isset($foreign_filter) ? htmlspecialchars($foreign_filter) : '') . '&', $session_max_rows, $pageNow, diff --git a/libraries/get_foreign.lib.php b/libraries/get_foreign.lib.php index d7619f4cd..8f5b96a5c 100644 --- a/libraries/get_foreign.lib.php +++ b/libraries/get_foreign.lib.php @@ -34,6 +34,12 @@ if ($foreigners && isset($foreigners[$field])) { $dispsql = 'SELECT ' . PMA_backquote($foreign_field) . (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display)) . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table) + . (empty($foreign_filter) ? '' : ' WHERE ' . PMA_backquote($foreign_field) + . ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"' + . (($foreign_display == FALSE) ? '' : ' OR ' . PMA_backquote($foreign_display) + . ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"' + ) + ) . (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display)) . (isset($foreign_limit) ? $foreign_limit : ''); $disp = PMA_DBI_query($dispsql); @@ -46,6 +52,7 @@ if ($foreigners && isset($foreigners[$field])) { while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) { $disp_row[] = $single_disp_row; } + $the_total = count($disp_row); @PMA_DBI_free_result($disp); } }