refactor sql parser

This commit is contained in:
高铁
2016-01-10 16:59:11 +08:00
parent fa265636f0
commit d4066b101c
30 changed files with 174 additions and 594 deletions
@@ -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) {