add testcase

This commit is contained in:
wenshao
2013-06-17 00:34:41 +08:00
parent da433839ee
commit b199d3043f
81 changed files with 2493 additions and 693 deletions
@@ -35,5 +35,6 @@ public class MySqlBinlogStatement extends MySqlStatementImpl {
if (visitor.visit(this)) {
acceptChild(visitor, expr);
}
visitor.endVisit(this);
}
}
@@ -41,6 +41,7 @@ public class MySqlCreateUserStatement extends MySqlStatementImpl {
if (visitor.visit(this)) {
acceptChild(visitor, users);
}
visitor.endVisit(this);
}
public static class UserSpecification extends MySqlObjectImpl {
@@ -82,6 +83,7 @@ public class MySqlCreateUserStatement extends MySqlStatementImpl {
acceptChild(visitor, password);
acceptChild(visitor, authPlugin);
}
visitor.endVisit(this);
}
}
@@ -39,5 +39,6 @@ public class MySqlDropUser extends MySqlStatementImpl {
if (visitor.visit(this)) {
acceptChild(visitor, users);
}
visitor.endVisit(this);
}
}
@@ -47,5 +47,6 @@ public class MySqlKillStatement extends MySqlStatementImpl {
if (visitor.visit(this)) {
acceptChild(visitor, threadId);
}
visitor.endVisit(this);
}
}
@@ -35,5 +35,6 @@ public class MySqlResetStatement extends MySqlStatementImpl {
public void accept0(MySqlASTVisitor visitor) {
visitor.visit(this);
visitor.endVisit(this);
}
}
@@ -55,12 +55,12 @@ public class MySqlSelectQueryBlock extends SQLSelectQueryBlock implements MySqlO
public MySqlSelectQueryBlock(){
}
public int getHintsSize() {
if (hints == null) {
return 0;
}
return hints.size();
}
@@ -185,6 +185,62 @@ public class MySqlSelectQueryBlock extends SQLSelectQueryBlock implements MySqlO
this.limit = limit;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (bigResult ? 1231 : 1237);
result = prime * result + (bufferResult ? 1231 : 1237);
result = prime * result + ((cache == null) ? 0 : cache.hashCode());
result = prime * result + (calcFoundRows ? 1231 : 1237);
result = prime * result + (forUpdate ? 1231 : 1237);
result = prime * result + (hignPriority ? 1231 : 1237);
result = prime * result + ((hints == null) ? 0 : hints.hashCode());
result = prime * result + ((limit == null) ? 0 : limit.hashCode());
result = prime * result + (lockInShareMode ? 1231 : 1237);
result = prime * result + ((orderBy == null) ? 0 : orderBy.hashCode());
result = prime * result + ((procedureArgumentList == null) ? 0 : procedureArgumentList.hashCode());
result = prime * result + ((procedureName == null) ? 0 : procedureName.hashCode());
result = prime * result + (smallResult ? 1231 : 1237);
result = prime * result + (straightJoin ? 1231 : 1237);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
MySqlSelectQueryBlock other = (MySqlSelectQueryBlock) obj;
if (bigResult != other.bigResult) return false;
if (bufferResult != other.bufferResult) return false;
if (cache == null) {
if (other.cache != null) return false;
} else if (!cache.equals(other.cache)) return false;
if (calcFoundRows != other.calcFoundRows) return false;
if (forUpdate != other.forUpdate) return false;
if (hignPriority != other.hignPriority) return false;
if (hints == null) {
if (other.hints != null) return false;
} else if (!hints.equals(other.hints)) return false;
if (limit == null) {
if (other.limit != null) return false;
} else if (!limit.equals(other.limit)) return false;
if (lockInShareMode != other.lockInShareMode) return false;
if (orderBy == null) {
if (other.orderBy != null) return false;
} else if (!orderBy.equals(other.orderBy)) return false;
if (procedureArgumentList == null) {
if (other.procedureArgumentList != null) return false;
} else if (!procedureArgumentList.equals(other.procedureArgumentList)) return false;
if (procedureName == null) {
if (other.procedureName != null) return false;
} else if (!procedureName.equals(other.procedureName)) return false;
if (smallResult != other.smallResult) return false;
if (straightJoin != other.straightJoin) return false;
return true;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor instanceof MySqlASTVisitor) {
@@ -258,6 +314,7 @@ public class MySqlSelectQueryBlock extends SQLSelectQueryBlock implements MySqlO
acceptChild(visitor, offset);
acceptChild(visitor, rowCount);
}
mysqlVisitor.endVisit(this);
}
}
@@ -20,13 +20,12 @@ import java.util.List;
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.statement.SQLTableElement;
import com.alibaba.druid.sql.dialect.mysql.ast.MySqlObjectImpl;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
@SuppressWarnings("serial")
public class MySqlTableIndex extends SQLObjectImpl implements SQLTableElement {
public class MySqlTableIndex extends MySqlObjectImpl implements SQLTableElement {
private SQLName name;
private String indexType;
@@ -56,21 +55,7 @@ public class MySqlTableIndex extends SQLObjectImpl implements SQLTableElement {
return columns;
}
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor instanceof MySqlASTVisitor) {
accept0((MySqlASTVisitor) visitor);
return;
}
if (visitor.visit(this)) {
acceptChild(visitor, name);
acceptChild(visitor, columns);
}
visitor.endVisit(this);
}
protected void accept0(MySqlASTVisitor visitor) {
public void accept0(MySqlASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, name);
acceptChild(visitor, columns);