bug #3356456 [interface] Interface problems for queries having LIMIT clauses
This commit is contained in:
parent
09d48a6554
commit
192b534b95
@ -48,6 +48,7 @@ phpMyAdmin - ChangeLog
|
||||
+ [import] Import GIS data from ESRI Shapefiles
|
||||
+ [interface] 'Function based search' for GIS data
|
||||
+ Support Drizzle database
|
||||
- bug #3356456 [interface] Interface problems for queries having LIMIT clauses
|
||||
|
||||
3.4.6.0 (not yet released)
|
||||
- patch #3404173 InnoDB comment display with tooltips/aliases
|
||||
|
||||
@ -3709,4 +3709,19 @@ function PMA_getServerType()
|
||||
return $server_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyzes the limit clause and return the start and length attributes of it.
|
||||
*
|
||||
* @param string $limit_clause limit clause
|
||||
*
|
||||
* @return array Start and length attributes of the limit clause
|
||||
*/
|
||||
function PMA_analyzeLimitClause($limit_clause)
|
||||
{
|
||||
$start_and_length = explode(',', str_ireplace('LIMIT', '', $limit_clause));
|
||||
return array(
|
||||
'start' => trim($start_and_length[0]),
|
||||
'length' => trim($start_and_length[1])
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -2321,9 +2321,22 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
} else {
|
||||
$selectstring = '';
|
||||
}
|
||||
$last_shown_rec = ($_SESSION['tmp_user_values']['max_rows'] == 'all' || $pos_next > $total)
|
||||
? $total - 1
|
||||
: $pos_next - 1;
|
||||
|
||||
if (! empty($analyzed_sql[0]['limit_clause'])) {
|
||||
$limit_data = PMA_analyzeLimitClause($analyzed_sql[0]['limit_clause']);
|
||||
$first_shown_rec = $limit_data['start'];
|
||||
if ($limit_data['length'] < $total) {
|
||||
$last_shown_rec = $limit_data['start'] + $limit_data['length'] - 1;
|
||||
} else {
|
||||
$last_shown_rec = $limit_data['start'] + $total - 1;
|
||||
}
|
||||
} elseif ($_SESSION['tmp_user_values']['max_rows'] == 'all' || $pos_next > $total) {
|
||||
$first_shown_rec = $_SESSION['tmp_user_values']['pos'];
|
||||
$last_shown_rec = $total - 1;
|
||||
} else {
|
||||
$first_shown_rec = $_SESSION['tmp_user_values']['pos'];
|
||||
$last_shown_rec = $pos_next - 1;
|
||||
}
|
||||
|
||||
if (PMA_Table::isView($db, $table)
|
||||
&& $total == $GLOBALS['cfg']['MaxExactCountViews']
|
||||
@ -2337,7 +2350,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
}
|
||||
|
||||
$message = PMA_Message::success(__('Showing rows'));
|
||||
$message->addMessage($_SESSION['tmp_user_values']['pos']);
|
||||
$message->addMessage($first_shown_rec);
|
||||
if ($message_view_warning) {
|
||||
$message->addMessage('...', ' - ');
|
||||
$message->addMessage($message_view_warning);
|
||||
@ -2382,7 +2395,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_display['nav_bar'] == '1') {
|
||||
if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) {
|
||||
PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'top_direction_dropdown');
|
||||
echo "\n";
|
||||
} elseif (! isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
|
||||
@ -2509,7 +2522,7 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
|
||||
// 5. ----- Displays the navigation bar at the bottom if required -----
|
||||
|
||||
if ($is_display['nav_bar'] == '1') {
|
||||
if ($is_display['nav_bar'] == '1' && empty($analyzed_sql[0]['limit_clause'])) {
|
||||
echo '<br />' . "\n";
|
||||
PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, 'bottom_direction_dropdown');
|
||||
} elseif (! isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user