#1623 - DbOrderByTrim doesn't remove asc/desc if you're sorting by a function called on a column

This fix removes the word boundary check prior to the blank space for asc and desc (allowing the preceeding char to be a brace or anything)
This commit is contained in:
rob bygrave
2019-02-02 00:40:56 +13:00
parent 31d7c6fed8
commit a24e6b6064
2 changed files with 67 additions and 1 deletions
@@ -4,7 +4,7 @@ import java.util.regex.Pattern;
class DbOrderByTrim {
private static final Pattern orderByTrim = Pattern.compile("(?i)\\b asc\\b|\\b desc\\b|\\b nulls first\\b|\\b nulls last\\b");
private static final Pattern orderByTrim = Pattern.compile("(?i) asc\\b| desc\\b|\\b nulls first\\b|\\b nulls last\\b");
/**
* Convert the dbOrderBy clause to be safe for adding to select or distinct on.