Skip to content

S10: bind query parameters with -a NAME=VALUE - #39

Merged
david-Darkcollective merged 1 commit into
developfrom
feat/query-parameters
Oct 9, 2026
Merged

david-Darkcollective merged 1 commit into
developfrom
feat/query-parameters

Conversation

@david-Darkcollective

Copy link
Copy Markdown
Member

S10 (#14), part of #17: -a/--arg NAME=VALUE binds the query parameter $NAME outside the script text.

relix -a id=42 order.relix
xargs -I{} relix -a id={} order.relix

What it does

  • -a is repeatable and global, like -D, so it can come before or after the command and the script. Values go to the engine through Relix.Builder.parameters and are never pasted into the text.
  • A value is text. The engine reads it as the type the parameter was analysed to (Bind a parameter from text: convert a String to the parameter's analysed type relix-core#101, in rc8), so -a id=42 binds a number when $id is compared with a NUMBER column. Text that doesn't read as that type is an analysis error (exit 3) naming the parameter, the type and the text.
  • An unbound parameter is an analysis error (exit 3) that names it. The engine's message suggests a Java call, so the new EngineMessages rewrites that one message for the command line:
    relix: order.relix: parameter $id is not bound; give it a value with -a id=VALUE
    Every other engine message passes through unchanged.
  • fmt, bundle and optimize print $name, never the value.
  • docs/design.md §4 lists -a.

Tests

QueryParametersTest covers the issue's acceptance points through Main:

  • binding, with --arg, after the script, and several -a at once;
  • a value holding a quote, Paris' ∨ '1' = '1, matches nothing and can't change the query;
  • a numeric parameter bound from text, and text of the wrong type;
  • the exact unbound-parameter error and its exit status;
  • fmt, bundle and optimize printing $city and not the value.

CI: the two FmtTest failures on league.relix aren't caused by this branch; they fail on develop too. They clear once DarkCollective/relix-core#106 reaches the snapshot and #38 merges. Everything else passes.

A value given with -a is bound to $NAME through the engine's
Relix.Builder.parameters, never pasted into the script, so a value holding
a quote cannot change the query. The value is text, which the engine reads
as the type the parameter was analysed to (relix-core#101): -a id=42 binds
a number when $id is compared with a NUMBER, and text that does not read
as that type is an analysis error.

An unbound parameter is an analysis error (exit 3) that names it. The
engine's message names its Java remedy, so EngineMessages puts it in the
command's terms: "give it a value with -a NAME=VALUE". fmt, bundle and
optimize print $NAME, never the value.

Part of #14.
@david-Darkcollective
david-Darkcollective merged commit 88849b5 into develop Oct 9, 2026
3 of 6 checks passed
@david-Darkcollective
david-Darkcollective deleted the feat/query-parameters branch October 9, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant