improved sql parser.

This commit is contained in:
wenshao
2017-06-27 11:28:15 +08:00
parent 8339beee7a
commit c64c40e81d
11 changed files with 118 additions and 7 deletions
@@ -52,4 +52,8 @@ public class SQLCharExpr extends SQLTextLiteralExpr implements SQLValuableExpr{
public String toString() {
return SQLUtils.toSQLString(this);
}
public SQLCharExpr clone() {
return new SQLCharExpr(this.text);
}
}
@@ -100,4 +100,15 @@ public class SQLExistsExpr extends SQLExprImpl implements Serializable {
}
return true;
}
public SQLExistsExpr clone () {
SQLExistsExpr x = new SQLExistsExpr();
x.not = not;
if (subQuery != null) {
x.setSubQuery(subQuery.clone());
}
return x;
}
}
@@ -15,6 +15,7 @@
*/
package com.alibaba.druid.sql.ast.expr;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExprImpl;
import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
@@ -102,6 +103,28 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
return true;
}
public boolean equalsIgnoreCase(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SQLIdentifierExpr)) {
return false;
}
SQLIdentifierExpr other = (SQLIdentifierExpr) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!SQLUtils.normalize(name).equalsIgnoreCase(SQLUtils.normalize(other.name))) {
return false;
}
return true;
}
public String toString() {
return this.name;
}