BUG FIX: Fix parsing of -/+ style order by prefixes.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adam Heath
2010-08-02 17:43:19 +00:00
parent 6772e47dd6
commit eebce0b77f
2 changed files with 21 additions and 11 deletions
+20 -10
View File
@@ -699,17 +699,27 @@ private OrderByItem OrderByItem(): {
OrderByItem.Order ordering = OrderByItem.Order.DEFAULT;
} {
(
<PLUS> { ordering = OrderByItem.Order.ASCENDING; }
| <MINUS> { ordering = OrderByItem.Order.DESCENDING; }
)?
(
( <UPPER> | <LOWER> ) { functionName = getToken(0).image; } <OPEN_PAREN> fieldName=NamePart() <CLOSE_PAREN>
| fieldName=NamePart()
(
(
<PLUS> { ordering = OrderByItem.Order.ASCENDING; }
| <MINUS> { ordering = OrderByItem.Order.DESCENDING; }
)
(
( <UPPER> | <LOWER> ) { functionName = getToken(0).image; }
<OPEN_PAREN> fieldName=NamePart() <CLOSE_PAREN>
| fieldName=NamePart()
)
)
| (
( <UPPER> | <LOWER> ) { functionName = getToken(0).image; }
<OPEN_PAREN> fieldName=NamePart() <CLOSE_PAREN>
| fieldName=NamePart()
)
(
<DESC> { ordering = OrderByItem.Order.DESCENDING; }
| <ASC> { ordering = OrderByItem.Order.ASCENDING; }
)?
)
LOOKAHEAD({!orderingSet}) (
<DESC> { ordering = OrderByItem.Order.DESCENDING; }
| <ASC> { ordering = OrderByItem.Order.ASCENDING; }
)?
{ return new OrderByItem(ordering, functionName, fieldName); }
}
@@ -53,7 +53,7 @@ WHERE
HAVING
b.firstName LIKE '%foo%'
ORDER BY
LOWER(lastName), firstName, birthDate DESC
LOWER(lastName), firstName, -birthDate
OFFSET 5
LIMIT 10
;