Search in sources :

Example 1 with SQLListExpr

use of com.alibaba.druid.sql.ast.expr.SQLListExpr in project druid by alibaba.

the class OracleSelectParser method parseInto.

protected void parseInto(OracleSelectQueryBlock x) {
    if (lexer.token() == Token.INTO) {
        lexer.nextToken();
        SQLExpr expr = expr();
        if (lexer.token() != Token.COMMA) {
            x.setInto(expr);
            return;
        }
        SQLListExpr list = new SQLListExpr();
        list.addItem(expr);
        while (lexer.token() == Token.COMMA) {
            lexer.nextToken();
            list.addItem(expr());
        }
        x.setInto(list);
    }
}
Also used : SQLListExpr(com.alibaba.druid.sql.ast.expr.SQLListExpr) SQLExpr(com.alibaba.druid.sql.ast.SQLExpr)

Example 2 with SQLListExpr

use of com.alibaba.druid.sql.ast.expr.SQLListExpr in project druid by alibaba.

the class OdpsSelectParser method parseTableSource.

public SQLTableSource parseTableSource() {
    if (lexer.token() == Token.VALUES) {
        lexer.nextToken();
        OdpsValuesTableSource tableSource = new OdpsValuesTableSource();
        for (; ; ) {
            accept(Token.LPAREN);
            SQLListExpr listExpr = new SQLListExpr();
            this.exprParser.exprList(listExpr.getItems(), listExpr);
            accept(Token.RPAREN);
            listExpr.setParent(tableSource);
            tableSource.getValues().add(listExpr);
            if (lexer.token() == Token.COMMA) {
                lexer.nextToken();
                continue;
            }
            break;
        }
        String alias = this.as();
        tableSource.setAlias(alias);
        accept(Token.LPAREN);
        this.exprParser.names(tableSource.getColumns(), tableSource);
        accept(Token.RPAREN);
        return tableSource;
    }
    return super.parseTableSource();
}
Also used : OdpsValuesTableSource(com.alibaba.druid.sql.dialect.odps.ast.OdpsValuesTableSource) SQLListExpr(com.alibaba.druid.sql.ast.expr.SQLListExpr)

Aggregations

SQLListExpr (com.alibaba.druid.sql.ast.expr.SQLListExpr)2 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)1 OdpsValuesTableSource (com.alibaba.druid.sql.dialect.odps.ast.OdpsValuesTableSource)1