Fix paging.
This commit is contained in:
@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-10-12 Michal Čihař <michal@cihar.com>
|
||||||
|
* libraries/get_foreign.lib.php: Fix paging.
|
||||||
|
|
||||||
2005-10-11 Marc Delisle <lem9@users.sourceforge.net>
|
2005-10-11 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/grab_globals.lib.php: bug #1322871, local file inclusion
|
* libraries/grab_globals.lib.php: bug #1322871, local file inclusion
|
||||||
|
|
||||||
|
@@ -29,20 +29,29 @@ if ($foreigners && isset($foreigners[$field])) {
|
|||||||
|
|
||||||
if ((isset($override_total) && $override_total == true) || $the_total < $cfg['ForeignKeyMaxLimit']) {
|
if ((isset($override_total) && $override_total == true) || $the_total < $cfg['ForeignKeyMaxLimit']) {
|
||||||
// foreign_display can be FALSE if no display field defined:
|
// foreign_display can be FALSE if no display field defined:
|
||||||
|
|
||||||
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
||||||
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
|
|
||||||
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
|
$f_query_main = 'SELECT ' . PMA_backquote($foreign_field)
|
||||||
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table)
|
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display));
|
||||||
. (empty($foreign_filter) ? '' : ' WHERE ' . PMA_backquote($foreign_field)
|
$f_query_from = ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table);
|
||||||
|
$f_query_filter = empty($foreign_filter) ? '' : ' WHERE ' . PMA_backquote($foreign_field)
|
||||||
. ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"'
|
. ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"'
|
||||||
. (($foreign_display == FALSE) ? '' : ' OR ' . PMA_backquote($foreign_display)
|
. (($foreign_display == FALSE) ? '' : ' OR ' . PMA_backquote($foreign_display)
|
||||||
. ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"'
|
. ' LIKE "%' . PMA_sqlAddslashes($foreign_filter, TRUE) . '%"'
|
||||||
)
|
);
|
||||||
)
|
$f_query_order = ($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display);
|
||||||
. (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display))
|
$f_query_limit = isset($foreign_limit) ? $foreign_limit : '';
|
||||||
. (isset($foreign_limit) ? $foreign_limit : '');
|
|
||||||
$disp = PMA_DBI_query($dispsql);
|
if (!empty($foreign_filter)) {
|
||||||
|
$res = PMA_DBI_query('SELECT COUNT(*)' . $f_query_from . $f_query_filter);
|
||||||
|
if ($res) {
|
||||||
|
$the_total = PMA_DBI_fetch_value($res);
|
||||||
|
} else {
|
||||||
|
$the_total = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$disp = PMA_DBI_query($f_query_main . $f_query_from . $f_query_filter . $f_query_order . $f_query_limit);
|
||||||
if ($disp) {
|
if ($disp) {
|
||||||
// garvin: If a resultset has been created, pre-cache it in the $disp_row array
|
// garvin: If a resultset has been created, pre-cache it in the $disp_row array
|
||||||
// This helps us from not needing to use mysql_data_seek by accessing a pre-cached
|
// This helps us from not needing to use mysql_data_seek by accessing a pre-cached
|
||||||
@@ -52,7 +61,6 @@ if ($foreigners && isset($foreigners[$field])) {
|
|||||||
while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) {
|
while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) {
|
||||||
$disp_row[] = $single_disp_row;
|
$disp_row[] = $single_disp_row;
|
||||||
}
|
}
|
||||||
$the_total = count($disp_row);
|
|
||||||
@PMA_DBI_free_result($disp);
|
@PMA_DBI_free_result($disp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user