mysql parser refactor.

This commit is contained in:
wenshao
2017-08-29 14:33:44 +08:00
parent 833a9b5a65
commit 4a4fffbbb2
197 changed files with 3040 additions and 1037 deletions
@@ -25,7 +25,7 @@ public class SQLDeclareItem extends SQLObjectImpl implements SQLObjectWithDataTy
protected Type type;
protected SQLExpr name;
protected SQLName name;
protected SQLDataType dataType;
@@ -33,16 +33,18 @@ public class SQLDeclareItem extends SQLObjectImpl implements SQLObjectWithDataTy
protected List<SQLTableElement> tableElementList = new ArrayList<SQLTableElement>();
protected transient SQLObject resolvedObject;
public SQLDeclareItem() {
}
public SQLDeclareItem(SQLExpr name, SQLDataType dataType) {
public SQLDeclareItem(SQLName name, SQLDataType dataType) {
this.setName(name);
this.setDataType(dataType);
}
public SQLDeclareItem(SQLExpr name, SQLDataType dataType, SQLExpr value) {
public SQLDeclareItem(SQLName name, SQLDataType dataType, SQLExpr value) {
this.setName(name);
this.setDataType(dataType);
this.setValue(value);
@@ -59,11 +61,11 @@ public class SQLDeclareItem extends SQLObjectImpl implements SQLObjectWithDataTy
visitor.endVisit(this);
}
public SQLExpr getName() {
public SQLName getName() {
return name;
}
public void setName(SQLExpr name) {
public void setName(SQLName name) {
if (name != null) {
name.setParent(this);
}
@@ -112,4 +114,11 @@ public class SQLDeclareItem extends SQLObjectImpl implements SQLObjectWithDataTy
this.type = type;
}
public SQLObject getResolvedObject() {
return resolvedObject;
}
public void setResolvedObject(SQLObject resolvedObject) {
this.resolvedObject = resolvedObject;
}
}
@@ -21,4 +21,6 @@ public interface SQLName extends SQLExpr {
SQLName clone();
long name_hash_lower();
long hashCode64();
}
@@ -22,7 +22,7 @@ import java.util.List;
public class SQLParameter extends SQLObjectImpl implements SQLObjectWithDataType {
private SQLExpr name;
private SQLName name;
private SQLDataType dataType;
private SQLExpr defaultValue;
private ParameterType paramType;
@@ -43,11 +43,11 @@ public class SQLParameter extends SQLObjectImpl implements SQLObjectWithDataType
this.defaultValue = deaultValue;
}
public SQLExpr getName() {
public SQLName getName() {
return name;
}
public void setName(SQLExpr name) {
public void setName(SQLName name) {
if (name != null) {
name.setParent(this);
}
@@ -16,9 +16,7 @@
package com.alibaba.druid.sql.ast.expr;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLDataType;
import com.alibaba.druid.sql.ast.SQLExprImpl;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.*;
import com.alibaba.druid.sql.ast.statement.*;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import com.alibaba.druid.util.FNVUtils;
@@ -32,7 +30,10 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
private transient Boolean parameter;
private transient SQLColumnDefinition resolvedColumn;
private transient SQLTableSource resolvedTableSource;
private transient SQLParameter resolvedParameter;
private transient SQLDeclareItem resolvedDeclareItem;
private transient SQLObject resolvedOwnerObject;
public SQLIdentifierExpr(){
@@ -69,6 +70,11 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
}
public long name_hash_lower() {
return hashCode64();
}
@Override
public long hashCode64() {
if (hash_lower == 0
&& name != null) {
final int len = name.length();
@@ -183,7 +189,7 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
public SQLIdentifierExpr clone() {
SQLIdentifierExpr x = new SQLIdentifierExpr(this.name);
x.resolvedColumn = resolvedColumn;
x.resolvedTableSource = resolvedTableSource;
x.resolvedOwnerObject = resolvedOwnerObject;
return x;
}
@@ -200,11 +206,39 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
}
public SQLTableSource getResolvedTableSource() {
return resolvedTableSource;
if (resolvedOwnerObject instanceof SQLTableSource) {
return (SQLTableSource) resolvedOwnerObject;
}
return null;
}
public void setResolvedTableSource(SQLTableSource resolvedTableSource) {
this.resolvedTableSource = resolvedTableSource;
this.resolvedOwnerObject = resolvedTableSource;
}
public SQLObject getResolvedOwnerObject() {
return resolvedOwnerObject;
}
public void setResolvedOwnerObject(SQLObject resolvedOwnerObject) {
this.resolvedOwnerObject = resolvedOwnerObject;
}
public SQLParameter getResolvedParameter() {
return resolvedParameter;
}
public void setResolvedParameter(SQLParameter resolvedParameter) {
this.resolvedParameter = resolvedParameter;
}
public SQLDeclareItem getResolvedDeclareItem() {
return resolvedDeclareItem;
}
public void setResolvedDeclareItem(SQLDeclareItem resolvedDeclareItem) {
this.resolvedDeclareItem = resolvedDeclareItem;
}
public SQLDataType computeDataType() {
@@ -212,9 +246,9 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
return resolvedColumn.getDataType();
}
if (resolvedTableSource != null
&& resolvedTableSource instanceof SQLSubqueryTableSource) {
SQLSelect select = ((SQLSubqueryTableSource) resolvedTableSource).getSelect();
if (resolvedOwnerObject != null
&& resolvedOwnerObject instanceof SQLSubqueryTableSource) {
SQLSelect select = ((SQLSubqueryTableSource) resolvedOwnerObject).getSelect();
SQLSelectQueryBlock queryBlock = select.getFirstQueryBlock();
if (queryBlock == null) {
return null;
@@ -16,10 +16,7 @@
package com.alibaba.druid.sql.ast.expr;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLDataType;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLExprImpl;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.*;
import com.alibaba.druid.sql.ast.statement.*;
import com.alibaba.druid.sql.parser.ParserException;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
@@ -33,7 +30,10 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
protected long name_hash_lower;
private transient SQLColumnDefinition resolvedColumn;
private transient SQLTableSource resolvedTableSource;
private transient SQLObject resolvedTableSource;
private transient long hash_ower;
public SQLPropertyExpr(String owner, String name){
this(new SQLIdentifierExpr(owner), name);
@@ -75,6 +75,7 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
owner.setParent(this);
}
this.owner = owner;
this.hash_ower = 0;
}
public void setOwner(String owner) {
@@ -87,6 +88,8 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
public void setName(String name) {
this.name = name;
this.hash_ower = 0;
this.name_hash_lower = 0;
}
public void output(StringBuffer buf) {
@@ -105,11 +108,15 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((owner == null) ? 0 : owner.hashCode());
return result;
long hash = hashCode64();
return (int)(hash ^ (hash >>> 32));
}
public long hashCode64() {
if (hash_ower == 0) {
hash_ower = FNVUtils.fnv_64_lower(this);
}
return hash_ower;
}
@Override
@@ -175,6 +182,7 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
char c1 = name.charAt(len - 1);
if ((c0 == '`' && c1 == '`')
|| (c0 == '"' && c1 == '"')
|| (c0 == '\'' && c1 == '\'')
|| (c0 == '[' && c1 == ']')) {
quote = true;
}
@@ -211,13 +219,33 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
}
public SQLTableSource getResolvedTableSource() {
return resolvedTableSource;
if (resolvedTableSource instanceof SQLTableSource) {
return (SQLTableSource) resolvedTableSource;
}
return null;
}
public void setResolvedTableSource(SQLTableSource resolvedTableSource) {
this.resolvedTableSource = resolvedTableSource;
}
public void setResolvedProcedure(SQLCreateProcedureStatement stmt) {
this.resolvedTableSource = stmt;
}
public void setResolvedOwnerObject(SQLObject resolvedOwnerObject) {
this.resolvedTableSource = resolvedOwnerObject;
}
public SQLCreateProcedureStatement getResolvedProcudure() {
if (this.resolvedTableSource instanceof SQLCreateProcedureStatement) {
return (SQLCreateProcedureStatement) this.resolvedTableSource;
}
return null;
}
public SQLDataType computeDataType() {
if (resolvedColumn != null) {
return resolvedColumn.getDataType();
@@ -34,6 +34,10 @@ public class SQLBlockStatement extends SQLStatementImpl {
public SQLStatement exception;
public SQLBlockStatement() {
}
public List<SQLStatement> getStatementList() {
return statementList;
}
@@ -110,4 +114,14 @@ public class SQLBlockStatement extends SQLStatementImpl {
return x;
}
public SQLParameter findParameter(long hash) {
for (SQLParameter param : this.parameters) {
if (param.getName().name_hash_lower() == hash) {
return param;
}
}
return null;
}
}
@@ -64,6 +64,10 @@ public abstract class SQLConstraintImpl extends SQLObjectImpl implements SQLCons
this.name = name;
}
public void setName(String name) {
this.setName(new SQLIdentifierExpr(name));
}
public Boolean getEnable() {
return enable;
}
@@ -107,7 +111,7 @@ public abstract class SQLConstraintImpl extends SQLObjectImpl implements SQLCons
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) this.name;
String columnName = identExpr.getName();
columnName = SQLUtils.normalize(columnName, dbType);
identExpr.setName(columnName);
this.setName(columnName);
}
}
}
@@ -166,4 +166,14 @@ public class SQLCreateProcedureStatement extends SQLStatementImpl implements SQL
public void setModifiesSqlData(boolean modifiesSqlData) {
this.modifiesSqlData = modifiesSqlData;
}
public SQLParameter findParameter(long hash) {
for (SQLParameter param : this.parameters) {
if (param.getName().name_hash_lower() == hash) {
return param;
}
}
return null;
}
}
@@ -31,6 +31,7 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import com.alibaba.druid.util.FNVUtils;
import com.alibaba.druid.util.ListDG;
import com.alibaba.druid.util.lang.Consumer;
import oracle.sql.SQLUtil;
public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLStatement, SQLCreateStatement {
@@ -47,6 +48,8 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
protected SQLExpr comment;
protected SQLExprTableSource like;
public SQLCreateTableStatement(){
}
@@ -159,6 +162,21 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
this.select = select;
}
public SQLExprTableSource getLike() {
return like;
}
public void setLike(SQLName like) {
this.setLike(new SQLExprTableSource(like));
}
public void setLike(SQLExprTableSource like) {
if (like != null) {
like.setParent(this);
}
this.like = like;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
@@ -569,13 +587,6 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
identExpr.setName(tableName);
}
if (name instanceof SQLIdentifierExpr) {
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) name;
String tableName = identExpr.getName();
tableName = SQLUtils.normalize(tableName);
identExpr.setName(tableName);
}
for (SQLTableElement element : this.tableElementList) {
if (element instanceof SQLColumnDefinition) {
SQLColumnDefinition column = (SQLColumnDefinition) element;
@@ -901,8 +912,12 @@ public class SQLCreateTableStatement extends SQLStatementImpl implements SQLDDLS
}
public SQLCreateTableStatement clone() {
SQLCreateTableStatement x = new SQLCreateTableStatement();
SQLCreateTableStatement x = new SQLCreateTableStatement(dbType);
cloneTo(x);
return x;
}
public String toString() {
return SQLUtils.toSQLString(this, dbType);
}
}
@@ -32,11 +32,11 @@ public class SQLDeclareStatement extends SQLStatementImpl {
}
public SQLDeclareStatement(SQLExpr name, SQLDataType dataType) {
public SQLDeclareStatement(SQLName name, SQLDataType dataType) {
this.addItem(new SQLDeclareItem(name, dataType));
}
public SQLDeclareStatement(SQLExpr name, SQLDataType dataType, SQLExpr value) {
public SQLDeclareStatement(SQLName name, SQLDataType dataType, SQLExpr value) {
this.addItem(new SQLDeclareItem(name, dataType, value));
}
@@ -20,10 +20,12 @@ import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLDeleteStatement extends SQLStatementImpl implements SQLReplaceable {
protected SQLWithSubqueryClause with;
protected SQLTableSource tableSource;
protected SQLExpr where;
protected SQLTableSource from;
protected SQLTableSource using;
protected boolean only = false;
@@ -44,6 +46,10 @@ public class SQLDeleteStatement extends SQLStatementImpl implements SQLReplaceab
}
}
if (with != null) {
x.setWith(with.clone());
}
if (tableSource != null) {
x.setTableSource(tableSource.clone());
}
@@ -53,6 +59,9 @@ public class SQLDeleteStatement extends SQLStatementImpl implements SQLReplaceab
if (from != null) {
x.setFrom(from.clone());
}
if (using != null) {
x.setUsing(using.clone());
}
x.only = only;
}
@@ -131,6 +140,7 @@ public class SQLDeleteStatement extends SQLStatementImpl implements SQLReplaceab
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, with);
acceptChild(visitor, tableSource);
acceptChild(visitor, where);
}
@@ -165,4 +175,23 @@ public class SQLDeleteStatement extends SQLStatementImpl implements SQLReplaceab
public void setOnly(boolean only) {
this.only = only;
}
public SQLTableSource getUsing() {
return using;
}
public void setUsing(SQLTableSource using) {
this.using = using;
}
public SQLWithSubqueryClause getWith() {
return with;
}
public void setWith(SQLWithSubqueryClause with) {
if (with != null) {
with.setParent(this);
}
this.with = with;
}
}
@@ -33,6 +33,7 @@ public class SQLExprTableSource extends SQLTableSourceImpl {
protected SQLExpr expr;
private List<SQLName> partitions;
private SchemaObject schemaObject;
public SQLExprTableSource(){
@@ -257,15 +258,20 @@ public class SQLExprTableSource extends SQLTableSourceImpl {
}
public SQLTableSource findTableSourceWithColumn(long columnName_hash) {
if (schemaObject == null) {
return null;
if (schemaObject != null) {
SQLStatement stmt = schemaObject.getStatement();
if (stmt instanceof SQLCreateTableStatement) {
SQLCreateTableStatement createTableStmt = (SQLCreateTableStatement) stmt;
if (createTableStmt.findColumn(columnName_hash) != null) {
return this;
}
}
}
SQLStatement stmt = schemaObject.getStatement();
if (stmt instanceof SQLCreateTableStatement) {
SQLCreateTableStatement createTableStmt = (SQLCreateTableStatement) stmt;
if (createTableStmt.findColumn(columnName_hash) != null) {
return this;
if (expr instanceof SQLIdentifierExpr) {
SQLTableSource tableSource = ((SQLIdentifierExpr) expr).getResolvedTableSource();
if (tableSource != null) {
return tableSource.findTableSourceWithColumn(columnName_hash);
}
}
@@ -288,6 +294,13 @@ public class SQLExprTableSource extends SQLTableSourceImpl {
}
}
if (expr instanceof SQLPropertyExpr) {
long hash = ((SQLPropertyExpr) expr).hashCode64();
if (hash == alias_hash) {
return this;
}
}
return null;
}
}
@@ -18,13 +18,17 @@ package com.alibaba.druid.sql.ast.statement;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLObjectImpl;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import oracle.sql.SQLUtil;
public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
private String dbType;
protected SQLWithSubqueryClause with;
protected String dbType;
protected boolean upsert = false; // for phoenix
@@ -39,6 +43,10 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
x.dbType = dbType;
x.upsert = upsert;
x.afterSemi = afterSemi;
if (with != null) {
x.setWith(with.clone());
}
}
public SQLInsertStatement clone() {
@@ -148,4 +156,20 @@ public class SQLInsertStatement extends SQLInsertInto implements SQLStatement {
public void setAfterSemi(boolean afterSemi) {
this.afterSemi = afterSemi;
}
public SQLWithSubqueryClause getWith() {
return with;
}
public void setWith(SQLWithSubqueryClause with) {
if (with != null) {
with.setParent(this);
}
this.with = with;
}
public String toString() {
return SQLUtils.toSQLString(this, dbType);
}
}
@@ -50,11 +50,7 @@ public class SQLMergeStatement extends SQLStatementImpl {
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
return into.getAlias();
}
public SQLTableSource getInto() {
@@ -171,8 +167,8 @@ public class SQLMergeStatement extends SQLStatementImpl {
public void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, columns);
acceptChild(visitor, columns);
acceptChild(visitor, columns);
acceptChild(visitor, values);
acceptChild(visitor, where);
}
visitor.endVisit(this);
}
@@ -186,10 +186,6 @@ public class SQLSelectItem extends SQLObjectImpl implements SQLReplaceable {
}
public boolean match(long alias_hash) {
if (alias == null) {
return false;
}
long hash = alias_hash();
if (hash == alias_hash) {
@@ -28,6 +28,8 @@ public class SQLSelectOrderByItem extends SQLObjectImpl implements SQLReplaceabl
protected SQLOrderingSpecification type;
protected NullsOrderType nullsOrderType;
protected transient SQLSelectItem resolvedSelectItem;
public SQLSelectOrderByItem(){
}
@@ -140,4 +142,12 @@ public class SQLSelectOrderByItem extends SQLObjectImpl implements SQLReplaceabl
x.nullsOrderType = nullsOrderType;
return x;
}
public SQLSelectItem getResolvedSelectItem() {
return resolvedSelectItem;
}
public void setResolvedSelectItem(SQLSelectItem resolvedSelectItem) {
this.resolvedSelectItem = resolvedSelectItem;
}
}
@@ -20,9 +20,7 @@ import java.util.List;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.*;
import com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr;
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
import com.alibaba.druid.sql.ast.expr.*;
import com.alibaba.druid.sql.repository.SchemaObject;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
import com.alibaba.druid.util.FNVUtils;
@@ -52,6 +50,9 @@ public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery
protected SQLLimit limit;
// for oracle
protected List<SQLExpr> forUpdateOf;
public SQLSelectQueryBlock(){
}
@@ -313,6 +314,7 @@ public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery
if (visitor.visit(this)) {
acceptChild(visitor, this.selectList);
acceptChild(visitor, this.from);
acceptChild(visitor, this.into);
acceptChild(visitor, this.where);
acceptChild(visitor, this.startWith);
acceptChild(visitor, this.connectBy);
@@ -370,6 +372,21 @@ public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery
return x;
}
public List<SQLExpr> getForUpdateOf() {
if (forUpdateOf == null) {
forUpdateOf = new ArrayList<SQLExpr>(1);
}
return forUpdateOf;
}
public int getForUpdateOfSize() {
if (forUpdateOf == null) {
return 0;
}
return forUpdateOf.size();
}
public void cloneTo(SQLSelectQueryBlock x) {
x.distionOption = distionOption;
@@ -484,6 +501,28 @@ public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery
return null;
}
public boolean selectItemHashAllColumn() {
for (SQLSelectItem item : this.selectList) {
SQLExpr expr = item.getExpr();
boolean allColumn = expr instanceof SQLAllColumnExpr
|| (expr instanceof SQLPropertyExpr && ((SQLPropertyExpr) expr).getName().equals("*"));
if (allColumn) {
if (from instanceof SQLSubqueryTableSource) {
SQLSelect subSelect = ((SQLSubqueryTableSource) from).select;
SQLSelectQueryBlock queryBlock = subSelect.getQueryBlock();
if (queryBlock != null) {
return queryBlock.selectItemHashAllColumn();
}
}
return true;
}
}
return false;
}
public SQLColumnDefinition findColumn(String columnName) {
if (from == null) {
return null;
@@ -106,7 +106,12 @@ public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTab
}
public SQLColumnDefinition findColumn(String columnName) {
return null;
if (columnName == null) {
return null;
}
long hash = FNVUtils.fnv_64_lower_normalized(alias);
return findColumn(hash);
}
public SQLColumnDefinition findColumn(long columnNameHash) {
@@ -114,7 +119,12 @@ public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTab
}
public SQLTableSource findTableSourceWithColumn(String columnName) {
return null;
if (columnName == null) {
return null;
}
long hash = FNVUtils.fnv_64_lower_normalized(alias);
return findTableSourceWithColumn(hash);
}
public SQLTableSource findTableSourceWithColumn(long columnNameHash) {
@@ -18,10 +18,7 @@ package com.alibaba.druid.sql.ast.statement;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.SQLReplaceable;
import com.alibaba.druid.sql.ast.SQLStatementImpl;
import com.alibaba.druid.sql.ast.*;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLUpdateStatement extends SQLStatementImpl implements SQLReplaceable {
@@ -33,6 +30,9 @@ public class SQLUpdateStatement extends SQLStatementImpl implements SQLReplaceab
protected SQLTableSource tableSource;
protected List<SQLExpr> returning;
// for mysql
protected SQLOrderBy orderBy;
public SQLUpdateStatement(){
}
@@ -136,6 +136,7 @@ public class SQLUpdateStatement extends SQLStatementImpl implements SQLReplaceab
acceptChild(visitor, from);
acceptChild(visitor, items);
acceptChild(visitor, where);
acceptChild(visitor, orderBy);
}
visitor.endVisit(this);
}
@@ -148,4 +149,16 @@ public class SQLUpdateStatement extends SQLStatementImpl implements SQLReplaceab
}
return false;
}
public SQLOrderBy getOrderBy() {
return orderBy;
}
public void setOrderBy(SQLOrderBy orderBy) {
if (orderBy != null) {
orderBy.setParent(this);
}
this.orderBy = orderBy;
}
}
@@ -126,6 +126,15 @@ public class SQLWithSubqueryClause extends SQLObjectImpl {
public List<SQLName> getColumns() {
return columns;
}
public SQLTableSource findTableSourceWithColumn(long columnNameHash) {
for (SQLName column : columns) {
if (column.name_hash_lower() == columnNameHash) {
return this;
}
}
return null;
}
}
public Entry findEntry(long alias_hash) {