Skip to content

Commit

Permalink
fixes #862
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Oct 16, 2019
1 parent 1ecfcbc commit 51c92d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Also I would like to know about needed examples or documentation stuff.

## Extensions in the latest SNAPSHOT version 3.1

* allow more complex expressions for **CASE**.
* allowed **start** as object name as column name or table name
* introduced more positions for **!** instead of **NOT**
* allowed more complex expressions within **if** function
Expand Down
2 changes: 1 addition & 1 deletion src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -3234,7 +3234,7 @@ Expression CaseWhenExpression() #CaseWhenExpression:
(
( clause=WhenThenSearchCondition() { whenClauses.add(clause); } )+
|
(LOOKAHEAD(RegularCondition()) switchExp=RegularCondition() | switchExp=BitwiseAndOr())
switchExp=Condition()
( clause=WhenThenValue() { whenClauses.add(clause); } )+
)
[<K_ELSE> elseExp=Condition()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,11 @@ public void testIssue235SimplifiedCase3() throws JSQLParserException {
public void testIssue235SimplifiedCase4() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT CASE WHEN (CASE WHEN (CASE WHEN (CASE WHEN (1) THEN 0 END) THEN 0 END) THEN 0 END) THEN 0 END FROM a");
}

@Test
public void testIssue862CaseWhenConcat() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT c1, CASE c1 || c2 WHEN '091' THEN '2' ELSE '1' END AS c11 FROM T2");
}

@Test
public void testReplaceAsFunction() throws JSQLParserException {
Expand Down

0 comments on commit 51c92d8

Please sign in to comment.