improved sql parsre.

This commit is contained in:
wenshao
2017-10-11 19:59:45 +08:00
parent 2d88d76e80
commit c6cbb328ea
233 changed files with 3589 additions and 182 deletions
@@ -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;
}
}
}