public boolean visit(SQLBinaryOpExpr x) { x.getLeft().setParent(x); x.getRight().setParent(x); switch (x.getOperator()) { case Equality: case NotEqual: case GreaterThan: case GreaterThanOrEqual: case LessThan: case LessThanOrEqual: case LessThanOrEqualOrGreaterThan: case Like: case NotLike: case Is: case IsNot: handleCondition(x.getLeft(), x.getOperator().name, x.getRight()); handleCondition(x.getRight(), x.getOperator().name, x.getLeft()); handleRelationship(x.getLeft(), x.getOperator().name, x.getRight()); break; default: break; } return true; }
@Override public boolean visit(SQLInSubQueryExpr x) { if (x.isNot()) { handleCondition(x.getExpr(), "NOT IN"); } else { handleCondition(x.getExpr(), "IN"); } return true; }
public boolean visit(SQLInListExpr x) { if (x.isNot()) { handleCondition(x.getExpr(), "NOT IN", x.getTargetList()); } else { handleCondition(x.getExpr(), "IN", x.getTargetList()); } return true; }
protected void handleCondition(SQLExpr expr, String operator, List<SQLExpr> values) { handleCondition(expr, operator, values.toArray(new SQLExpr[values.size()])); }