Search in sources :

Example 1 with UpdateIndexesClause

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

the class OracleStatementParser method parseAlterTableSplit.

private void parseAlterTableSplit(SQLAlterTableStatement stmt) {
    lexer.nextToken();
    if (identifierEquals("PARTITION")) {
        lexer.nextToken();
        OracleAlterTableSplitPartition item = new OracleAlterTableSplitPartition();
        item.setName(this.exprParser.name());
        if (identifierEquals("AT")) {
            lexer.nextToken();
            accept(Token.LPAREN);
            this.exprParser.exprList(item.getAt(), item);
            accept(Token.RPAREN);
        } else {
            throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
        }
        if (lexer.token() == Token.INTO) {
            lexer.nextToken();
            accept(Token.LPAREN);
            for (; ; ) {
                NestedTablePartitionSpec spec = new NestedTablePartitionSpec();
                acceptIdentifier("PARTITION");
                spec.setPartition(this.exprParser.name());
                for (; ; ) {
                    if (lexer.token() == Token.TABLESPACE) {
                        lexer.nextToken();
                        SQLName tablespace = this.exprParser.name();
                        spec.getSegmentAttributeItems().add(new TableSpaceItem(tablespace));
                        continue;
                    } else if (identifierEquals("PCTREE")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("PCTUSED")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("INITRANS")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("STORAGE")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("LOGGING")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("NOLOGGING")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("FILESYSTEM_LIKE_LOGGING")) {
                        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
                    }
                    break;
                }
                item.getInto().add(spec);
                if (lexer.token() == Token.COMMA) {
                    lexer.nextToken();
                    continue;
                }
                break;
            }
            accept(Token.RPAREN);
        }
        if (lexer.token() == Token.UPDATE) {
            lexer.nextToken();
            acceptIdentifier("INDEXES");
            UpdateIndexesClause updateIndexes = new UpdateIndexesClause();
            item.setUpdateIndexes(updateIndexes);
        }
        stmt.addItem(item);
    } else {
        throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
    }
}
Also used : ParserException(com.alibaba.druid.sql.parser.ParserException) SQLName(com.alibaba.druid.sql.ast.SQLName) UpdateIndexesClause(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.UpdateIndexesClause) NestedTablePartitionSpec(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.NestedTablePartitionSpec) OracleAlterTableSplitPartition(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition) TableSpaceItem(com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.TableSpaceItem)

Aggregations

SQLName (com.alibaba.druid.sql.ast.SQLName)1 OracleAlterTableSplitPartition (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition)1 NestedTablePartitionSpec (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.NestedTablePartitionSpec)1 TableSpaceItem (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.TableSpaceItem)1 UpdateIndexesClause (com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterTableSplitPartition.UpdateIndexesClause)1 ParserException (com.alibaba.druid.sql.parser.ParserException)1