Skip to content

Commit

Permalink
add support for && operator
Browse files Browse the repository at this point in the history
  • Loading branch information
tomershay committed Jul 3, 2018
1 parent dbef3a5 commit b59b48e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
| <K_ALL:"ALL">
| <K_ALTER:"ALTER">
| <K_AND:"AND">
| <K_AND_OPERATOR:"&&">
| <K_ANY:"ANY">
| <K_AS: "AS">
| <K_ASC:"ASC">
Expand Down Expand Up @@ -1985,7 +1986,7 @@ Expression AndExpression() :
{ result = left; }

(
<K_AND>
(<K_AND> | <K_AND_OPERATOR>)
(
LOOKAHEAD(Condition())
right=Condition()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3166,4 +3166,11 @@ public void testSqlContainIsNullFunctionShouldBeParsed() throws JSQLParserExcept
public void testNestedCast() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT acolumn::bit (64)::bigint FROM mytable");
}

@Test
public void testAndOperator() throws JSQLParserException {
String stmt = "SELECT name from customers where name = 'John' && lastname = 'Doh'";
Statement parsed = parserManager.parse(new StringReader(stmt));
assertStatementCanBeDeparsedAs(parsed, "SELECT name FROM customers WHERE name = 'John' AND lastname = 'Doh'");
}
}

0 comments on commit b59b48e

Please sign in to comment.