Skip to content

Commit 484ea9d

Browse files
committed
1 parent 1cd3c27 commit 484ea9d

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,14 +2546,14 @@ ExpressionList SimpleExpressionList() #ExpressionList:
25462546
}
25472547
}
25482548

2549-
ExpressionList ConditionExpressionList() #ExpressionList:
2549+
ExpressionList ComplexExpressionList() #ExpressionList:
25502550
{
25512551
ExpressionList retval = new ExpressionList();
25522552
List<Expression> expressions = new ArrayList<Expression>();
25532553
Expression expr = null;
25542554
}
25552555
{
2556-
expr=Condition() { expressions.add(expr); } ("," expr=Condition() { expressions.add(expr); })*
2556+
expr=Expression() { expressions.add(expr); } ("," expr=Expression() { expressions.add(expr); })*
25572557
{
25582558
retval.setExpressions(expressions);
25592559
return retval;
@@ -3343,7 +3343,7 @@ Function FunctionWithCondParams() #Function: {
33433343
(token = <K_IF> | token = <K_IIF>) { funcName=token.image; }
33443344

33453345
"("
3346-
expressionList=ConditionExpressionList()
3346+
expressionList=ComplexExpressionList()
33473347
")"
33483348

33493349
{

src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3809,4 +3809,24 @@ public void testIssue842() throws JSQLParserException {
38093809
public void testIssue842_2() throws JSQLParserException {
38103810
assertSqlCanBeParsedAndDeparsed("SELECT INTERVAL a.repayment_period DAY");
38113811
}
3812+
3813+
@Test
3814+
public void testIssue848() throws JSQLParserException {
3815+
assertSqlCanBeParsedAndDeparsed("SELECT IF(USER_ID > 10 AND SEX = 1, 1, 0)");
3816+
}
3817+
3818+
@Test
3819+
public void testIssue848_2() throws JSQLParserException {
3820+
assertSqlCanBeParsedAndDeparsed("SELECT IF(USER_ID > 10, 1, 0)");
3821+
}
3822+
3823+
@Test
3824+
public void testIssue848_3() throws JSQLParserException {
3825+
assertSqlCanBeParsedAndDeparsed("SELECT c1, multiset(SELECT * FROM mytable WHERE cond = 10) FROM T1 WHERE cond2 = 20");
3826+
}
3827+
3828+
@Test
3829+
public void testIssue848_4() throws JSQLParserException {
3830+
assertSqlCanBeParsedAndDeparsed("select c1 from T1 where someFunc(select f1 from t2 where t2.id = T1.key) = 10", true);
3831+
}
38123832
}

0 commit comments

Comments
 (0)