}
Expr expr = parseExpression(new TokBuf(exprType, tokens, context), false);
+
+ if((exprType == Type.FIELD_VALIDATOR) && !expr.isConditionalExpr()) {
+ // a non-conditional expression for a FIELD_VALIDATOR treats the result
+ // as an equality comparison with the field in question. so, transform
+ // the expression accordingly
+ expr = new ECompOp(CompOp.EQ, THIS_COL_VALUE, expr);
+ }
+
return (expr.isConstant() ?
// for now, just cache at top-level for speed (could in theory cache
// intermediate values?)
toString(sb, true);
return sb.toString();
}
+
+ protected boolean isConditionalExpr() {
+ return false;
+ }
protected void toString(StringBuilder sb, boolean isDebug) {
if(isDebug) {
return _expr.isConstant();
}
+ @Override
+ protected boolean isConditionalExpr() {
+ return _expr.isConditionalExpr();
+ }
+
@Override
public Value eval(EvalContext ctx) {
return _expr.eval(ctx);
super(op, left, right);
}
+ @Override
+ protected boolean isConditionalExpr() {
+ return true;
+ }
+
@Override
public Value eval(EvalContext ctx) {
return ((CompOp)_op).eval(_left.eval(ctx), _right.eval(ctx));
public void setLeft(Expr left) {
_expr = left;
}
+
+ @Override
+ protected boolean isConditionalExpr() {
+ return true;
+ }
}
private static class ENullOp extends ESpecOp
return null;
}
- // FIXME - field/row validator -> if top-level operator is not "boolean", then do value comparison withe coercion
- // FIXME, is this only true for non-numeric...?
- // if(val.getType() != Value.Type.BOOLEAN) {
- // // a single value as a conditional expression seems to act like an
- // // implicit "="
- // // FIXME, what about row validators?
- // val = BuiltinOperators.equals(val, ctx.getThisColumnValue());
- // }
+ // FIXME, access seems to type coerce all "fields" (including <this>), but not constants
return val.getAsBoolean();
}