bug #1887204 [GUI] Order columns in result list messing up query

This commit is contained in:
Marc Delisle
2008-02-11 18:26:53 +00:00
parent 09a42ad9a2
commit 538013c19b
2 changed files with 10 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1799691 [export] "Propose table structure" and Export
- bug #1884911 [GUI] Space usage
- bug #1863326 [GUI] Wrong error message / no edit (Suhosin)
- bug #1887204 [GUI] Order columns in result list messing up query
2.11.4.0 (2008-01-12)
- bug #1843428 [GUI] Space issue with DROP/DELETE/ALTER TABLE

View File

@@ -1436,6 +1436,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$seen_reserved_word = FALSE;
$seen_group = FALSE;
$seen_order = FALSE;
$seen_order_by = FALSE;
$in_group_by = FALSE; // true when we are inside the GROUP BY clause
$in_order_by = FALSE; // true when we are inside the ORDER BY clause
$in_having = FALSE; // true when we are inside the HAVING clause
@@ -1446,7 +1447,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$after_limit = FALSE; // true when we are after the LIMIT clause
$in_from = FALSE; // true when we are in the FROM clause
$in_group_concat = FALSE;
$unsorted_query = '';
$first_reserved_word = '';
$current_identifier = '';
@@ -1589,6 +1589,10 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$group_by_clause = '';
}
if ($seen_order) {
$seen_order_by = TRUE;
// here we assume that the ORDER BY keywords took
// exactly 8 characters
$unsorted_query = substr($arr['raw'], 0, $arr[$i]['pos'] - 8);
$in_order_by = TRUE;
$order_by_clause = '';
}
@@ -1676,12 +1680,13 @@ if (! defined('PMA_MINIMUM_COMMON')) {
}
}
// to grab the rest of the query after the ORDER BY clause
if (isset($subresult['queryflags']['select_from'])
&& $subresult['queryflags']['select_from'] == 1
&& ! $in_order_by
&& $upper_data != 'ORDER') {
&& $seen_order_by
&& $upper_data != 'BY') {
$unsorted_query .= $arr[$i]['data'];
if ($arr[$i]['type'] != 'punct_bracket_open_round'
&& $arr[$i]['type'] != 'punct_bracket_close_round'
&& $arr[$i]['type'] != 'punct') {