mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -112,7 +112,7 @@ public class SQLIdentifierExpr extends SQLExprImpl implements SQLName {
|
||||
public SQLIdentifierExpr simplify() {
|
||||
String normalized = SQLUtils.normalize(name);
|
||||
if (normalized != name) {
|
||||
return new SQLIdentifierExpr(name, hashCode64);
|
||||
return new SQLIdentifierExpr(normalized, hashCode64);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -284,4 +284,18 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
|
||||
public boolean nameEquals(String name) {
|
||||
return SQLUtils.nameEquals(this.name, name);
|
||||
}
|
||||
|
||||
public SQLPropertyExpr simplify() {
|
||||
String normalizedName = SQLUtils.normalize(name);
|
||||
SQLExpr normalizedOwner = this.owner;
|
||||
if (normalizedOwner instanceof SQLIdentifierExpr) {
|
||||
normalizedOwner = ((SQLIdentifierExpr) normalizedOwner).simplify();
|
||||
}
|
||||
|
||||
if (normalizedName != name || normalizedOwner != owner) {
|
||||
return new SQLPropertyExpr(normalizedOwner, normalizedName, hashCode64);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user