mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #478 from cutedemons/master
fix SQLBinaryOpExpr split bug && modify wall config
This commit is contained in:
@@ -293,6 +293,8 @@ public class SQLUtils {
|
||||
|
||||
public static List<SQLExpr> split(SQLBinaryOpExpr x) {
|
||||
List<SQLExpr> groupList = new ArrayList<SQLExpr>();
|
||||
groupList.add(x.getRight());
|
||||
|
||||
SQLExpr left = x.getLeft();
|
||||
for (;;) {
|
||||
if (left instanceof SQLBinaryOpExpr && ((SQLBinaryOpExpr) left).getOperator() == x.getOperator()) {
|
||||
@@ -304,7 +306,6 @@ public class SQLUtils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
groupList.add(x.getRight());
|
||||
return groupList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,18 +113,18 @@ public class WallConfig implements WallConfigMBean {
|
||||
private boolean conditionOpXorAllow = false;
|
||||
private boolean conditionOpBitwseAllow = true;
|
||||
|
||||
private boolean caseConditionAllow = false;
|
||||
private boolean caseConditionConstAllow = false;
|
||||
|
||||
public WallConfig(){
|
||||
|
||||
}
|
||||
|
||||
public boolean isCaseConditionAllow() {
|
||||
return caseConditionAllow;
|
||||
public boolean isCaseConditionConstAllow() {
|
||||
return caseConditionConstAllow;
|
||||
}
|
||||
|
||||
public void setCaseConditionAllow(boolean caseConditionAllow) {
|
||||
this.caseConditionAllow = caseConditionAllow;
|
||||
public void setCaseConditionConstAllow(boolean caseConditionConstAllow) {
|
||||
this.caseConditionConstAllow = caseConditionConstAllow;
|
||||
}
|
||||
|
||||
public boolean isConditionDoubleConstAllow() {
|
||||
|
||||
@@ -1050,7 +1050,7 @@ public class WallVisitorUtils {
|
||||
|
||||
Object result = getValue(caseExpr);
|
||||
|
||||
if (visitor != null && !visitor.getConfig().isCaseConditionAllow()) {
|
||||
if (visitor != null && !visitor.getConfig().isCaseConditionConstAllow()) {
|
||||
boolean leftIsName = false;
|
||||
if (x.getParent() instanceof SQLBinaryOpExpr) {
|
||||
SQLExpr left = ((SQLBinaryOpExpr) x.getParent()).getLeft();
|
||||
@@ -1083,7 +1083,7 @@ public class WallVisitorUtils {
|
||||
|
||||
if (x instanceof SQLCaseExpr) {
|
||||
|
||||
if (visitor != null && !visitor.getConfig().isCaseConditionAllow()) {
|
||||
if (visitor != null && !visitor.getConfig().isCaseConditionConstAllow()) {
|
||||
SQLCaseExpr caseExpr = (SQLCaseExpr) x;
|
||||
|
||||
boolean leftIsName = false;
|
||||
|
||||
Reference in New Issue
Block a user