use of com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectJoin in project druid by alibaba.
the class OracleSelectParser method parseTableSourceRest.
protected SQLTableSource parseTableSourceRest(OracleSelectTableSource tableSource) {
if (lexer.token() == Token.AS) {
lexer.nextToken();
if (lexer.token() == Token.OF) {
tableSource.setFlashback(flashback());
}
tableSource.setAlias(as());
} else if ((tableSource.getAlias() == null) || (tableSource.getAlias().length() == 0)) {
if (lexer.token() != Token.LEFT && lexer.token() != Token.RIGHT && lexer.token() != Token.FULL) {
tableSource.setAlias(as());
}
}
if (lexer.token() == Token.HINT) {
this.exprParser.parseHints(tableSource.getHints());
}
OracleSelectJoin.JoinType joinType = null;
if (lexer.token() == Token.LEFT) {
lexer.nextToken();
if (lexer.token() == Token.OUTER) {
lexer.nextToken();
}
accept(Token.JOIN);
joinType = OracleSelectJoin.JoinType.LEFT_OUTER_JOIN;
}
if (lexer.token() == Token.RIGHT) {
lexer.nextToken();
if (lexer.token() == Token.OUTER) {
lexer.nextToken();
}
accept(Token.JOIN);
joinType = OracleSelectJoin.JoinType.RIGHT_OUTER_JOIN;
}
if (lexer.token() == Token.FULL) {
lexer.nextToken();
if (lexer.token() == Token.OUTER) {
lexer.nextToken();
}
accept(Token.JOIN);
joinType = OracleSelectJoin.JoinType.FULL_OUTER_JOIN;
}
if (lexer.token() == Token.INNER) {
lexer.nextToken();
accept(Token.JOIN);
joinType = OracleSelectJoin.JoinType.INNER_JOIN;
}
if (lexer.token() == Token.CROSS) {
lexer.nextToken();
accept(Token.JOIN);
joinType = OracleSelectJoin.JoinType.CROSS_JOIN;
}
if (lexer.token() == Token.JOIN) {
lexer.nextToken();
joinType = OracleSelectJoin.JoinType.JOIN;
}
if (lexer.token() == (Token.COMMA)) {
lexer.nextToken();
joinType = OracleSelectJoin.JoinType.COMMA;
}
if (joinType != null) {
OracleSelectJoin join = new OracleSelectJoin();
join.setLeft(tableSource);
join.setJoinType(joinType);
join.setRight(parseTableSource());
if (lexer.token() == Token.ON) {
lexer.nextToken();
join.setCondition(this.exprParser.expr());
} else if (lexer.token() == Token.USING) {
lexer.nextToken();
accept(Token.LPAREN);
this.exprParser.exprList(join.getUsing(), join);
accept(Token.RPAREN);
}
return parseTableSourceRest(join);
}
return tableSource;
}
Aggregations