Skip to content

Commit 410a2d1

Browse files
committed
regexp_like transfered into a general boolean function
1 parent 55f42ea commit 410a2d1

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj

100755100644
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
193193
| <K_INTO:"INTO">
194194
| <K_NULL:"NULL">
195195
| <K_LIKE:"LIKE">
196-
| <K_REGEXP:"REGEXP">
197-
| <K_REGEXP_LIKE:"REGEXP_LIKE">
198196
| <K_DROP:"DROP">
199197
| <K_JOIN:"JOIN">
200198
| <K_LEFT:"LEFT">
@@ -1285,27 +1283,13 @@ Expression Condition():
12851283
}
12861284
{
12871285
(LOOKAHEAD(SQLCondition()) result=SQLCondition()
1288-
| result=FunctionCondition()
1289-
| result=RegularCondition()
1286+
| LOOKAHEAD(RegularCondition()) result=RegularCondition()
1287+
| result=Function()
12901288
)
12911289

12921290
{ return result; }
12931291
}
12941292

1295-
Expression FunctionCondition():
1296-
{
1297-
Function result;
1298-
ExpressionList parameters;
1299-
}
1300-
{
1301-
<K_REGEXP_LIKE> { result = new Function(); result.setName("REGEXP_LIKE"); }
1302-
"("
1303-
parameters=SimpleExpressionList() { result.setParameters(parameters); }
1304-
")"
1305-
1306-
{ return result; }
1307-
}
1308-
13091293
Expression RegularCondition():
13101294
{
13111295
Expression result = null;

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

100755100644
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,5 +1051,10 @@ public void testRegexpLike2() throws JSQLParserException {
10511051
String stmt = "SELECT CASE WHEN REGEXP_LIKE(first_name, '^Ste(v|ph)en$') THEN 1 ELSE 2 END FROM mytable";
10521052
assertSqlCanBeParsedAndDeparsed(stmt);
10531053
}
1054+
1055+
public void testBooleanFunction1() throws JSQLParserException {
1056+
String stmt = "SELECT * FROM mytable WHERE test_func(col1)";
1057+
assertSqlCanBeParsedAndDeparsed(stmt);
1058+
}
10541059

10551060
}

0 commit comments

Comments
 (0)