Search in sources :

Example 1 with OracleSelectSubqueryTableSource

use of com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectSubqueryTableSource in project druid by alibaba.

the class OracleSelectParser method parseTableSource.

@Override
public SQLTableSource parseTableSource() {
    if (lexer.token() == (Token.LPAREN)) {
        lexer.nextToken();
        OracleSelectSubqueryTableSource tableSource;
        if (lexer.token() == Token.SELECT || lexer.token() == Token.WITH) {
            tableSource = new OracleSelectSubqueryTableSource(select());
        } else if (lexer.token() == (Token.LPAREN)) {
            tableSource = new OracleSelectSubqueryTableSource(select());
        } else {
            throw new ParserException("TODO :" + lexer.token());
        }
        accept(Token.RPAREN);
        parsePivot((OracleSelectTableSource) tableSource);
        return parseTableSourceRest(tableSource);
    }
    if (lexer.token() == (Token.SELECT)) {
        throw new ParserException("TODO");
    }
    OracleSelectTableReference tableReference = new OracleSelectTableReference();
    if (identifierEquals("ONLY")) {
        lexer.nextToken();
        tableReference.setOnly(true);
        accept(Token.LPAREN);
        parseTableSourceQueryTableExpr(tableReference);
        accept(Token.RPAREN);
    } else {
        parseTableSourceQueryTableExpr(tableReference);
        parsePivot(tableReference);
    }
    return parseTableSourceRest(tableReference);
}
Also used : ParserException(com.alibaba.druid.sql.parser.ParserException) OracleSelectTableReference(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectTableReference) OracleSelectSubqueryTableSource(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectSubqueryTableSource)

Aggregations

OracleSelectSubqueryTableSource (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectSubqueryTableSource)1 OracleSelectTableReference (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectTableReference)1 ParserException (com.alibaba.druid.sql.parser.ParserException)1