*/
public static void parse(SQLExpr where,
LinkedHashMap<String, Condition> conditions, LinkedHashMap<String, Condition> ranges)
throws UnsupportedException {
if (where instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) where;
SQLBinaryOperator operator = binaryOpExpr.getOperator();
if (operator == Equality) {// one pair
SQLIdentifierExpr left = (SQLIdentifierExpr) binaryOpExpr.getLeft();
Condition value = new Condition(left.getName(),
Condition.ConditionType.EQUAL, binaryOpExpr.getRight());
conditions.put(value.getFieldName(), value);
} else if (operator == SQLBinaryOperator.BooleanAnd) {// multi pair
SQLExpr left = binaryOpExpr.getLeft();
SQLExpr right = binaryOpExpr.getRight();
parse(left, conditions, ranges);
parse(right, conditions, ranges);
} else if (operator == SQLBinaryOperator.GreaterThan
|| operator == SQLBinaryOperator.GreaterThanOrEqual
|| operator == SQLBinaryOperator.LessThan
|| operator == SQLBinaryOperator.LessThanOrEqual) {
SQLIdentifierExpr left = (SQLIdentifierExpr) binaryOpExpr.getLeft();
String fieldName = left.getName();
Condition value = getCondition(fieldName, ranges);
if (value == null) {
value = new Condition(left.getName(), Condition.ConditionType.RANGE,
binaryOpExpr.getRight(), operator);
ranges.put(value.getFieldName(), value);
} else {
value.resetValue(binaryOpExpr.getRight(), operator);
}
} else {
throw new UnsupportedException("where clause '" + where + " has '"
+ operator + "' , current this is Unsupported");
}