Skip to content

Commit

Permalink
support select '' as a from order
Browse files Browse the repository at this point in the history
  • Loading branch information
cmonkey committed Jul 31, 2020
1 parent 0a3957a commit f8afa6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public static String getExpressionWithoutOutsideParentheses(final String value)

private static int getParenthesesOffset(final String value) {
int result = 0;
if (Strings.isNullOrEmpty(value)) {
return result;
}
while (Paren.PARENTHESES.getLeftParen() == value.charAt(result)) {
result++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ public void assertGetExactlyExpression() {
@Test
public void assertGetExpressionWithoutOutsideParentheses() {
assertThat(SQLUtil.getExpressionWithoutOutsideParentheses("((a + b*c))"), is("a + b*c"));
assertThat(SQLUtil.getExpressionWithoutOutsideParentheses(""), is(""));
}
}

0 comments on commit f8afa6c

Please sign in to comment.