bug #2134126 [GUI] SQL error after sorting a subset

This commit is contained in:
Marc Delisle
2008-10-02 16:55:44 +00:00
parent 6208585d04
commit aab4f26406
2 changed files with 7 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
thanks to Samuel Sol Villar dos Santos - yohanleafheart
3.0.1.0 (not yet released)
- bug #2134126 [GUI] SQL error after sorting a subset
3.0.0.0 (2008-09-27)
+ [export] properly handle line breaks for YAML, thanks to Dan Barry -

View File

@@ -466,6 +466,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
if (isset($analyzed_sql[0]['unsorted_query'])) {
$unsorted_sql_query = $analyzed_sql[0]['unsorted_query'];
}
// Handles the case of multiple clicks on a column's header
// which would add many spaces before "ORDER BY" in the
// generated query.
$unsorted_sql_query = trim($unsorted_sql_query);
// sorting by indexes, only if it makes sense (only one table ref)
if (isset($analyzed_sql) && isset($analyzed_sql[0]) &&
@@ -765,9 +769,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// If it contains one, it's probably a function column
// like 'COUNT(`field`)'
if (strpos($name_to_use_in_sort, '(') !== false) {
$sort_order = 'ORDER BY ' . $name_to_use_in_sort . ' ';
$sort_order = ' ORDER BY ' . $name_to_use_in_sort . ' ';
} else {
$sort_order = 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
}
unset($name_to_use_in_sort);