/** * Binds the specified value to a variable. * * @param name variable name * @param args argument array * @param value value to be bound * @throws QueryException query exception */ private void bind(final QNm name, final Expr[] args, final Value value) throws QueryException { // skip nulled values if (value == null) return; for (int i = 0; i < function.args.length; i++) { final Var var = function.args[i]; if (!var.name.eq(name)) continue; // casts and binds the value args[i] = var.checkType(value, context, null); break; } }
@Override public String toString() { final TokenBuilder tb = new TokenBuilder().add(var.toString()).add(' ').add(ASSIGN); tb.add(' ').add(expr.toString()); if (coll != null) tb.add(' ').add(COLLATION).add(" \"").add(coll.uri()).add('"'); return tb.toString(); }
@Override public void plan(final FElem plan) { final FElem e = planElem(); var.plan(e); expr.plan(e); plan.add(e); }
@Override public Count optimize(final QueryContext qc, final VarScope scp) throws QueryException { var.refineType(SeqType.ITR, qc, info); return this; }