diff options
author | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2012-07-10 19:56:45 +0400 |
---|---|---|
committer | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2012-07-10 19:56:45 +0400 |
commit | 9fe3a570f097267367dbd2f9dc2935d2a0e548c2 (patch) | |
tree | 799369d1b34176bbb483b2922c476227321acd8d /db_qbe.php | |
parent | 7024c4df9b5cd97ebe1c37bfb7045280a9bb3312 (diff) |
Logical improvement in PMA_dbQbeGetOrderByClause
Diffstat (limited to 'db_qbe.php')
-rw-r--r-- | db_qbe.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/db_qbe.php b/db_qbe.php index 36437ce145..2d0b0149f1 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -673,25 +673,22 @@ function PMA_dbQbeGetOrderByClause($criteria_column_count) { $last_orderby = 0; $orderby_clause = ''; - for ($column_index = 0; $column_index < $criteria_column_count; $column_index++) { - if ($last_orderby - && $column_index - && ! empty($GLOBALS['curField'][$column_index]) - && ! empty($GLOBALS['curSort'][$column_index]) - ) { - $orderby_clause .= ', '; - } + for ($column_index = 0; $column_index < $criteria_column_count; $column_index++) + { + // if all columns are chosen with * selector, then sorting isn't available + // Fix for Bug #570698 if (! empty($GLOBALS['curField'][$column_index]) && ! empty($GLOBALS['curSort'][$column_index]) ) { - // if they have chosen all fields using the * selector, - // then sorting is not available - // Fix for Bug #570698 - if (substr($GLOBALS['curField'][$column_index], -2) != '.*') { - $orderby_clause .= $GLOBALS['curField'][$column_index] . ' ' - . $GLOBALS['curSort'][$column_index]; - $last_orderby = 1; + if (substr($GLOBALS['curField'][$column_index], -2) == '.*') { + continue; + } + if ($last_orderby && $column_index) { + $orderby_clause .= ', '; } + $orderby_clause .= $GLOBALS['curField'][$column_index] . ' ' + . $GLOBALS['curSort'][$column_index]; + $last_orderby = 1; } } // end for if (! empty($orderby_clause)) { |