Expression esc = null;
if (readIf("ESCAPE")) {
esc = readConcat();
}
recompileAlways = true;
r = new Comparison(session, op.getName(), r, b);
} //else if (readIf("REGEXP")) {
// Expression b = readConcat();
// r = new CompareLike(database.getCompareMode(), r, b, null, true);
// } else
if (readIf("IS")) {
String type;
if (readIf("NOT")) {
type = Operator.IS_NOT_NULL;
} else {
type = Operator.IS_NULL;
}
read("NULL");
r = new Comparison(session, type, r, null);
// } else if (readIf("IN")) {
// if (SysProperties.OPTIMIZE_IN && !SysProperties.OPTIMIZE_IN_LIST) {
// recompileAlways = true;
// }
// read("(");
// if (readIf(")")) {
// r = ValueExpression.get(ValueBoolean.get(false));
// } else {
// if (isToken("SELECT") || isToken("FROM")) {
// Query query = parseSelect();
// r = new ConditionInSelect(database, r, query, false, Comparison.EQUAL);
// } else {
// ObjectArray<Expression> v = ObjectArray.newInstance();
// Expression last;
// do {
// last = readExpression();
// v.add(last);
// } while (readIf(","));
// if (v.size() == 1 && (last instanceof Subquery)) {
// Subquery s = (Subquery) last;
// Query q = s.getQuery();
// r = new ConditionInSelect(database, r, q, false, Comparison.EQUAL);
// } else {
// r = new ConditionIn(database, r, v);
// }
// }
// read(")");
// }
// } else if (readIf("BETWEEN")) {
// Expression low = readConcat();
// read("AND");
// Expression high = readConcat();
// Expression condLow = new Comparison(session, Comparison.SMALLER_EQUAL, low, r);
// Expression condHigh = new Comparison(session, Comparison.BIGGER_EQUAL, high, r);
// r = new ConditionAndOr(ConditionAndOr.AND, condLow, condHigh);
} else {
String compareType = getCompareType(currentTokenType);
if (compareType == null) {
break;
}
read();
// if (readIf("ALL")) {
// read("(");
// Query query = parseSelect();
// r = new ConditionInSelect(database, r, query, true, compareType);
// read(")");
// } else if (readIf("ANY") || readIf("SOME")) {
// read("(");
// Query query = parseSelect();
// r = new ConditionInSelect(database, r, query, false, compareType);
// read(")");
// } else {
Expression right = readConcat();
// if (readIf("(") && readIf("+") && readIf(")")) {
// // support for a subset of old-fashioned Oracle outer
// // join with (+)
// if (r instanceof ExpressionColumn && right instanceof ExpressionColumn) {
// ExpressionColumn leftCol = (ExpressionColumn) r;
// ExpressionColumn rightCol = (ExpressionColumn) right;
// ObjectArray<TableFilter> filters = currentSelect.getTopFilters();
// for (TableFilter f : filters) {
// while (f != null) {
// leftCol.mapColumns(f, 0);
// rightCol.mapColumns(f, 0);
// f = f.getJoin();
// }
// }
// TableFilter leftFilter = leftCol.getTableFilter();
// TableFilter rightFilter = rightCol.getTableFilter();
// r = new Comparison(session, compareType, r, right);
// if (leftFilter != null && rightFilter != null) {
// int idx = filters.indexOf(rightFilter);
// if (idx >= 0) {
// filters.remove(idx);
// leftFilter.addJoin(rightFilter, true, r);
// } else {
// rightFilter.mapAndAddFilter(r);
// }
// r = ValueExpression.get(ValueBoolean.get(true));
// }
// }
// } else {
r = new Comparison(session, compareType, r, right);
// }
// }
//if (not) {
// r = new ConditionNot(session, r);