mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve wall filter
This commit is contained in:
@@ -449,7 +449,7 @@ public class WallVisitorUtils {
|
||||
}
|
||||
|
||||
if (leftResult == Boolean.TRUE) {
|
||||
if (x.getParent() instanceof SQLExpr) {
|
||||
if (!isFirst(x.getLeft())) {
|
||||
final WallConditionContext current = wallConditionContextLocal.get();
|
||||
if (current != null) {
|
||||
current.setPartAlwayTrue(true);
|
||||
@@ -475,6 +475,22 @@ public class WallVisitorUtils {
|
||||
|
||||
return SQLEvalVisitorUtils.eval(dbType, x, Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
public static boolean isFirst(SQLObject x) {
|
||||
SQLObject parent = x.getParent();
|
||||
if (!(parent instanceof SQLExpr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parent instanceof SQLBinaryOpExpr) {
|
||||
SQLBinaryOpExpr binaryExpr = (SQLBinaryOpExpr) parent;
|
||||
if (isFirst(binaryExpr.getParent()) && x == binaryExpr.getLeft()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class WallConditionContext {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user