Search in sources :

Example 1 with OracleUsingIndexClause

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

the class OracleExprParser method parsePrimaryKey.

public OraclePrimaryKey parsePrimaryKey() {
    lexer.nextToken();
    accept(Token.KEY);
    OraclePrimaryKey primaryKey = new OraclePrimaryKey();
    accept(Token.LPAREN);
    exprList(primaryKey.getColumns(), primaryKey);
    accept(Token.RPAREN);
    if (lexer.token() == Token.USING) {
        OracleUsingIndexClause using = parseUsingIndex();
        primaryKey.setUsing(using);
    }
    return primaryKey;
}
Also used : OraclePrimaryKey(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OraclePrimaryKey) OracleUsingIndexClause(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUsingIndexClause)

Example 2 with OracleUsingIndexClause

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

the class OracleExprParser method parseUsingIndex.

private OracleUsingIndexClause parseUsingIndex() {
    accept(Token.USING);
    accept(Token.INDEX);
    OracleUsingIndexClause using = new OracleUsingIndexClause();
    for (; ; ) {
        if (lexer.token() == Token.TABLESPACE) {
            lexer.nextToken();
            using.setTablespace(this.name());
            continue;
        } else if (lexer.token() == Token.PCTFREE) {
            lexer.nextToken();
            using.setPtcfree(this.expr());
            continue;
        } else if (lexer.token() == Token.INITRANS) {
            lexer.nextToken();
            using.setInitrans(this.expr());
            continue;
        } else if (lexer.token() == Token.MAXTRANS) {
            lexer.nextToken();
            using.setMaxtrans(this.expr());
            continue;
        } else if (lexer.token() == Token.COMPUTE) {
            lexer.nextToken();
            acceptIdentifier("STATISTICS");
            using.setComputeStatistics(true);
            continue;
        } else if (lexer.token() == Token.ENABLE) {
            lexer.nextToken();
            using.setEnable(true);
            continue;
        } else if (lexer.token() == Token.DISABLE) {
            lexer.nextToken();
            using.setEnable(false);
            continue;
        } else if (lexer.token() == Token.STORAGE) {
            OracleStorageClause storage = parseStorage();
            using.setStorage(storage);
            continue;
        } else if (lexer.token() == Token.IDENTIFIER) {
            using.setTablespace(this.name());
            break;
        } else {
            break;
        }
    }
    return using;
}
Also used : OracleUsingIndexClause(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUsingIndexClause) OracleStorageClause(com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause)

Example 3 with OracleUsingIndexClause

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

the class OracleExprParser method parseUnique.

public SQLUnique parseUnique() {
    accept(Token.UNIQUE);
    OracleUnique unique = new OracleUnique();
    accept(Token.LPAREN);
    exprList(unique.getColumns(), unique);
    accept(Token.RPAREN);
    if (lexer.token() == Token.USING) {
        OracleUsingIndexClause using = parseUsingIndex();
        unique.setUsing(using);
    }
    return unique;
}
Also used : OracleUsingIndexClause(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUsingIndexClause) OracleUnique(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUnique)

Aggregations

OracleUsingIndexClause (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUsingIndexClause)3 OracleStorageClause (com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause)1 OraclePrimaryKey (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OraclePrimaryKey)1 OracleUnique (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleUnique)1