Class BindVariableSubstitutor
:var) into raw SQL text before it is
parsed/executed. Holds a live reference to the procedural variable map.
A record field is not one of them. Inside a SQL statement rec.col is an ordinary column
reference on the account: INSERT INTO t VALUES (r.a) is "invalid identifier 'R.A'", and over
a table aliased r it reads that table's own column. Only a scripting EXPRESSION reads the
field (x := r.a, RETURN r.a, an IF condition), and none of those comes through here.
The substitution is driven by the SQL lexer, not hand-rolled character scanning: the SQL
is tokenized, and a bind variable is recognized as the token sequence ':' IDENTIFIER. Because
the lexer classifies the text,
a name that appears inside a FrostlakeLexer.STRING_LITERAL or a FrostlakeLexer.QUOTED_IDENTIFIER
is never mistaken for a reference, and :: (cast) / := (assignment) — their own tokens
— are never confused with a :var. The grammar's tokenizer stays the single source of truth
about the SQL's lexical structure.
-
Constructor Summary
ConstructorsConstructorDescriptionBindVariableSubstitutor(Map<String, Object> variables) BindVariableSubstitutor(Map<String, Object> variables, ProceduralExecutor declarations) A substitutor that also knows the names' DECLARED types, so a numeric variable is spelled with its type —(1)::NUMBER(9,0)for a FOR counter,(1.78)::NUMBER(5,2)for a declared NUMBER — and the statement it lands in types it as live does (a column derived from:ideclares NUMBER(9,0), not the digits' own width). -
Method Summary
Modifier and TypeMethodDescriptionsubstitute(String sql) Substitute colon bind variables into the SQL.
-
Constructor Details
-
BindVariableSubstitutor
-
BindVariableSubstitutor
A substitutor that also knows the names' DECLARED types, so a numeric variable is spelled with its type —(1)::NUMBER(9,0)for a FOR counter,(1.78)::NUMBER(5,2)for a declared NUMBER — and the statement it lands in types it as live does (a column derived from:ideclares NUMBER(9,0), not the digits' own width).
-
-
Method Details
-
substitute
Substitute colon bind variables into the SQL.
-