mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser. for issue #1780
This commit is contained in:
@@ -24,4 +24,9 @@ public interface SQLDataType extends SQLObject {
|
||||
void setName(String name);
|
||||
|
||||
List<SQLExpr> getArguments();
|
||||
|
||||
Boolean getWithTimeZone();
|
||||
void setWithTimeZone(Boolean value);
|
||||
|
||||
boolean isWithLocalTimeZone();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ public class SQLDataTypeImpl extends SQLObjectImpl implements SQLDataType {
|
||||
|
||||
protected String name;
|
||||
protected final List<SQLExpr> arguments = new ArrayList<SQLExpr>();
|
||||
private Boolean withTimeZone;
|
||||
|
||||
private boolean withLocalTimeZone = false;
|
||||
|
||||
public SQLDataTypeImpl(){
|
||||
|
||||
@@ -62,26 +65,40 @@ public class SQLDataTypeImpl extends SQLObjectImpl implements SQLDataType {
|
||||
this.arguments.add(argument);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SQLDataTypeImpl dataType = (SQLDataTypeImpl) o;
|
||||
|
||||
if (name != null ? !name.equals(dataType.name) : dataType.name != null) return false;
|
||||
if (arguments != null ? !arguments.equals(dataType.arguments) : dataType.arguments != null) return false;
|
||||
return withTimeZone != null ? withTimeZone.equals(dataType.withTimeZone) : dataType.withTimeZone == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + arguments.hashCode();
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
int result = name != null ? name.hashCode() : 0;
|
||||
result = 31 * result + (arguments != null ? arguments.hashCode() : 0);
|
||||
result = 31 * result + (withTimeZone != null ? withTimeZone.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
SQLDataTypeImpl other = (SQLDataTypeImpl) obj;
|
||||
if (!arguments.equals(other.arguments)) return false;
|
||||
if (name == null) {
|
||||
if (other.name != null) return false;
|
||||
} else if (!name.equals(other.name)) return false;
|
||||
return true;
|
||||
public Boolean getWithTimeZone() {
|
||||
return withTimeZone;
|
||||
}
|
||||
|
||||
public void setWithTimeZone(Boolean withTimeZone) {
|
||||
this.withTimeZone = withTimeZone;
|
||||
}
|
||||
|
||||
public boolean isWithLocalTimeZone() {
|
||||
return withLocalTimeZone;
|
||||
}
|
||||
|
||||
public void setWithLocalTimeZone(boolean withLocalTimeZone) {
|
||||
this.withLocalTimeZone = withLocalTimeZone;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user