use of com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause 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;
}
use of com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause in project druid by alibaba.
the class OracleCreateTableParser method parseCrateTable.
public OracleCreateTableStatement parseCrateTable(boolean acceptCreate) {
OracleCreateTableStatement stmt = (OracleCreateTableStatement) super.parseCrateTable(acceptCreate);
for (; ; ) {
if (lexer.token() == Token.TABLESPACE) {
lexer.nextToken();
stmt.setTablespace(this.exprParser.name());
continue;
} else if (identifierEquals("IN_MEMORY_METADATA")) {
lexer.nextToken();
stmt.setInMemoryMetadata(true);
continue;
} else if (identifierEquals("CURSOR_SPECIFIC_SEGMENT")) {
lexer.nextToken();
stmt.setCursorSpecificSegment(true);
continue;
} else if (identifierEquals("NOPARALLEL")) {
lexer.nextToken();
stmt.setParallel(false);
continue;
} else if (lexer.token() == Token.LOGGING) {
lexer.nextToken();
stmt.setLogging(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.CACHE) {
lexer.nextToken();
stmt.setCache(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.NOCACHE) {
lexer.nextToken();
stmt.setCache(Boolean.FALSE);
continue;
} else if (lexer.token() == Token.NOCOMPRESS) {
lexer.nextToken();
stmt.setCompress(Boolean.FALSE);
continue;
} else if (lexer.token() == Token.ON) {
lexer.nextToken();
accept(Token.COMMIT);
stmt.setOnCommit(true);
continue;
} else if (identifierEquals("PRESERVE")) {
lexer.nextToken();
acceptIdentifier("ROWS");
stmt.setPreserveRows(true);
continue;
} else if (identifierEquals("STORAGE")) {
OracleStorageClause storage = ((OracleExprParser) this.exprParser).parseStorage();
stmt.setStorage(storage);
continue;
} else if (identifierEquals("organization")) {
lexer.nextToken();
accept(Token.INDEX);
stmt.setOrganizationIndex(true);
continue;
} else if (lexer.token() == Token.PCTFREE) {
lexer.nextToken();
stmt.setPtcfree(this.exprParser.expr());
continue;
} else if (identifierEquals("PCTUSED")) {
lexer.nextToken();
stmt.setPctused(this.exprParser.expr());
continue;
} else if (lexer.token() == Token.STORAGE) {
OracleStorageClause storage = ((OracleExprParser) this.exprParser).parseStorage();
stmt.setStorage(storage);
continue;
} else if (lexer.token() == Token.LOB) {
OracleLobStorageClause lobStorage = ((OracleExprParser) this.exprParser).parseLobStorage();
stmt.setLobStorage(lobStorage);
continue;
} else if (lexer.token() == Token.INITRANS) {
lexer.nextToken();
stmt.setInitrans(this.exprParser.expr());
continue;
} else if (lexer.token() == Token.MAXTRANS) {
lexer.nextToken();
stmt.setMaxtrans(this.exprParser.expr());
continue;
} else if (lexer.token() == Token.SEGMENT) {
lexer.nextToken();
accept(Token.CREATION);
if (lexer.token() == Token.IMMEDIATE) {
lexer.nextToken();
stmt.setDeferredSegmentCreation(DeferredSegmentCreation.IMMEDIATE);
} else {
accept(Token.DEFERRED);
stmt.setDeferredSegmentCreation(DeferredSegmentCreation.DEFERRED);
}
continue;
} else if (identifierEquals("PARTITION")) {
lexer.nextToken();
accept(Token.BY);
if (identifierEquals("RANGE")) {
SQLPartitionByRange partitionByRange = partitionByRange();
partitionClauseRest(partitionByRange);
stmt.setPartitioning(partitionByRange);
continue;
} else if (identifierEquals("HASH")) {
SQLPartitionByHash partitionByHash = partitionByHash();
partitionClauseRest(partitionByHash);
stmt.setPartitioning(partitionByHash);
continue;
} else if (identifierEquals("LIST")) {
SQLPartitionByList partitionByList = partitionByList();
partitionClauseRest(partitionByList);
stmt.setPartitioning(partitionByList);
continue;
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
}
break;
}
if (lexer.token() == Token.AS) {
lexer.nextToken();
OracleSelect select = new OracleSelectParser(exprParser).select();
stmt.setSelect(select);
}
return stmt;
}
use of com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause in project druid by alibaba.
the class OracleExprParser method parseStorage.
public OracleStorageClause parseStorage() {
lexer.nextToken();
accept(Token.LPAREN);
OracleStorageClause storage = new OracleStorageClause();
for (; ; ) {
if (identifierEquals("INITIAL")) {
lexer.nextToken();
storage.setInitial(this.expr());
continue;
} else if (lexer.token() == Token.NEXT) {
lexer.nextToken();
storage.setNext(this.expr());
continue;
} else if (lexer.token() == Token.MINEXTENTS) {
lexer.nextToken();
storage.setMinExtents(this.expr());
continue;
} else if (lexer.token() == Token.MAXEXTENTS) {
lexer.nextToken();
storage.setMaxExtents(this.expr());
continue;
} else if (lexer.token() == Token.MAXSIZE) {
lexer.nextToken();
storage.setMaxSize(this.expr());
continue;
} else if (lexer.token() == Token.PCTINCREASE) {
lexer.nextToken();
storage.setPctIncrease(this.expr());
continue;
} else if (identifierEquals("FREELISTS")) {
lexer.nextToken();
storage.setFreeLists(this.expr());
continue;
} else if (identifierEquals("FREELIST")) {
lexer.nextToken();
acceptIdentifier("GROUPS");
storage.setFreeListGroups(this.expr());
continue;
} else if (identifierEquals("BUFFER_POOL")) {
lexer.nextToken();
storage.setBufferPool(this.expr());
continue;
} else if (identifierEquals("OBJNO")) {
lexer.nextToken();
storage.setObjno(this.expr());
continue;
} else if (lexer.token() == Token.FLASH_CACHE) {
lexer.nextToken();
FlashCacheType flashCacheType;
if (lexer.token() == Token.KEEP) {
flashCacheType = FlashCacheType.KEEP;
lexer.nextToken();
} else if (lexer.token() == Token.NONE) {
flashCacheType = FlashCacheType.NONE;
lexer.nextToken();
} else {
accept(Token.DEFAULT);
flashCacheType = FlashCacheType.DEFAULT;
}
storage.setFlashCache(flashCacheType);
continue;
} else if (lexer.token() == Token.CELL_FLASH_CACHE) {
lexer.nextToken();
FlashCacheType flashCacheType;
if (lexer.token() == Token.KEEP) {
flashCacheType = FlashCacheType.KEEP;
lexer.nextToken();
} else if (lexer.token() == Token.NONE) {
flashCacheType = FlashCacheType.NONE;
lexer.nextToken();
} else {
accept(Token.DEFAULT);
flashCacheType = FlashCacheType.DEFAULT;
}
storage.setCellFlashCache(flashCacheType);
continue;
}
break;
}
accept(Token.RPAREN);
return storage;
}
use of com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause 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