Skip to content

Commit b59b48e

Browse files
committed
add support for && operator
1 parent dbef3a5 commit b59b48e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
140140
| <K_ALL:"ALL">
141141
| <K_ALTER:"ALTER">
142142
| <K_AND:"AND">
143+
| <K_AND_OPERATOR:"&&">
143144
| <K_ANY:"ANY">
144145
| <K_AS: "AS">
145146
| <K_ASC:"ASC">
@@ -1985,7 +1986,7 @@ Expression AndExpression() :
19851986
{ result = left; }
19861987

19871988
(
1988-
<K_AND>
1989+
(<K_AND> | <K_AND_OPERATOR>)
19891990
(
19901991
LOOKAHEAD(Condition())
19911992
right=Condition()

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,4 +3166,11 @@ public void testSqlContainIsNullFunctionShouldBeParsed() throws JSQLParserExcept
31663166
public void testNestedCast() throws JSQLParserException {
31673167
assertSqlCanBeParsedAndDeparsed("SELECT acolumn::bit (64)::bigint FROM mytable");
31683168
}
3169+
3170+
@Test
3171+
public void testAndOperator() throws JSQLParserException {
3172+
String stmt = "SELECT name from customers where name = 'John' && lastname = 'Doh'";
3173+
Statement parsed = parserManager.parse(new StringReader(stmt));
3174+
assertStatementCanBeDeparsedAs(parsed, "SELECT name FROM customers WHERE name = 'John' AND lastname = 'Doh'");
3175+
}
31693176
}

0 commit comments

Comments
 (0)