mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -954,7 +954,7 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
lexer.nextToken();
|
||||
}
|
||||
SQLName tableSpace = this.name();
|
||||
partitionDef.setTableSpace(tableSpace);
|
||||
partitionDef.setTablespace(tableSpace);
|
||||
} else if (lexer.token() == Token.INDEX) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("DIRECTORY");
|
||||
|
||||
@@ -512,22 +512,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
x.getLike().accept(this);
|
||||
}
|
||||
|
||||
int size = x.getTableElementList().size();
|
||||
if (size > 0) {
|
||||
print0(" (");
|
||||
incrementIndent();
|
||||
println();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (i != 0) {
|
||||
print0(", ");
|
||||
println();
|
||||
}
|
||||
x.getTableElementList().get(i).accept(this);
|
||||
}
|
||||
decrementIndent();
|
||||
println();
|
||||
print(')');
|
||||
}
|
||||
printTableElements(x.getTableElementList());
|
||||
|
||||
for (Map.Entry<String, SQLObject> option : x.getTableOptions().entrySet()) {
|
||||
String key = option.getKey();
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 1999-2017 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.oracle.ast;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 21/05/2017.
|
||||
*/
|
||||
public interface OracleSegmentAttributes extends SQLObject {
|
||||
|
||||
SQLName getTablespace();
|
||||
void setTablespace(SQLName name);
|
||||
|
||||
Boolean getCompress();
|
||||
|
||||
void setCompress(Boolean compress);
|
||||
|
||||
Integer getCompressLevel();
|
||||
|
||||
void setCompressLevel(Integer compressLevel);
|
||||
|
||||
Integer getInitrans();
|
||||
void setInitrans(Integer initrans);
|
||||
|
||||
Integer getMaxtrans();
|
||||
void setMaxtrans(Integer maxtrans);
|
||||
|
||||
Integer getPctincrease();
|
||||
void setPctincrease(Integer pctincrease);
|
||||
|
||||
Integer getPctused();
|
||||
void setPctused(Integer pctused);
|
||||
|
||||
Integer getPctfree();
|
||||
void setPctfree(Integer ptcfree);
|
||||
|
||||
Boolean getLogging();
|
||||
void setLogging(Boolean logging);
|
||||
|
||||
SQLObject getStorage();
|
||||
void setStorage(SQLObject storage);
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 1999-2017 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.oracle.ast;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 21/05/2017.
|
||||
*/
|
||||
public abstract class OracleSegmentAttributesImpl extends SQLObjectImpl implements OracleSegmentAttributes {
|
||||
private Integer pctfree;
|
||||
private Integer pctused;
|
||||
private Integer initrans;
|
||||
|
||||
private Integer maxtrans;
|
||||
private Integer pctincrease;
|
||||
private Integer freeLists;
|
||||
private Boolean compress;
|
||||
private Integer compressLevel;
|
||||
private Integer pctthreshold;
|
||||
|
||||
private Boolean logging;
|
||||
|
||||
protected SQLName tablespace;
|
||||
protected SQLObject storage;
|
||||
|
||||
public SQLName getTablespace() {
|
||||
return tablespace;
|
||||
}
|
||||
|
||||
public void setTablespace(SQLName tablespace) {
|
||||
if (tablespace != null) {
|
||||
tablespace.setParent(this);
|
||||
}
|
||||
this.tablespace = tablespace;
|
||||
}
|
||||
|
||||
public Boolean getCompress() {
|
||||
return compress;
|
||||
}
|
||||
|
||||
public void setCompress(Boolean compress) {
|
||||
this.compress = compress;
|
||||
}
|
||||
|
||||
public Integer getCompressLevel() {
|
||||
return compressLevel;
|
||||
}
|
||||
|
||||
public void setCompressLevel(Integer compressLevel) {
|
||||
this.compressLevel = compressLevel;
|
||||
}
|
||||
|
||||
public Integer getPctthreshold() {
|
||||
return pctthreshold;
|
||||
}
|
||||
|
||||
public void setPctthreshold(Integer pctthreshold) {
|
||||
this.pctthreshold = pctthreshold;
|
||||
}
|
||||
|
||||
public Integer getPctfree() {
|
||||
return pctfree;
|
||||
}
|
||||
|
||||
public void setPctfree(Integer ptcfree) {
|
||||
this.pctfree = ptcfree;
|
||||
}
|
||||
|
||||
public Integer getPctused() {
|
||||
return pctused;
|
||||
}
|
||||
|
||||
public void setPctused(Integer ptcused) {
|
||||
this.pctused = ptcused;
|
||||
}
|
||||
|
||||
public Integer getInitrans() {
|
||||
return initrans;
|
||||
}
|
||||
|
||||
public void setInitrans(Integer initrans) {
|
||||
this.initrans = initrans;
|
||||
}
|
||||
|
||||
public Integer getMaxtrans() {
|
||||
return maxtrans;
|
||||
}
|
||||
|
||||
public void setMaxtrans(Integer maxtrans) {
|
||||
this.maxtrans = maxtrans;
|
||||
}
|
||||
|
||||
public Integer getPctincrease() {
|
||||
return pctincrease;
|
||||
}
|
||||
|
||||
public void setPctincrease(Integer pctincrease) {
|
||||
this.pctincrease = pctincrease;
|
||||
}
|
||||
|
||||
public Integer getFreeLists() {
|
||||
return freeLists;
|
||||
}
|
||||
|
||||
public void setFreeLists(Integer freeLists) {
|
||||
this.freeLists = freeLists;
|
||||
}
|
||||
|
||||
public Boolean getLogging() {
|
||||
return logging;
|
||||
}
|
||||
|
||||
public void setLogging(Boolean logging) {
|
||||
this.logging = logging;
|
||||
}
|
||||
|
||||
public SQLObject getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void setStorage(SQLObject storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,9 @@ public interface OracleConstraint extends OracleSQLObject, SQLConstraint, SQLTab
|
||||
|
||||
void setEnable(Boolean enable);
|
||||
|
||||
Boolean getValidate();
|
||||
void setValidate(Boolean validate);
|
||||
|
||||
Initially getInitially();
|
||||
|
||||
void setInitially(Initially value);
|
||||
|
||||
+95
-22
@@ -15,17 +15,24 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.oracle.ast.stmt;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObject;
|
||||
import com.alibaba.druid.sql.ast.SQLPartitionBy;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObject;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributes;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributesImpl;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleLobStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class OracleCreateTableStatement extends SQLCreateTableStatement implements OracleDDLStatement {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OracleCreateTableStatement extends SQLCreateTableStatement implements OracleDDLStatement, OracleSegmentAttributes {
|
||||
|
||||
private SQLName tablespace;
|
||||
|
||||
@@ -41,13 +48,15 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
|
||||
private boolean organizationIndex = false;
|
||||
|
||||
private SQLExpr ptcfree;
|
||||
private SQLExpr pctused;
|
||||
private SQLExpr initrans;
|
||||
private SQLExpr maxtrans;
|
||||
private Integer pctfree;
|
||||
private Integer pctused;
|
||||
private Integer initrans;
|
||||
private Integer maxtrans;
|
||||
private Integer pctincrease;
|
||||
|
||||
private Boolean logging;
|
||||
private Boolean compress;
|
||||
private Integer compressLevel;
|
||||
private boolean onCommit;
|
||||
private boolean preserveRows;
|
||||
|
||||
@@ -60,6 +69,11 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
private boolean forOLTP;
|
||||
|
||||
private Boolean enableRowMovement;
|
||||
|
||||
private List<SQLName> clusterColumns = new ArrayList<SQLName>();
|
||||
private SQLName cluster;
|
||||
|
||||
private Organization organization;
|
||||
|
||||
public OracleCreateTableStatement() {
|
||||
super (JdbcConstants.ORACLE);
|
||||
@@ -129,44 +143,52 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
this.compress = compress;
|
||||
}
|
||||
|
||||
public SQLExpr getPtcfree() {
|
||||
return ptcfree;
|
||||
public Integer getCompressLevel() {
|
||||
return compressLevel;
|
||||
}
|
||||
|
||||
public void setPtcfree(SQLExpr ptcfree) {
|
||||
this.ptcfree = ptcfree;
|
||||
public void setCompressLevel(Integer compressLevel) {
|
||||
this.compressLevel = compressLevel;
|
||||
}
|
||||
|
||||
public SQLExpr getPctused() {
|
||||
public Integer getPctfree() {
|
||||
return pctfree;
|
||||
}
|
||||
|
||||
public void setPctfree(Integer pctfree) {
|
||||
this.pctfree = pctfree;
|
||||
}
|
||||
|
||||
public Integer getPctused() {
|
||||
return pctused;
|
||||
}
|
||||
|
||||
public void setPctused(SQLExpr pctused) {
|
||||
public void setPctused(Integer pctused) {
|
||||
this.pctused = pctused;
|
||||
}
|
||||
|
||||
public SQLExpr getInitrans() {
|
||||
public Integer getInitrans() {
|
||||
return initrans;
|
||||
}
|
||||
|
||||
public void setInitrans(SQLExpr initrans) {
|
||||
public void setInitrans(Integer initrans) {
|
||||
this.initrans = initrans;
|
||||
}
|
||||
|
||||
public SQLExpr getMaxtrans() {
|
||||
public Integer getMaxtrans() {
|
||||
return maxtrans;
|
||||
}
|
||||
|
||||
public void setMaxtrans(SQLExpr maxtrans) {
|
||||
public void setMaxtrans(Integer maxtrans) {
|
||||
this.maxtrans = maxtrans;
|
||||
}
|
||||
|
||||
public boolean isOrganizationIndex() {
|
||||
return organizationIndex;
|
||||
public Integer getPctincrease() {
|
||||
return pctincrease;
|
||||
}
|
||||
|
||||
public void setOrganizationIndex(boolean organizationIndex) {
|
||||
this.organizationIndex = organizationIndex;
|
||||
public void setPctincrease(Integer pctincrease) {
|
||||
this.pctincrease = pctincrease;
|
||||
}
|
||||
|
||||
public Boolean getParallel() {
|
||||
@@ -209,11 +231,11 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void setStorage(OracleStorageClause storage) {
|
||||
public void setStorage(SQLObject storage) {
|
||||
if (storage != null) {
|
||||
storage.setParent(this);
|
||||
}
|
||||
this.storage = storage;
|
||||
this.storage = (OracleStorageClause) storage;
|
||||
}
|
||||
|
||||
public boolean isForOLTP() {
|
||||
@@ -232,6 +254,32 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
this.enableRowMovement = enableRowMovement;
|
||||
}
|
||||
|
||||
public List<SQLName> getClusterColumns() {
|
||||
return clusterColumns;
|
||||
}
|
||||
|
||||
public SQLName getCluster() {
|
||||
return cluster;
|
||||
}
|
||||
|
||||
public void setCluster(SQLName cluster) {
|
||||
if (cluster != null) {
|
||||
cluster.setParent(this);
|
||||
}
|
||||
this.cluster = cluster;
|
||||
}
|
||||
|
||||
public Organization getOrganization() {
|
||||
return organization;
|
||||
}
|
||||
|
||||
public void setOrganization(Organization organization) {
|
||||
if (organization != null) {
|
||||
organization.setParent(this);
|
||||
}
|
||||
this.organization = organization;
|
||||
}
|
||||
|
||||
public void accept0(OracleASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
this.acceptChild(visitor, tableSource);
|
||||
@@ -247,4 +295,29 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
public static enum DeferredSegmentCreation {
|
||||
IMMEDIATE, DEFERRED
|
||||
}
|
||||
|
||||
public static class Organization extends OracleSegmentAttributesImpl implements OracleSegmentAttributes, OracleSQLObject {
|
||||
public String type;
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
this.accept0((OracleASTVisitor) visitor);
|
||||
}
|
||||
|
||||
public void accept0(OracleASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, tablespace);
|
||||
acceptChild(visitor, storage);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class OraclePrimaryKey extends SQLPrimaryKeyImpl implements OracleConstraint, SQLPrimaryKey, SQLTableElement {
|
||||
|
||||
private SQLName name;
|
||||
|
||||
private OracleUsingIndexClause using;
|
||||
private SQLName exceptionsInto;
|
||||
private Boolean enable;
|
||||
@@ -61,14 +59,6 @@ public class OraclePrimaryKey extends SQLPrimaryKeyImpl implements OracleConstra
|
||||
this.deferrable = deferrable;
|
||||
}
|
||||
|
||||
public SQLName getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(SQLName name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<SQLExpr> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
+3
-28
@@ -17,6 +17,7 @@ package com.alibaba.druid.sql.dialect.oracle.ast.stmt;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLPartition;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
|
||||
@@ -44,7 +45,7 @@ public class OracleUsingIndexClause extends OracleSQLObjectImpl {
|
||||
private boolean nocompress = false;
|
||||
private Boolean logging = null;
|
||||
|
||||
private List<PartitionedItem> localPartitionIndex = new ArrayList<PartitionedItem>();
|
||||
private List<SQLPartition> localPartitionIndex = new ArrayList<SQLPartition>();
|
||||
|
||||
public OracleUsingIndexClause(){
|
||||
|
||||
@@ -156,33 +157,7 @@ public class OracleUsingIndexClause extends OracleSQLObjectImpl {
|
||||
this.logging = logging;
|
||||
}
|
||||
|
||||
public List<PartitionedItem> getLocalPartitionIndex() {
|
||||
public List<SQLPartition> getLocalPartitionIndex() {
|
||||
return localPartitionIndex;
|
||||
}
|
||||
|
||||
public static class PartitionedItem extends OracleSQLObjectImpl {
|
||||
private SQLName partition;
|
||||
private SQLName tablespace;
|
||||
|
||||
@Override
|
||||
public void accept0(OracleASTVisitor visitor) {
|
||||
|
||||
}
|
||||
|
||||
public SQLName getPartition() {
|
||||
return partition;
|
||||
}
|
||||
|
||||
public void setPartition(SQLName partition) {
|
||||
this.partition = partition;
|
||||
}
|
||||
|
||||
public SQLName getTablespace() {
|
||||
return tablespace;
|
||||
}
|
||||
|
||||
public void setTablespace(SQLName tablespace) {
|
||||
this.tablespace = tablespace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+59
-140
@@ -22,13 +22,12 @@ import com.alibaba.druid.sql.ast.SQLPartitionBy;
|
||||
import com.alibaba.druid.sql.ast.SQLPartitionByHash;
|
||||
import com.alibaba.druid.sql.ast.SQLPartitionByList;
|
||||
import com.alibaba.druid.sql.ast.SQLPartitionByRange;
|
||||
import com.alibaba.druid.sql.ast.SQLPartitionValue;
|
||||
import com.alibaba.druid.sql.ast.SQLSubPartition;
|
||||
import com.alibaba.druid.sql.ast.SQLSubPartitionBy;
|
||||
import com.alibaba.druid.sql.ast.SQLSubPartitionByHash;
|
||||
import com.alibaba.druid.sql.ast.SQLSubPartitionByList;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLNumericLiteralExpr;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleLobStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause;
|
||||
@@ -37,11 +36,7 @@ import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleCreateTableStatement.
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelect;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSupplementalIdKey;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSupplementalLogGrp;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.SQLCreateTableParser;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import com.alibaba.druid.sql.parser.*;
|
||||
|
||||
public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
|
||||
@@ -61,11 +56,9 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
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")) {
|
||||
this.getExprParser().parseSegmentAttributes(stmt);
|
||||
|
||||
if (identifierEquals("IN_MEMORY_METADATA")) {
|
||||
lexer.nextToken();
|
||||
stmt.setInMemoryMetadata(true);
|
||||
continue;
|
||||
@@ -77,14 +70,6 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
lexer.nextToken();
|
||||
stmt.setParallel(false);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.LOGGING) {
|
||||
lexer.nextToken();
|
||||
stmt.setLogging(Boolean.TRUE);
|
||||
continue;
|
||||
} else if (identifierEquals("NOLOGGING")) {
|
||||
lexer.nextToken();
|
||||
stmt.setLogging(Boolean.FALSE);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.CACHE) {
|
||||
lexer.nextToken();
|
||||
stmt.setCache(Boolean.TRUE);
|
||||
@@ -122,6 +107,11 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
} else if (identifierEquals("COMPRESS")) {
|
||||
lexer.nextToken();
|
||||
stmt.setCompress(Boolean.TRUE);
|
||||
|
||||
if (lexer.token() == Token.LITERAL_INT) {
|
||||
int compressLevel = ((SQLNumericLiteralExpr)this.exprParser.primary()).getNumber().intValue();
|
||||
stmt.setCompressLevel(compressLevel);
|
||||
}
|
||||
continue;
|
||||
} else if (lexer.token() == Token.FOR) {
|
||||
lexer.nextToken();
|
||||
@@ -149,26 +139,16 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
OracleStorageClause storage = ((OracleExprParser) this.exprParser).parseStorage();
|
||||
stmt.setStorage(storage);
|
||||
continue;
|
||||
} else if (identifierEquals("organization")) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.INDEX) {
|
||||
lexer.nextToken();
|
||||
stmt.setOrganizationIndex(true);
|
||||
} else if (identifierEquals("EXTERNAL")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
} else {
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
}
|
||||
} else if (identifierEquals("ORGANIZATION")) {
|
||||
parseOrganization(stmt);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.PCTFREE) {
|
||||
} else if (identifierEquals("CLUSTER")) {
|
||||
lexer.nextToken();
|
||||
stmt.setPtcfree(this.exprParser.expr());
|
||||
continue;
|
||||
} else if (identifierEquals("PCTUSED")) {
|
||||
lexer.nextToken();
|
||||
stmt.setPctused(this.exprParser.expr());
|
||||
SQLName cluster = this.exprParser.name();
|
||||
stmt.setCluster(cluster);
|
||||
accept(Token.LPAREN);
|
||||
this.exprParser.names(stmt.getClusterColumns(), cluster);
|
||||
accept(Token.RPAREN);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.STORAGE) {
|
||||
OracleStorageClause storage = ((OracleExprParser) this.exprParser).parseStorage();
|
||||
@@ -178,14 +158,6 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
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);
|
||||
@@ -214,7 +186,7 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
for (;;) {
|
||||
SQLPartition partition = this.parsePartition();
|
||||
SQLPartition partition = this.getExprParser().parsePartition();
|
||||
partitionByHash.addPartition(partition);
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
@@ -250,6 +222,38 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
return stmt;
|
||||
}
|
||||
|
||||
private void parseOrganization(OracleCreateTableStatement stmt) {
|
||||
OracleCreateTableStatement.Organization organization = new OracleCreateTableStatement.Organization();
|
||||
acceptIdentifier("ORGANIZATION");
|
||||
if (lexer.token() == Token.INDEX) {
|
||||
lexer.nextToken();
|
||||
organization.setType("INDEX");
|
||||
this.getExprParser().parseSegmentAttributes(organization);
|
||||
|
||||
// index_org_table_clause http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7002.htm#i2129638
|
||||
if (identifierEquals("PCTTHRESHOLD")) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (lexer.token() == Token.LITERAL_INT) {
|
||||
int pctthreshold = ((SQLNumericLiteralExpr) this.exprParser.primary()).getNumber().intValue();
|
||||
organization.setPctthreshold(pctthreshold);
|
||||
}
|
||||
}
|
||||
} else if (identifierEquals("HEAP")) {
|
||||
lexer.nextToken();
|
||||
organization.setType("HEAP");
|
||||
this.getExprParser().parseSegmentAttributes(organization);
|
||||
} else if (identifierEquals("EXTERNAL")) {
|
||||
lexer.nextToken();
|
||||
organization.setType("EXTERNAL");
|
||||
accept(Token.LPAREN);
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
} else {
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
}
|
||||
stmt.setOrganization(organization);
|
||||
}
|
||||
|
||||
protected SQLPartitionByList partitionByList() {
|
||||
acceptIdentifier("LIST");
|
||||
SQLPartitionByList partitionByList = new SQLPartitionByList();
|
||||
@@ -335,7 +339,7 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
accept(Token.LPAREN);
|
||||
|
||||
for (;;) {
|
||||
SQLPartition partition = parsePartition();
|
||||
SQLPartition partition = this.getExprParser().parsePartition();
|
||||
|
||||
clause.addPartition(partition);
|
||||
|
||||
@@ -350,97 +354,6 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
accept(Token.RPAREN);
|
||||
}
|
||||
|
||||
protected SQLPartition parsePartition() {
|
||||
accept(Token.PARTITION);
|
||||
SQLPartition partition = new SQLPartition();
|
||||
partition.setName(this.exprParser.name());
|
||||
|
||||
SQLPartitionValue values = this.exprParser.parsePartitionValues();
|
||||
if (values != null) {
|
||||
partition.setValues(values);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
|
||||
for (;;) {
|
||||
SQLSubPartition subPartition = parseSubPartition();
|
||||
|
||||
partition.addSubPartition(subPartition);
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
accept(Token.RPAREN);
|
||||
} else if (identifierEquals("SUBPARTITIONS")) {
|
||||
lexer.nextToken();
|
||||
SQLExpr subPartitionsCount = this.exprParser.primary();
|
||||
partition.setSubPartitionsCount(subPartitionsCount);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.TABLESPACE) {
|
||||
lexer.nextToken();
|
||||
partition.setTablespace(this.exprParser.name());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.PCTFREE) {
|
||||
lexer.nextToken();
|
||||
partition.setPtcfree(this.exprParser.expr());
|
||||
continue;
|
||||
} else if (identifierEquals("PCTUSED")) {
|
||||
lexer.nextToken();
|
||||
partition.setPctused(this.exprParser.expr());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.STORAGE) {
|
||||
OracleStorageClause storage = ((OracleExprParser) this.exprParser).parseStorage();
|
||||
partition.setStorage(storage);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.INITRANS) {
|
||||
lexer.nextToken();
|
||||
partition.setInitrans(this.exprParser.expr());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.MAXTRANS) {
|
||||
lexer.nextToken();
|
||||
partition.setMaxtrans(this.exprParser.expr());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.NOCOMPRESS) {
|
||||
lexer.nextToken();
|
||||
partition.setCompress(Boolean.FALSE);
|
||||
continue;
|
||||
} else if (identifierEquals("COMPRESS")) {
|
||||
lexer.nextToken();
|
||||
partition.setCompress(Boolean.TRUE);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.LOB) {
|
||||
OracleLobStorageClause lobStorage = ((OracleExprParser) this.exprParser).parseLobStorage();
|
||||
partition.setLobStorage(lobStorage);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return partition;
|
||||
}
|
||||
|
||||
protected SQLSubPartition parseSubPartition() {
|
||||
acceptIdentifier("SUBPARTITION");
|
||||
|
||||
SQLSubPartition subPartition = new SQLSubPartition();
|
||||
SQLName name = this.exprParser.name();
|
||||
subPartition.setName(name);
|
||||
|
||||
SQLPartitionValue values = this.exprParser.parsePartitionValues();
|
||||
if (values != null) {
|
||||
subPartition.setValues(values);
|
||||
}
|
||||
|
||||
return subPartition;
|
||||
}
|
||||
|
||||
protected void partitionClauseRest(SQLPartitionBy clause) {
|
||||
if (identifierEquals("PARTITIONS")) {
|
||||
lexer.nextToken();
|
||||
@@ -487,7 +400,7 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
accept(Token.LPAREN);
|
||||
|
||||
for (;;) {
|
||||
SQLSubPartition subPartition = parseSubPartition();
|
||||
SQLSubPartition subPartition = this.getExprParser().parseSubPartition();
|
||||
subPartition.setParent(byList);
|
||||
byList.getSubPartitionTemplate().add(subPartition);
|
||||
|
||||
@@ -593,4 +506,10 @@ public class OracleCreateTableParser extends SQLCreateTableParser {
|
||||
stmt.getTableElementList().add(idKey);
|
||||
}
|
||||
}
|
||||
|
||||
public OracleExprParser getExprParser() {
|
||||
return (OracleExprParser) exprParser;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,14 +17,8 @@ package com.alibaba.druid.sql.dialect.oracle.parser;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLDataType;
|
||||
import com.alibaba.druid.sql.ast.SQLDataTypeImpl;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLKeep;
|
||||
import com.alibaba.druid.sql.ast.*;
|
||||
import com.alibaba.druid.sql.ast.SQLKeep.DenseRank;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLOrderBy;
|
||||
import com.alibaba.druid.sql.ast.SQLOrderingSpecification;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLAggregateExpr;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLAggregateOption;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
|
||||
@@ -44,12 +38,11 @@ import com.alibaba.druid.sql.ast.expr.SQLVariantRefExpr;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLCharacterDataType;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLCheck;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLForeignKeyConstraint;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectOrderByItem;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLUnique;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeIntervalDay;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeIntervalYear;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeTimestamp;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributes;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleLobStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.OracleStorageClause.FlashCacheType;
|
||||
@@ -471,6 +464,7 @@ public class OracleExprParser extends SQLExprParser {
|
||||
case KEEP_DUPLICATES:
|
||||
case EXCEPTIONS:
|
||||
case PURGE:
|
||||
case OUTER:
|
||||
sqlExpr = new SQLIdentifierExpr(lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
return primaryRest(sqlExpr);
|
||||
@@ -1075,15 +1069,9 @@ public class OracleExprParser extends SQLExprParser {
|
||||
|
||||
// http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5010.htm#i2125897
|
||||
for (;;) {
|
||||
accept(Token.PARTITION);
|
||||
OracleUsingIndexClause.PartitionedItem item = new OracleUsingIndexClause.PartitionedItem();
|
||||
item.setPartition(this.name());
|
||||
if (lexer.token() == Token.TABLESPACE) {
|
||||
lexer.nextToken();
|
||||
item.setTablespace(this.name());
|
||||
}
|
||||
|
||||
using.getLocalPartitionIndex().add(item);
|
||||
SQLPartition partition = this.parsePartition();
|
||||
partition.setParent(using);
|
||||
using.getLocalPartitionIndex().add(partition);
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
@@ -1091,7 +1079,7 @@ public class OracleExprParser extends SQLExprParser {
|
||||
} else if (lexer.token() == Token.RPAREN) {
|
||||
break;
|
||||
} else {
|
||||
throw new ParserException("TODO " + lexer.token());
|
||||
throw new ParserException("TODO " + lexer.info());
|
||||
}
|
||||
}
|
||||
accept(Token.RPAREN);
|
||||
@@ -1390,7 +1378,18 @@ public class OracleExprParser extends SQLExprParser {
|
||||
constraint.setEnable(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("VALIDATE")) {
|
||||
lexer.nextToken();
|
||||
constraint.setValidate(Boolean.TRUE);
|
||||
continue;
|
||||
}
|
||||
if (identifierEquals("NOVALIDATE")) {
|
||||
lexer.nextToken();
|
||||
constraint.setValidate(Boolean.FALSE);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.INITIALLY) {
|
||||
lexer.nextToken();
|
||||
|
||||
@@ -1434,4 +1433,141 @@ public class OracleExprParser extends SQLExprParser {
|
||||
protected SQLCheck createCheck() {
|
||||
return new OracleCheck();
|
||||
}
|
||||
|
||||
protected SQLPartition parsePartition() {
|
||||
accept(Token.PARTITION);
|
||||
SQLPartition partition = new SQLPartition();
|
||||
partition.setName(this.name());
|
||||
|
||||
SQLPartitionValue values = this.parsePartitionValues();
|
||||
if (values != null) {
|
||||
partition.setValues(values);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
|
||||
for (;;) {
|
||||
SQLSubPartition subPartition = parseSubPartition();
|
||||
|
||||
partition.addSubPartition(subPartition);
|
||||
|
||||
if (lexer.token() == Token.COMMA) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
accept(Token.RPAREN);
|
||||
} else if (identifierEquals("SUBPARTITIONS")) {
|
||||
lexer.nextToken();
|
||||
SQLExpr subPartitionsCount = this.primary();
|
||||
partition.setSubPartitionsCount(subPartitionsCount);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
parseSegmentAttributes(partition);
|
||||
|
||||
if (lexer.token() == Token.LOB) {
|
||||
OracleLobStorageClause lobStorage = this.parseLobStorage();
|
||||
partition.setLobStorage(lobStorage);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.SEGMENT || identifierEquals("SEGMENT")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.CREATION);
|
||||
if (lexer.token() == Token.IMMEDIATE) {
|
||||
lexer.nextToken();
|
||||
partition.setSegmentCreationImmediate(true);
|
||||
} else if (lexer.token() == Token.DEFERRED) {
|
||||
lexer.nextToken();
|
||||
partition.setSegmentCreationDeferred(true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return partition;
|
||||
}
|
||||
|
||||
protected SQLSubPartition parseSubPartition() {
|
||||
acceptIdentifier("SUBPARTITION");
|
||||
|
||||
SQLSubPartition subPartition = new SQLSubPartition();
|
||||
SQLName name = this.name();
|
||||
subPartition.setName(name);
|
||||
|
||||
SQLPartitionValue values = this.parsePartitionValues();
|
||||
if (values != null) {
|
||||
subPartition.setValues(values);
|
||||
}
|
||||
|
||||
return subPartition;
|
||||
}
|
||||
|
||||
public void parseSegmentAttributes(OracleSegmentAttributes attributes) {
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.TABLESPACE) {
|
||||
lexer.nextToken();
|
||||
attributes.setTablespace(this.name());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.NOCOMPRESS || identifierEquals("NOCOMPRESS")) {
|
||||
lexer.nextToken();
|
||||
attributes.setCompress(Boolean.FALSE);
|
||||
continue;
|
||||
} else if (identifierEquals("COMPRESS")) {
|
||||
lexer.nextToken();
|
||||
attributes.setCompress(Boolean.TRUE);
|
||||
|
||||
if (lexer.token() == Token.LITERAL_INT) {
|
||||
int compressLevel = this.parseIntValue();
|
||||
attributes.setCompressLevel(compressLevel);
|
||||
} else if (identifierEquals("BASIC")) {
|
||||
lexer.nextToken();
|
||||
// TODO COMPRESS BASIC
|
||||
}
|
||||
continue;
|
||||
} else if (identifierEquals("NOCOMPRESS")) {
|
||||
lexer.nextToken();
|
||||
attributes.setCompress(Boolean.FALSE);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.LOGGING || identifierEquals("LOGGING")) {
|
||||
lexer.nextToken();
|
||||
attributes.setLogging(Boolean.TRUE);
|
||||
continue;
|
||||
} else if (identifierEquals("NOLOGGING")) {
|
||||
lexer.nextToken();
|
||||
attributes.setLogging(Boolean.FALSE);
|
||||
continue;
|
||||
} else if (lexer.token() == Token.INITRANS) {
|
||||
lexer.nextToken();
|
||||
attributes.setInitrans(this.parseIntValue());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.MAXTRANS) {
|
||||
lexer.nextToken();
|
||||
attributes.setMaxtrans(this.parseIntValue());
|
||||
} else if (lexer.token() == Token.PCTINCREASE) {
|
||||
lexer.nextToken();
|
||||
attributes.setPctincrease(this.parseIntValue());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.PCTFREE) {
|
||||
lexer.nextToken();
|
||||
attributes.setPctfree(this.parseIntValue());
|
||||
continue;
|
||||
} else if (lexer.token() == Token.STORAGE || identifierEquals("STORAGE")) {
|
||||
OracleStorageClause storage = this.parseStorage();
|
||||
attributes.setStorage(storage);
|
||||
continue;
|
||||
} else if (identifierEquals("PCTUSED")) {
|
||||
lexer.nextToken();
|
||||
attributes.setPctused(this.parseIntValue());
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,4 +448,8 @@ public interface OracleASTVisitor extends SQLASTVisitor {
|
||||
boolean visit(OracleSupplementalLogGrp x);
|
||||
|
||||
void endVisit(OracleSupplementalLogGrp x);
|
||||
|
||||
boolean visit(OracleCreateTableStatement.Organization x);
|
||||
|
||||
void endVisit(OracleCreateTableStatement.Organization x);
|
||||
}
|
||||
|
||||
+8
@@ -1086,4 +1086,12 @@ public class OracleASTVisitorAdapter extends SQLASTVisitorAdapter implements Ora
|
||||
public void endVisit(OracleSupplementalLogGrp x) {
|
||||
|
||||
}
|
||||
|
||||
public boolean visit(OracleCreateTableStatement.Organization x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void endVisit(OracleCreateTableStatement.Organization x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+35
-46
@@ -28,6 +28,7 @@ import com.alibaba.druid.sql.ast.statement.SQLJoinTableSource.JoinType;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeIntervalDay;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeIntervalYear;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleDataTypeTimestamp;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributes;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.CycleClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfFlashbackQueryClause;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.clause.FlashbackQueryClause.AsOfSnapshotClause;
|
||||
@@ -2092,28 +2093,14 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
public boolean visit(OracleCreateTableStatement x) {
|
||||
this.visit((SQLCreateTableStatement) x);
|
||||
|
||||
if (x.isOrganizationIndex()) {
|
||||
if (x.getOrganization() != null) {
|
||||
println();
|
||||
print0(ucase ? "ORGANIZATION INDEX" : "organization index");
|
||||
incrementIndent();
|
||||
x.getOrganization().accept(this);
|
||||
decrementIndent();
|
||||
}
|
||||
|
||||
if (x.getPtcfree() != null) {
|
||||
println();
|
||||
print0(ucase ? "PCTFREE " : "pctfree ");
|
||||
x.getPtcfree().accept(this);
|
||||
}
|
||||
|
||||
if (x.getInitrans() != null) {
|
||||
println();
|
||||
print0(ucase ? "INITRANS " : "initrans ");
|
||||
x.getInitrans().accept(this);
|
||||
}
|
||||
|
||||
if (x.getMaxtrans() != null) {
|
||||
println();
|
||||
print0(ucase ? "MAXTRANS " : "maxtrans ");
|
||||
x.getMaxtrans().accept(this);
|
||||
}
|
||||
printOracleSegmentAttributes(x);
|
||||
|
||||
if (x.isInMemoryMetadata()) {
|
||||
println();
|
||||
@@ -2141,33 +2128,6 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
print0(ucase ? "NOCACHE" : "nocache");
|
||||
}
|
||||
|
||||
if (x.getCompress() == Boolean.FALSE) {
|
||||
println();
|
||||
print0(ucase ? "NOCOMPRESS" : "nocompress");
|
||||
} else if (x.getCompress() == Boolean.TRUE) {
|
||||
println();
|
||||
print0(ucase ? "COMPRESS" : "compress");
|
||||
}
|
||||
|
||||
if (x.getLogging() == Boolean.TRUE) {
|
||||
println();
|
||||
print0(ucase ? "LOGGING" : "logging");
|
||||
} else if (x.getLogging() == Boolean.FALSE) {
|
||||
println();
|
||||
print0(ucase ? "NOLOGGING" : "nologging");
|
||||
}
|
||||
|
||||
if (x.getTablespace() != null) {
|
||||
println();
|
||||
print0(ucase ? "TABLESPACE " : "tablespace ");
|
||||
x.getTablespace().accept(this);
|
||||
}
|
||||
|
||||
if (x.getStorage() != null) {
|
||||
println();
|
||||
x.getStorage().accept(this);
|
||||
}
|
||||
|
||||
if (x.getLobStorage() != null) {
|
||||
println();
|
||||
x.getLobStorage().accept(this);
|
||||
@@ -2188,6 +2148,15 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
x.getPartitioning().accept(this);
|
||||
}
|
||||
|
||||
if (x.getCluster() != null) {
|
||||
println();
|
||||
print0(ucase ? "CLUSTER " : "cluster ");
|
||||
x.getCluster().accept(this);
|
||||
print0(" (");
|
||||
printAndAccept(x.getClusterColumns(), ",");
|
||||
print0(")");
|
||||
}
|
||||
|
||||
if (x.getSelect() != null) {
|
||||
println();
|
||||
print0(ucase ? "AS" : "as");
|
||||
@@ -3127,4 +3096,24 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
public void endVisit(OracleSupplementalLogGrp x) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean visit(OracleCreateTableStatement.Organization x) {
|
||||
print0(ucase ? "ORGANIZATION " : "organization ");
|
||||
print0(ucase ? x.getType() : x.getType().toLowerCase());
|
||||
|
||||
printOracleSegmentAttributes(x);
|
||||
|
||||
if (x.getPctthreshold() != null) {
|
||||
println();
|
||||
print0(ucase ? "PCTTHRESHOLD " : "pctthreshold ");
|
||||
print(x.getPctfree());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void endVisit(OracleCreateTableStatement.Organization x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -1419,4 +1419,12 @@ public class OracleSchemaStatVisitor extends SchemaStatVisitor implements Oracle
|
||||
public void endVisit(OracleSupplementalLogGrp x) {
|
||||
|
||||
}
|
||||
|
||||
public boolean visit(OracleCreateTableStatement.Organization x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void endVisit(OracleCreateTableStatement.Organization x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user