Search in sources :

Example 1 with ModelColumn

use of com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.ModelColumn in project druid by alibaba.

the class OracleSelectParser method parseMainModelClause.

private void parseMainModelClause(ModelClause modelClause) {
    MainModelClause mainModel = new MainModelClause();
    if (identifierEquals("MAIN")) {
        lexer.nextToken();
        mainModel.setMainModelName(expr());
    }
    ModelColumnClause modelColumnClause = new ModelColumnClause();
    parseQueryPartitionClause(modelColumnClause);
    mainModel.setModelColumnClause(modelColumnClause);
    acceptIdentifier("DIMENSION");
    accept(Token.BY);
    accept(Token.LPAREN);
    for (; ; ) {
        if (lexer.token() == Token.RPAREN) {
            lexer.nextToken();
            break;
        }
        ModelColumn column = new ModelColumn();
        column.setExpr(expr());
        column.setAlias(as());
        modelColumnClause.getDimensionByColumns().add(column);
        if (lexer.token() == Token.COMMA) {
            lexer.nextToken();
            continue;
        }
    }
    acceptIdentifier("MEASURES");
    accept(Token.LPAREN);
    for (; ; ) {
        if (lexer.token() == Token.RPAREN) {
            lexer.nextToken();
            break;
        }
        ModelColumn column = new ModelColumn();
        column.setExpr(expr());
        column.setAlias(as());
        modelColumnClause.getMeasuresColumns().add(column);
        if (lexer.token() == Token.COMMA) {
            lexer.nextToken();
            continue;
        }
    }
    mainModel.setModelColumnClause(modelColumnClause);
    parseCellReferenceOptions(mainModel.getCellReferenceOptions());
    parseModelRulesClause(mainModel);
    modelClause.setMainModel(mainModel);
}
Also used : ModelColumn(com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.ModelColumn) MainModelClause(com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.MainModelClause) ModelColumnClause(com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.ModelColumnClause)

Aggregations

MainModelClause (com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.MainModelClause)1 ModelColumn (com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.ModelColumn)1 ModelColumnClause (com.alibaba.druid.sql.dialect.oracle.ast.clause.ModelClause.ModelColumnClause)1