use of com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterIndexStatement in project druid by alibaba.
the class OracleStatementParser method parserAlter.
public SQLStatement parserAlter() {
accept(Token.ALTER);
if (lexer.token() == Token.SESSION) {
lexer.nextToken();
OracleAlterSessionStatement stmt = new OracleAlterSessionStatement();
if (lexer.token() == Token.SET) {
lexer.nextToken();
parseAssignItems(stmt.getItems(), stmt);
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
return stmt;
} else if (lexer.token() == Token.PROCEDURE) {
lexer.nextToken();
OracleAlterProcedureStatement stmt = new OracleAlterProcedureStatement();
stmt.setName(this.exprParser.name());
if (identifierEquals("COMPILE")) {
lexer.nextToken();
stmt.setCompile(true);
}
if (identifierEquals("REUSE")) {
lexer.nextToken();
acceptIdentifier("SETTINGS");
stmt.setReuseSettings(true);
}
return stmt;
} else if (lexer.token() == Token.TABLE) {
return parseAlterTable();
} else if (lexer.token() == Token.INDEX) {
lexer.nextToken();
OracleAlterIndexStatement stmt = new OracleAlterIndexStatement();
stmt.setName(this.exprParser.name());
if (identifierEquals("RENAME")) {
lexer.nextToken();
accept(Token.TO);
stmt.setRenameTo(this.exprParser.name());
}
for (; ; ) {
if (identifierEquals("rebuild")) {
lexer.nextToken();
OracleAlterIndexStatement.Rebuild rebuild = new OracleAlterIndexStatement.Rebuild();
stmt.setRebuild(rebuild);
continue;
} else if (identifierEquals("MONITORING")) {
lexer.nextToken();
acceptIdentifier("USAGE");
stmt.setMonitoringUsage(Boolean.TRUE);
continue;
} else if (identifierEquals("PARALLEL")) {
lexer.nextToken();
stmt.setParallel(this.exprParser.expr());
}
break;
}
return stmt;
} else if (lexer.token() == Token.TRIGGER) {
lexer.nextToken();
OracleAlterTriggerStatement stmt = new OracleAlterTriggerStatement();
stmt.setName(this.exprParser.name());
for (; ; ) {
if (lexer.token() == Token.ENABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.DISABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.FALSE);
continue;
} else if (identifierEquals("COMPILE")) {
lexer.nextToken();
stmt.setCompile(true);
continue;
}
break;
}
return stmt;
} else if (identifierEquals("SYNONYM")) {
lexer.nextToken();
OracleAlterSynonymStatement stmt = new OracleAlterSynonymStatement();
stmt.setName(this.exprParser.name());
for (; ; ) {
if (lexer.token() == Token.ENABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.DISABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.FALSE);
continue;
} else if (identifierEquals("COMPILE")) {
lexer.nextToken();
stmt.setCompile(true);
continue;
}
break;
}
return stmt;
} else if (lexer.token() == Token.VIEW) {
lexer.nextToken();
OracleAlterViewStatement stmt = new OracleAlterViewStatement();
stmt.setName(this.exprParser.name());
for (; ; ) {
if (lexer.token() == Token.ENABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.DISABLE) {
lexer.nextToken();
stmt.setEnable(Boolean.FALSE);
continue;
} else if (identifierEquals("COMPILE")) {
lexer.nextToken();
stmt.setCompile(true);
continue;
}
break;
}
return stmt;
} else if (lexer.token() == Token.TABLESPACE) {
lexer.nextToken();
OracleAlterTablespaceStatement stmt = new OracleAlterTablespaceStatement();
stmt.setName(this.exprParser.name());
if (identifierEquals("ADD")) {
lexer.nextToken();
if (identifierEquals("DATAFILE")) {
lexer.nextToken();
OracleAlterTablespaceAddDataFile item = new OracleAlterTablespaceAddDataFile();
for (; ; ) {
OracleFileSpecification file = new OracleFileSpecification();
for (; ; ) {
SQLExpr fileName = this.exprParser.expr();
file.getFileNames().add(fileName);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
if (identifierEquals("SIZE")) {
lexer.nextToken();
file.setSize(this.exprParser.expr());
}
if (identifierEquals("AUTOEXTEND")) {
lexer.nextToken();
if (identifierEquals("OFF")) {
lexer.nextToken();
file.setAutoExtendOff(true);
} else if (identifierEquals("ON")) {
lexer.nextToken();
file.setAutoExtendOn(this.exprParser.expr());
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
}
item.getFiles().add(file);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
stmt.setItem(item);
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
return stmt;
}
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
use of com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleAlterIndexStatement in project druid by alibaba.
the class OracleASTVisitorAdapterTest method test_adapter.
public void test_adapter() throws Exception {
OracleASTVisitorAdapter adapter = new OracleASTVisitorAdapter();
new OraclePLSQLCommitStatement().accept(adapter);
new OracleAnalytic().accept(adapter);
new OracleAnalyticWindowing().accept(adapter);
new SQLDateExpr().accept(adapter);
new OracleDbLinkExpr().accept(adapter);
new OracleSelectForUpdate().accept(adapter);
new OracleSelectHierachicalQueryClause().accept(adapter);
new OracleSelectPivot.Item().accept(adapter);
new OracleSelectPivot().accept(adapter);
new CheckOption().accept(adapter);
new ReadOnly().accept(adapter);
new OracleSelectUnPivot().accept(adapter);
new SQLTimestampExpr().accept(adapter);
new PartitionExtensionClause().accept(adapter);
new VersionsFlashbackQueryClause().accept(adapter);
new VersionsFlashbackQueryClause().accept(adapter);
new AsOfFlashbackQueryClause().accept(adapter);
new SQLGroupingSetExpr().accept(adapter);
new OracleWithSubqueryEntry().accept(adapter);
new OracleFileSpecification().accept(adapter);
new OracleAlterTablespaceAddDataFile().accept(adapter);
new OracleAlterTablespaceStatement().accept(adapter);
new SQLCreateSequenceStatement().accept(adapter);
new SQLLoopStatement().accept(adapter);
new OracleIntervalExpr().accept(adapter);
new OracleDeleteStatement().accept(adapter);
new OracleUpdateStatement().accept(adapter);
new SampleClause().accept(adapter);
new OracleSelectTableReference().accept(adapter);
new SearchClause().accept(adapter);
new CycleClause().accept(adapter);
new OracleBinaryFloatExpr().accept(adapter);
new OracleBinaryDoubleExpr().accept(adapter);
new OracleCursorExpr().accept(adapter);
new OracleIsSetExpr().accept(adapter);
new ReturnRowsClause().accept(adapter);
new ModelClause().accept(adapter);
new MainModelClause().accept(adapter);
new ModelColumnClause().accept(adapter);
new QueryPartitionClause().accept(adapter);
new ModelColumn().accept(adapter);
new ModelRulesClause().accept(adapter);
new CellAssignmentItem().accept(adapter);
new CellAssignment().accept(adapter);
new SQLMergeStatement().accept(adapter);
new MergeUpdateClause().accept(adapter);
new MergeInsertClause().accept(adapter);
new SQLErrorLoggingClause().accept(adapter);
new OracleReturningClause().accept(adapter);
new OracleInsertStatement().accept(adapter);
new InsertIntoClause().accept(adapter);
new OracleMultiInsertStatement().accept(adapter);
new ConditionalInsertClause().accept(adapter);
new ConditionalInsertClauseItem().accept(adapter);
new OracleSelectQueryBlock().accept(adapter);
new SQLBlockStatement().accept(adapter);
new OracleLockTableStatement().accept(adapter);
new OracleAlterSessionStatement().accept(adapter);
new OracleExprStatement().accept(adapter);
new OracleDatetimeExpr().accept(adapter);
new OracleExceptionStatement().accept(adapter);
new OracleExceptionStatement.Item().accept(adapter);
new OracleArgumentExpr().accept(adapter);
new OracleSetTransactionStatement().accept(adapter);
new SQLDropSequenceStatement().accept(adapter);
new OracleDataTypeIntervalDay().accept(adapter);
new OracleDataTypeIntervalYear().accept(adapter);
new OracleDataTypeTimestamp().accept(adapter);
new OracleDropDbLinkStatement().accept(adapter);
new OracleCreateDatabaseDbLinkStatement().accept(adapter);
new SQLCreateProcedureStatement().accept(adapter);
new OracleSavePointStatement().accept(adapter);
new SQLFetchStatement().accept(adapter);
new OracleExitStatement().accept(adapter);
new OracleExplainStatement().accept(adapter);
new OracleAlterProcedureStatement().accept(adapter);
new OracleAlterTableDropPartition().accept(adapter);
new OracleAlterTableTruncatePartition().accept(adapter);
new OracleAlterTableSplitPartition.TableSpaceItem().accept(adapter);
new OracleAlterTableSplitPartition.UpdateIndexesClause().accept(adapter);
new OracleAlterTableSplitPartition.NestedTablePartitionSpec().accept(adapter);
new OracleAlterTableSplitPartition().accept(adapter);
new OracleAlterTableModify().accept(adapter);
new OracleCreateIndexStatement().accept(adapter);
new OracleAlterIndexStatement().accept(adapter);
new OracleForStatement().accept(adapter);
new OracleAlterIndexStatement().accept(adapter);
new OracleRangeExpr().accept(adapter);
new OraclePrimaryKey().accept(adapter);
new OracleCreateTableStatement().accept(adapter);
new SQLAlterTableRename().accept(adapter);
new OracleStorageClause().accept(adapter);
new OracleGotoStatement().accept(adapter);
new OracleLabelStatement().accept(adapter);
new SQLParameter().accept(adapter);
new OracleCommitStatement().accept(adapter);
new OracleAlterTriggerStatement().accept(adapter);
new OracleAlterSynonymStatement().accept(adapter);
new AsOfSnapshotClause().accept(adapter);
new OracleAlterViewStatement().accept(adapter);
new OracleAlterTableMoveTablespace().accept(adapter);
new OracleSizeExpr().accept(adapter);
}
Aggregations