mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
SchemaStatVisitor support relationship
This commit is contained in:
@@ -22,6 +22,15 @@ public class TableStat {
|
||||
int deleteCount = 0;
|
||||
int insertCount = 0;
|
||||
int dropCount = 0;
|
||||
int mergeCount = 0;
|
||||
|
||||
public int getMergeCount() {
|
||||
return mergeCount;
|
||||
}
|
||||
|
||||
public void incrementMergeCount() {
|
||||
this.mergeCount++;
|
||||
}
|
||||
|
||||
public int getDropCount() {
|
||||
return dropCount;
|
||||
@@ -85,6 +94,9 @@ public class TableStat {
|
||||
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(4);
|
||||
if (mergeCount > 0) {
|
||||
buf.append("Merge");
|
||||
}
|
||||
if (insertCount > 0) {
|
||||
buf.append("Insert");
|
||||
}
|
||||
@@ -135,6 +147,89 @@ public class TableStat {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Relationship {
|
||||
|
||||
private Column left;
|
||||
private Column right;
|
||||
private String operator;
|
||||
|
||||
public Column getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(Column left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public Column getRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setRight(Column right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((left == null) ? 0 : left.hashCode());
|
||||
result = prime * result + ((operator == null) ? 0 : operator.hashCode());
|
||||
result = prime * result + ((right == null) ? 0 : right.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Relationship other = (Relationship) obj;
|
||||
if (left == null) {
|
||||
if (other.left != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!left.equals(other.left)) {
|
||||
return false;
|
||||
}
|
||||
if (operator == null) {
|
||||
if (other.operator != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!operator.equals(other.operator)) {
|
||||
return false;
|
||||
}
|
||||
if (right == null) {
|
||||
if (other.right != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!right.equals(other.right)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return left + " " + operator + " " + right;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Condition {
|
||||
|
||||
private Column column;
|
||||
@@ -272,7 +367,7 @@ public class TableStat {
|
||||
}
|
||||
|
||||
public static enum Mode {
|
||||
Insert(1), Update(2), Delete(4), Select(8);
|
||||
Insert(1), Update(2), Delete(4), Select(8), Merge(16);
|
||||
|
||||
public final int mark;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user