mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parsre.
This commit is contained in:
@@ -37,7 +37,7 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable, SQLRe
|
||||
protected SQLKeep keep;
|
||||
protected SQLOver over;
|
||||
protected SQLOrderBy withinGroup;
|
||||
protected boolean ignoreNulls = false;
|
||||
protected Boolean ignoreNulls = false;
|
||||
|
||||
public SQLAggregateExpr(String methodName){
|
||||
this.methodName = methodName;
|
||||
@@ -117,6 +117,10 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable, SQLRe
|
||||
}
|
||||
|
||||
public boolean isIgnoreNulls() {
|
||||
return this.ignoreNulls != null && this.ignoreNulls;
|
||||
}
|
||||
|
||||
public Boolean getIgnoreNulls() {
|
||||
return this.ignoreNulls;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,9 @@ package com.alibaba.druid.sql.ast.expr;
|
||||
public enum SQLBinaryOperator {
|
||||
Union("UNION", 0),
|
||||
COLLATE("COLLATE", 20),
|
||||
BitwiseXor("^", 50),
|
||||
|
||||
BitwiseXor("^", 50),
|
||||
BitwiseXorEQ("^=", 110),
|
||||
|
||||
Multiply("*", 60),
|
||||
Divide("/", 60),
|
||||
DIV("DIV", 60), // mysql integer division
|
||||
@@ -70,7 +71,7 @@ public enum SQLBinaryOperator {
|
||||
Array_Contains("@>", 110),
|
||||
Array_ContainedBy("<@", 110),
|
||||
SAME_AS("~=", 110),
|
||||
|
||||
|
||||
RLike("RLIKE", 110),
|
||||
NotRLike("NOT RLIKE", 110),
|
||||
|
||||
@@ -149,4 +150,19 @@ public enum SQLBinaryOperator {
|
||||
public boolean isLogical() {
|
||||
return this == BooleanAnd || this == BooleanOr || this == BooleanXor;
|
||||
}
|
||||
|
||||
public boolean isArithmetic() {
|
||||
switch (this) {
|
||||
case Add:
|
||||
case Subtract:
|
||||
case Multiply:
|
||||
case Divide:
|
||||
case DIV:
|
||||
case Modulus:
|
||||
case Mod:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user