From ca7da2797863779b663c56b8bff594510929ddba Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 27 Apr 2005 17:28:17 +0000 Subject: [PATCH] bug #1179887 ordering by count(*) --- ChangeLog | 1 + libraries/sqlparser.lib.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 684864a08..215ea64a9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ $Source$ 2005-04-27 Marc Delisle * lang/finnish: update, thanks to Jouni Kahkonen * lang/russian: update, thanks to lobovich + * libraries/sqlparser.lib.php: bug #1179887, ordering by count(*) 2005-04-26 Marc Delisle * tbl_properties_structure.php, tbl_properties.inc.php: diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 344dc63ba..11a6d619a 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -1480,11 +1480,16 @@ if ($is_minimum_common == FALSE) { } } - // FIXME: is it correct to always add $sep ? if (isset($subresult['queryflags']['select_from']) && $subresult['queryflags']['select_from'] == 1 && !$seen_order) { - $unsorted_query .= $arr[$i]['data'] . $sep; + $unsorted_query .= $arr[$i]['data']; + + if ($arr[$i]['type'] != 'punct_bracket_open_round' + && $arr[$i]['type'] != 'punct_bracket_close_round' + && $arr[$i]['type'] != 'punct') { + $unsorted_query .= $sep; + } } // clear $upper_data for next iteration