Skip to content

Commit

Permalink
Fix failing Oracle tests because of confusion between subjoin and sub…
Browse files Browse the repository at this point in the history
…select.
  • Loading branch information
fjalvingh committed Jan 4, 2018
1 parent 86dd3a4 commit 660f7c2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
15 changes: 14 additions & 1 deletion src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ FromItem SubJoin():
{
fromItem=FromItem() { subJoin.setLeft(fromItem); }
// join=JoinerExpression() { subJoin.setJoin(join); }
joinList=JoinsList() { subJoin.setJoinList(joinList); }
joinList=SubJoinsList() { subJoin.setJoinList(joinList); }

{
return subJoin;
Expand All @@ -1583,6 +1583,19 @@ List JoinsList():
{ return joinsList; }
}

List SubJoinsList():
{
List<Join> joinsList = new ArrayList<Join>();
Join join = null;
}
{

(join=JoinerExpression() { joinsList.add(join); })+

{ return joinsList; }
}


Join JoinerExpression() #JoinerExpression:
{
Join join = new Join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
*/
package net.sf.jsqlparser.test.select;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.Statement;

import static net.sf.jsqlparser.test.TestUtils.*;
import org.apache.commons.io.FileUtils;
import static org.junit.Assert.assertTrue;
import org.junit.ComparisonFailure;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import static net.sf.jsqlparser.test.TestUtils.assertSqlCanBeParsedAndDeparsed;
import static org.junit.Assert.assertTrue;

/**
* Tries to parse and deparse all statments in net.sf.jsqlparser.test.oracle-tests.
*
Expand Down Expand Up @@ -63,6 +64,7 @@ public void testAllSqlsParseDeparse() throws IOException {
success++;
LOG.info(" -> SUCCESS");
} catch (JSQLParserException ex) {
ex.printStackTrace();
//LOG.log(Level.SEVERE, null, ex);
LOG.log(Level.INFO, " -> PROBLEM {0}", ex.toString());
} catch (Exception ex) {
Expand Down

0 comments on commit 660f7c2

Please sign in to comment.