mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor sql parser
This commit is contained in:
@@ -24,6 +24,9 @@ import java.util.List;
|
||||
public class SQLOrderBy extends SQLObjectImpl {
|
||||
|
||||
protected final List<SQLSelectOrderByItem> items = new ArrayList<SQLSelectOrderByItem>();
|
||||
|
||||
// for postgres
|
||||
private boolean sibings;
|
||||
|
||||
public SQLOrderBy(){
|
||||
|
||||
@@ -44,6 +47,14 @@ public class SQLOrderBy extends SQLObjectImpl {
|
||||
public List<SQLSelectOrderByItem> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public boolean isSibings() {
|
||||
return this.sibings;
|
||||
}
|
||||
|
||||
public void setSibings(boolean sibings) {
|
||||
this.sibings = sibings;
|
||||
}
|
||||
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
@@ -57,7 +68,8 @@ public class SQLOrderBy extends SQLObjectImpl {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + items.hashCode();
|
||||
result = prime * result + ((items == null) ? 0 : items.hashCode());
|
||||
result = prime * result + (sibings ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -67,7 +79,11 @@ public class SQLOrderBy extends SQLObjectImpl {
|
||||
if (obj == null) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
SQLOrderBy other = (SQLOrderBy) obj;
|
||||
return items.equals(other.items);
|
||||
if (items == null) {
|
||||
if (other.items != null) return false;
|
||||
} else if (!items.equals(other.items)) return false;
|
||||
if (sibings != other.sibings) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addItem(SQLExpr expr, SQLOrderingSpecification type) {
|
||||
|
||||
Reference in New Issue
Block a user