Skip to content

Commit bc5a6a4

Browse files
committed
util for conditional expression parsing included
1 parent 01a82c2 commit bc5a6a4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/java/net/sf/jsqlparser/parser/CCJSqlParserUtil.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ public static Expression parseExpression(String expression) throws JSQLParserExc
8585
}
8686
}
8787

88+
/**
89+
* Parse an conditional expression. This is the expression after a where clause.
90+
* @param condExpr
91+
* @return
92+
* @throws JSQLParserException
93+
*/
94+
public static Expression parseCondExpression(String condExpr) throws JSQLParserException {
95+
CCJSqlParser parser = new CCJSqlParser(new StringReader(condExpr));
96+
try {
97+
return parser.Expression();
98+
} catch (Exception ex) {
99+
throw new JSQLParserException(ex);
100+
}
101+
}
102+
88103
/**
89104
* Parse a statement list.
90105
*/

0 commit comments

Comments
 (0)