mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -26,7 +26,6 @@ public class SQLDeleteStatement extends SQLStatementImpl {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SQLExprTableSource tableSource;
|
||||
protected SQLExpr where;
|
||||
private String alias;
|
||||
|
||||
public SQLDeleteStatement(){
|
||||
|
||||
@@ -65,11 +64,11 @@ public class SQLDeleteStatement extends SQLStatementImpl {
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
return this.tableSource.getAlias();
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
this.tableSource.setAlias(alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ public abstract class SQLInsertInto extends SQLObjectImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected SQLExprTableSource tableSource;
|
||||
protected String alias;
|
||||
|
||||
protected final List<SQLExpr> columns = new ArrayList<SQLExpr>();
|
||||
protected ValuesClause values;
|
||||
@@ -23,11 +22,11 @@ public abstract class SQLInsertInto extends SQLObjectImpl {
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
return tableSource.getAlias();
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
this.tableSource.setAlias(alias);
|
||||
}
|
||||
|
||||
public SQLExprTableSource getTableSource() {
|
||||
@@ -45,7 +44,7 @@ public abstract class SQLInsertInto extends SQLObjectImpl {
|
||||
public void setTableName(SQLName tableName) {
|
||||
this.setTableSource(new SQLExprTableSource(tableName));
|
||||
}
|
||||
|
||||
|
||||
public void setTableSource(SQLName tableName) {
|
||||
this.setTableSource(new SQLExprTableSource(tableName));
|
||||
}
|
||||
|
||||
+20
-15
@@ -22,6 +22,7 @@ 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.ast.SQLOrderBy;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
@@ -29,36 +30,40 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
@SuppressWarnings("serial")
|
||||
public class MySqlSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
|
||||
private boolean hignPriority;
|
||||
private boolean straightJoin;
|
||||
private boolean hignPriority;
|
||||
private boolean straightJoin;
|
||||
|
||||
private boolean smallResult;
|
||||
private boolean bigResult;
|
||||
private boolean bufferResult;
|
||||
private Boolean cache;
|
||||
private boolean calcFoundRows;
|
||||
private boolean smallResult;
|
||||
private boolean bigResult;
|
||||
private boolean bufferResult;
|
||||
private Boolean cache;
|
||||
private boolean calcFoundRows;
|
||||
|
||||
private SQLOrderBy orderBy;
|
||||
private SQLOrderBy orderBy;
|
||||
|
||||
private Limit limit;
|
||||
private Limit limit;
|
||||
|
||||
private SQLName procedureName;
|
||||
private List<SQLExpr> procedureArgumentList = new ArrayList<SQLExpr>();
|
||||
private SQLName procedureName;
|
||||
private List<SQLExpr> procedureArgumentList = new ArrayList<SQLExpr>();
|
||||
|
||||
private SQLExpr into;
|
||||
private SQLExprTableSource into;
|
||||
|
||||
private boolean forUpdate = false;
|
||||
private boolean lockInShareMode = false;
|
||||
private boolean forUpdate = false;
|
||||
private boolean lockInShareMode = false;
|
||||
|
||||
public MySqlSelectQueryBlock(){
|
||||
|
||||
}
|
||||
|
||||
public SQLExpr getInto() {
|
||||
public SQLExprTableSource getInto() {
|
||||
return into;
|
||||
}
|
||||
|
||||
public void setInto(SQLExpr into) {
|
||||
this.into = new SQLExprTableSource(into);
|
||||
}
|
||||
|
||||
public void setInto(SQLExprTableSource into) {
|
||||
this.into = into;
|
||||
}
|
||||
|
||||
|
||||
+8
-4
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLSetQuantifier;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectItem;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.OracleHint;
|
||||
@@ -35,20 +36,23 @@ public class OracleSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
|
||||
private OracleSelectHierachicalQueryClause hierachicalQueryClause;
|
||||
private ModelClause modelClause;
|
||||
private SQLExpr into;
|
||||
private SQLExprTableSource into;
|
||||
|
||||
public OracleSelectQueryBlock(){
|
||||
|
||||
}
|
||||
|
||||
public SQLExpr getInto() {
|
||||
|
||||
public SQLExprTableSource getInto() {
|
||||
return into;
|
||||
}
|
||||
|
||||
public void setInto(SQLExpr into) {
|
||||
this.into = into;
|
||||
this.into = new SQLExprTableSource(into);
|
||||
}
|
||||
|
||||
public void setInto(SQLExprTableSource into) {
|
||||
this.into = into;
|
||||
}
|
||||
|
||||
public ModelClause getModelClause() {
|
||||
return modelClause;
|
||||
|
||||
+208
-199
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLOrderBy;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.PGSQLObjectImpl;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.PGWithClause;
|
||||
@@ -13,259 +14,267 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class PGSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PGWithClause with;
|
||||
private List<SQLExpr> distinctOn = new ArrayList<SQLExpr>(2);
|
||||
private SQLExpr limit;
|
||||
private SQLExpr offset;
|
||||
private WindowClause window;
|
||||
private PGWithClause with;
|
||||
private List<SQLExpr> distinctOn = new ArrayList<SQLExpr>(2);
|
||||
private SQLExpr limit;
|
||||
private SQLExpr offset;
|
||||
private WindowClause window;
|
||||
|
||||
private SQLOrderBy orderBy;
|
||||
private FetchClause fetch;
|
||||
private ForClause forClause;
|
||||
private IntoClause into;
|
||||
private SQLOrderBy orderBy;
|
||||
private FetchClause fetch;
|
||||
private ForClause forClause;
|
||||
private IntoClause into;
|
||||
|
||||
public IntoClause getInto() {
|
||||
return into;
|
||||
}
|
||||
public IntoClause getInto() {
|
||||
return into;
|
||||
}
|
||||
|
||||
public void setInto(IntoClause into) {
|
||||
this.into = into;
|
||||
}
|
||||
public void setInto(IntoClause into) {
|
||||
this.into = into;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((PGASTVisitor) visitor);
|
||||
}
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
accept0((PGASTVisitor) visitor);
|
||||
}
|
||||
|
||||
protected void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, this.with);
|
||||
acceptChild(visitor, this.distinctOn);
|
||||
acceptChild(visitor, this.selectList);
|
||||
acceptChild(visitor, this.into);
|
||||
acceptChild(visitor, this.from);
|
||||
acceptChild(visitor, this.where);
|
||||
acceptChild(visitor, this.groupBy);
|
||||
acceptChild(visitor, this.window);
|
||||
acceptChild(visitor, this.orderBy);
|
||||
acceptChild(visitor, this.limit);
|
||||
acceptChild(visitor, this.offset);
|
||||
acceptChild(visitor, this.fetch);
|
||||
acceptChild(visitor, this.forClause);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
protected void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, this.with);
|
||||
acceptChild(visitor, this.distinctOn);
|
||||
acceptChild(visitor, this.selectList);
|
||||
acceptChild(visitor, this.into);
|
||||
acceptChild(visitor, this.from);
|
||||
acceptChild(visitor, this.where);
|
||||
acceptChild(visitor, this.groupBy);
|
||||
acceptChild(visitor, this.window);
|
||||
acceptChild(visitor, this.orderBy);
|
||||
acceptChild(visitor, this.limit);
|
||||
acceptChild(visitor, this.offset);
|
||||
acceptChild(visitor, this.fetch);
|
||||
acceptChild(visitor, this.forClause);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public FetchClause getFetch() {
|
||||
return fetch;
|
||||
}
|
||||
public FetchClause getFetch() {
|
||||
return fetch;
|
||||
}
|
||||
|
||||
public void setFetch(FetchClause fetch) {
|
||||
this.fetch = fetch;
|
||||
}
|
||||
public void setFetch(FetchClause fetch) {
|
||||
this.fetch = fetch;
|
||||
}
|
||||
|
||||
public ForClause getForClause() {
|
||||
return forClause;
|
||||
}
|
||||
public ForClause getForClause() {
|
||||
return forClause;
|
||||
}
|
||||
|
||||
public void setForClause(ForClause forClause) {
|
||||
this.forClause = forClause;
|
||||
}
|
||||
public void setForClause(ForClause forClause) {
|
||||
this.forClause = forClause;
|
||||
}
|
||||
|
||||
public WindowClause getWindow() {
|
||||
return window;
|
||||
}
|
||||
public WindowClause getWindow() {
|
||||
return window;
|
||||
}
|
||||
|
||||
public void setWindow(WindowClause window) {
|
||||
this.window = window;
|
||||
}
|
||||
public void setWindow(WindowClause window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
public PGWithClause getWith() {
|
||||
return with;
|
||||
}
|
||||
public PGWithClause getWith() {
|
||||
return with;
|
||||
}
|
||||
|
||||
public void setWith(PGWithClause with) {
|
||||
this.with = with;
|
||||
}
|
||||
public void setWith(PGWithClause with) {
|
||||
this.with = with;
|
||||
}
|
||||
|
||||
public SQLExpr getLimit() {
|
||||
return limit;
|
||||
}
|
||||
public SQLExpr getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(SQLExpr limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
public void setLimit(SQLExpr limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public SQLOrderBy getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
public SQLOrderBy getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
public void setOrderBy(SQLOrderBy orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
public void setOrderBy(SQLOrderBy orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public SQLExpr getOffset() {
|
||||
return offset;
|
||||
}
|
||||
public SQLExpr getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(SQLExpr offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
public void setOffset(SQLExpr offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public List<SQLExpr> getDistinctOn() {
|
||||
return distinctOn;
|
||||
}
|
||||
public List<SQLExpr> getDistinctOn() {
|
||||
return distinctOn;
|
||||
}
|
||||
|
||||
public void setDistinctOn(List<SQLExpr> distinctOn) {
|
||||
this.distinctOn = distinctOn;
|
||||
}
|
||||
public void setDistinctOn(List<SQLExpr> distinctOn) {
|
||||
this.distinctOn = distinctOn;
|
||||
}
|
||||
|
||||
public static class WindowClause extends PGSQLObjectImpl {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLExpr name;
|
||||
private List<SQLExpr> definition = new ArrayList<SQLExpr>(2);
|
||||
public static class WindowClause extends PGSQLObjectImpl {
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SQLExpr name;
|
||||
private List<SQLExpr> definition = new ArrayList<SQLExpr>(2);
|
||||
|
||||
public void setName(SQLExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<SQLExpr> getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
public void setName(SQLExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDefinition(List<SQLExpr> definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
public List<SQLExpr> getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, name);
|
||||
acceptChild(visitor, definition);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
public void setDefinition(List<SQLExpr> definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public static class FetchClause extends PGSQLObjectImpl {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, name);
|
||||
acceptChild(visitor, definition);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Option {
|
||||
FIRST, NEXT
|
||||
}
|
||||
public static class FetchClause extends PGSQLObjectImpl {
|
||||
|
||||
private Option option;
|
||||
private SQLExpr count;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
public static enum Option {
|
||||
FIRST, NEXT
|
||||
}
|
||||
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
private Option option;
|
||||
private SQLExpr count;
|
||||
|
||||
public SQLExpr getCount() {
|
||||
return count;
|
||||
}
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
public void setCount(SQLExpr count) {
|
||||
this.count = count;
|
||||
}
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, count);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
public SQLExpr getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
public void setCount(SQLExpr count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public static class ForClause extends PGSQLObjectImpl {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, count);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public static enum Option {
|
||||
UPDATE, SHARE
|
||||
}
|
||||
}
|
||||
|
||||
private List<SQLExpr> of = new ArrayList<SQLExpr>(2);
|
||||
private boolean noWait;
|
||||
private Option option;
|
||||
public static class ForClause extends PGSQLObjectImpl {
|
||||
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
public static enum Option {
|
||||
UPDATE, SHARE
|
||||
}
|
||||
|
||||
public List<SQLExpr> getOf() {
|
||||
return of;
|
||||
}
|
||||
private List<SQLExpr> of = new ArrayList<SQLExpr>(2);
|
||||
private boolean noWait;
|
||||
private Option option;
|
||||
|
||||
public void setOf(List<SQLExpr> of) {
|
||||
this.of = of;
|
||||
}
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
public boolean isNoWait() {
|
||||
return noWait;
|
||||
}
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public void setNoWait(boolean noWait) {
|
||||
this.noWait = noWait;
|
||||
}
|
||||
public List<SQLExpr> getOf() {
|
||||
return of;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, of);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
public void setOf(List<SQLExpr> of) {
|
||||
this.of = of;
|
||||
}
|
||||
|
||||
public static class IntoClause extends PGSQLObjectImpl {
|
||||
public static enum Option {
|
||||
TEMPORARY, TEMP, UNLOGGED
|
||||
}
|
||||
public boolean isNoWait() {
|
||||
return noWait;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public void setNoWait(boolean noWait) {
|
||||
this.noWait = noWait;
|
||||
}
|
||||
|
||||
private SQLExpr table;
|
||||
private Option option;
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, of);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
public static class IntoClause extends PGSQLObjectImpl {
|
||||
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
public static enum Option {
|
||||
TEMPORARY, TEMP, UNLOGGED
|
||||
}
|
||||
|
||||
public SQLExpr getTable() {
|
||||
return table;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void setTable(SQLExpr table) {
|
||||
this.table = table;
|
||||
}
|
||||
private SQLExprTableSource table;
|
||||
private Option option;
|
||||
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, table);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
}
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public SQLExprTableSource getTable() {
|
||||
return table;
|
||||
}
|
||||
|
||||
public void setTable(SQLExpr table) {
|
||||
this.table = new SQLExprTableSource(table);
|
||||
}
|
||||
|
||||
public void setTable(SQLExprTableSource table) {
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, table);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user