Skip to content

Commit

Permalink
fixes #117
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Mar 28, 2015
1 parent f194b7c commit b3d91de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ Expression RegularCondition():
[ <K_NOT> { not = true; } ]
leftExpression=ComparisonItem() { result = leftExpression; }

[ "(+)" { oracleJoin=EqualsTo.ORACLE_JOIN_RIGHT; } ]
[ "(" "+" ")" { oracleJoin=EqualsTo.ORACLE_JOIN_RIGHT; } ]

(
">" { result = new GreaterThan(); }
Expand All @@ -1365,7 +1365,7 @@ Expression RegularCondition():
rightExpression=ComparisonItem()

[ <K_PRIOR> { oraclePrior = EqualsTo.ORACLE_PRIOR_END; } ]
[ "(+)" { oracleJoin=EqualsTo.ORACLE_JOIN_LEFT; } ]
[ "(" "+" ")" { oracleJoin=EqualsTo.ORACLE_JOIN_LEFT; } ]

{
BinaryExpression regCond = (BinaryExpression) result;
Expand Down Expand Up @@ -1411,12 +1411,12 @@ Expression InExpression() :
LOOKAHEAD(SimpleExpressionList()) leftItemsList = SimpleExpressionList() { result.setLeftItemsList(leftItemsList); }
|
leftExpression=SimpleExpression()
[ "(+)" { result.setOldOracleJoinSyntax(EqualsTo.ORACLE_JOIN_RIGHT); } ]
[ "(" "+" ")" { result.setOldOracleJoinSyntax(EqualsTo.ORACLE_JOIN_RIGHT); } ]
)
")"
|
leftExpression=SimpleExpression() { result.setLeftExpression(leftExpression); }
[ "(+)" { result.setOldOracleJoinSyntax(EqualsTo.ORACLE_JOIN_RIGHT); } ]
[ "(" "+" ")" { result.setOldOracleJoinSyntax(EqualsTo.ORACLE_JOIN_RIGHT); } ]
)
[<K_NOT> { result.setNot(true); } ] <K_IN> "(" (LOOKAHEAD(SubSelect()) rightItemsList=SubSelect() | rightItemsList=SimpleExpressionList() ) ")"
{
Expand Down
26 changes: 20 additions & 6 deletions src/test/java/net/sf/jsqlparser/test/select/SelectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,20 @@ public void testOracleJoin2() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed(stmt);
}

public void testOracleJoin2_1() throws JSQLParserException {
String[] values = new String[]{"(+)", "( +)", "(+ )", "( + )"," (+) "};
for (String value : values) {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM tabelle1, tabelle2 WHERE tabelle1.a" + value + " = tabelle2.b", true);
}
}

public void testOracleJoin2_2() throws JSQLParserException {
String[] values = new String[]{"(+)", "( +)", "(+ )", "( + )"," (+) "};
for (String value : values) {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM tabelle1, tabelle2 WHERE tabelle1.a = tabelle2.b" + value, true);
}
}

public void testOracleJoin3() throws JSQLParserException {
String stmt = "SELECT * FROM tabelle1, tabelle2 WHERE tabelle1.a(+) > tabelle2.b";
assertSqlCanBeParsedAndDeparsed(stmt);
Expand Down Expand Up @@ -1600,9 +1614,9 @@ public void testReservedKeyword() throws JSQLParserException {
final Select select = (Select) parserManager.parse(new StringReader(statement));
assertStatementCanBeDeparsedAs(select, statement);
}
public void testReservedKeyword2() throws JSQLParserException {
final String stmt = "SELECT open FROM tableName";

public void testReservedKeyword2() throws JSQLParserException {
final String stmt = "SELECT open FROM tableName";
assertSqlCanBeParsedAndDeparsed(stmt);
}

Expand Down Expand Up @@ -1647,15 +1661,15 @@ public void testSelectOracleColl() throws JSQLParserException {
public void testSelectInnerWith() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM (WITH actor AS (SELECT 'a' aid FROM DUAL) SELECT aid FROM actor)");
}

public void testSelectWithinGroup() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT LISTAGG(col1, '##') WITHIN GROUP (ORDER BY col1) FROM table1");
}

public void testSelectUserVariable() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT @col FROM t1");
}

public void testSelectNumericBind() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT a FROM b WHERE c = :1");
}
Expand Down

0 comments on commit b3d91de

Please sign in to comment.