mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser for postgresql
This commit is contained in:
@@ -28,16 +28,25 @@ public class SQLBinaryOpExpr extends SQLExprImpl implements Serializable {
|
||||
private SQLExpr left;
|
||||
private SQLExpr right;
|
||||
private SQLBinaryOperator operator;
|
||||
private String dbType;
|
||||
|
||||
public SQLBinaryOpExpr(){
|
||||
|
||||
}
|
||||
|
||||
public SQLBinaryOpExpr(SQLExpr left, SQLBinaryOperator operator, SQLExpr right){
|
||||
public SQLBinaryOpExpr(String dbType){
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public SQLBinaryOpExpr(SQLExpr left, SQLBinaryOperator operator, SQLExpr right){
|
||||
this(left, operator, right, null);
|
||||
}
|
||||
|
||||
public SQLBinaryOpExpr(SQLExpr left, SQLBinaryOperator operator, SQLExpr right, String dbType){
|
||||
setLeft(left);
|
||||
setRight(right);
|
||||
this.operator = operator;
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public SQLBinaryOpExpr(SQLExpr left, SQLExpr right, SQLBinaryOperator operator){
|
||||
@@ -47,6 +56,14 @@ public class SQLBinaryOpExpr extends SQLExprImpl implements Serializable {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public SQLExpr getLeft() {
|
||||
return this.left;
|
||||
}
|
||||
@@ -129,6 +146,6 @@ public class SQLBinaryOpExpr extends SQLExprImpl implements Serializable {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return SQLUtils.toSQLString(this);
|
||||
return SQLUtils.toSQLString(this, getDbType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,8 @@ public enum SQLBinaryOperator {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLogical() {
|
||||
return this == BooleanAnd || this == BooleanOr || this == BooleanXor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ public enum SQLUnaryOperator {
|
||||
ConnectByRoot("CONNECT BY"), //
|
||||
BINARY("BINARY"), //
|
||||
RAW("RAW"), //
|
||||
NOT("NOT");
|
||||
NOT("NOT"),
|
||||
Pound("#") // Number of points in path or polygon
|
||||
;
|
||||
|
||||
public final String name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user