// final WallConditionContext old = wallConditionContextLocal.get();
left.accept(visitor);
right.accept(visitor);
final WallConditionContext wallConditionContext = WallVisitorUtils.getWallConditionContext();
if (x.getOperator() == SQLBinaryOperator.BooleanOr) {
if (wallConditionContext != null) {
if (left.getAttribute(EVAL_VALUE) == Boolean.TRUE || right.getAttribute(EVAL_VALUE) == Boolean.TRUE) {
wallConditionContext.setPartAlwayTrue(true);
}
}
} else if (x.getOperator() == SQLBinaryOperator.BooleanAnd) {
if (wallConditionContext != null) {
if (left.getAttribute(EVAL_VALUE) == Boolean.FALSE || right.getAttribute(EVAL_VALUE) == Boolean.FALSE) {
wallConditionContext.setPartAlwayFalse(true);
}
}
} else if (x.getOperator() == SQLBinaryOperator.BooleanXor) {
if (wallConditionContext != null) {
wallConditionContext.setXor(true);
}
} else if (x.getOperator() == SQLBinaryOperator.BitwiseAnd //
|| x.getOperator() == SQLBinaryOperator.BitwiseNot //
|| x.getOperator() == SQLBinaryOperator.BitwiseOr //
|| x.getOperator() == SQLBinaryOperator.BitwiseXor) {
if (wallConditionContext != null) {
wallConditionContext.setBitwise(true);
}
}
Object leftValue = left.getAttribute(EVAL_VALUE);
Object rightValue = right.getAttributes().get(EVAL_VALUE);
if (x.getOperator() == SQLBinaryOperator.Like) {
if (isAlwayTrueLikePattern(x.getRight())) {
x.putAttribute(WallVisitorUtils.HAS_TRUE_LIKE, Boolean.TRUE);
x.putAttribute(EVAL_VALUE, Boolean.TRUE);
return false;
}
}
if (x.getOperator() == SQLBinaryOperator.NotLike) {
if (isAlwayTrueLikePattern(x.getRight())) {
x.putAttribute(EVAL_VALUE, Boolean.FALSE);
return false;
}
}
boolean leftHasValue = left.getAttributes().containsKey(EVAL_VALUE);
boolean rightHasValue = right.getAttributes().containsKey(EVAL_VALUE);
if ((!leftHasValue) && !rightHasValue) {
SQLExpr leftEvalExpr = (SQLExpr) left.getAttribute(EVAL_EXPR);
SQLExpr rightEvalExpr = (SQLExpr) right.getAttribute(EVAL_EXPR);
if (leftEvalExpr != null && leftEvalExpr.equals(rightEvalExpr)) {
switch (x.getOperator()) {
case Like:
case Equality:
case GreaterThanOrEqual:
case LessThanOrEqual:
case NotLessThan:
case NotGreaterThan:
x.putAttribute(EVAL_VALUE, Boolean.TRUE);
return false;
case NotEqual:
case NotLike:
case GreaterThan:
case LessThan:
x.putAttribute(EVAL_VALUE, Boolean.FALSE);
return false;
default:
break;
}
}
}
if (!leftHasValue) {
return false;
}
if (!rightHasValue) {
return false;
}
if (wallConditionContext != null) {
wallConditionContext.setConstArithmetic(true);
}
leftValue = processValue(leftValue);
rightValue = processValue(rightValue);