mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
sql paser refactor SQLColumnDefinition
This commit is contained in:
@@ -15,29 +15,52 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.ast.statement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLDataType;
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLName;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SQLColumnDefinition extends SQLObjectImpl implements SQLTableElement {
|
||||
|
||||
protected SQLName name;
|
||||
protected SQLDataType dataType;
|
||||
protected SQLExpr defaultExpr;
|
||||
protected final List<SQLColumnConstraint> constraints = new ArrayList<SQLColumnConstraint>(0);
|
||||
protected SQLExpr comment;
|
||||
protected final List<SQLColumnConstraint> constraints = new ArrayList<SQLColumnConstraint>(0);
|
||||
protected SQLExpr comment;
|
||||
|
||||
protected Boolean enable;
|
||||
|
||||
// for mysql
|
||||
protected boolean autoIncrement = false;
|
||||
protected SQLExpr onUpdate;
|
||||
protected SQLExpr storage;
|
||||
protected SQLExpr charsetExpr;
|
||||
protected SQLExpr asExpr;
|
||||
protected boolean sorted = false;
|
||||
protected boolean virtual = false;
|
||||
|
||||
protected Identity identity;
|
||||
|
||||
public SQLColumnDefinition(){
|
||||
|
||||
}
|
||||
|
||||
public Identity getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
// for sqlserver
|
||||
public void setIdentity(Identity identity) {
|
||||
if (identity != null) {
|
||||
identity.setParent(this);
|
||||
}
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public Boolean getEnable() {
|
||||
return enable;
|
||||
}
|
||||
@@ -107,4 +130,108 @@ public class SQLColumnDefinition extends SQLObjectImpl implements SQLTableElemen
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public boolean isVirtual() {
|
||||
return virtual;
|
||||
}
|
||||
|
||||
public void setVirtual(boolean virtual) {
|
||||
this.virtual = virtual;
|
||||
}
|
||||
|
||||
public boolean isSorted() {
|
||||
return sorted;
|
||||
}
|
||||
|
||||
public void setSorted(boolean sorted) {
|
||||
this.sorted = sorted;
|
||||
}
|
||||
|
||||
public SQLExpr getCharsetExpr() {
|
||||
return charsetExpr;
|
||||
}
|
||||
|
||||
public void setCharsetExpr(SQLExpr charsetExpr) {
|
||||
if (charsetExpr != null) {
|
||||
charsetExpr.setParent(this);
|
||||
}
|
||||
this.charsetExpr = charsetExpr;
|
||||
}
|
||||
|
||||
public SQLExpr getAsExpr() {
|
||||
return asExpr;
|
||||
}
|
||||
|
||||
public void setAsExpr(SQLExpr asExpr) {
|
||||
if (charsetExpr != null) {
|
||||
charsetExpr.setParent(this);
|
||||
}
|
||||
this.asExpr = asExpr;
|
||||
}
|
||||
|
||||
public boolean isAutoIncrement() {
|
||||
return autoIncrement;
|
||||
}
|
||||
|
||||
public void setAutoIncrement(boolean autoIncrement) {
|
||||
this.autoIncrement = autoIncrement;
|
||||
}
|
||||
|
||||
public SQLExpr getOnUpdate() {
|
||||
return onUpdate;
|
||||
}
|
||||
|
||||
public void setOnUpdate(SQLExpr onUpdate) {
|
||||
this.onUpdate = onUpdate;
|
||||
}
|
||||
|
||||
public SQLExpr getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void setStorage(SQLExpr storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public static class Identity extends SQLObjectImpl {
|
||||
|
||||
private Integer seed;
|
||||
private Integer increment;
|
||||
|
||||
private boolean notForReplication;
|
||||
|
||||
public Identity(){
|
||||
|
||||
}
|
||||
|
||||
public Integer getSeed() {
|
||||
return seed;
|
||||
}
|
||||
|
||||
public void setSeed(Integer seed) {
|
||||
this.seed = seed;
|
||||
}
|
||||
|
||||
public Integer getIncrement() {
|
||||
return increment;
|
||||
}
|
||||
|
||||
public void setIncrement(Integer increment) {
|
||||
this.increment = increment;
|
||||
}
|
||||
|
||||
public boolean isNotForReplication() {
|
||||
return notForReplication;
|
||||
}
|
||||
|
||||
public void setNotForReplication(boolean notForReplication) {
|
||||
this.notForReplication = notForReplication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept0(SQLASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user