Skip to main content

parse_with_params

Function parse_with_params 

Source
pub fn parse_with_params(
    input: &str,
    params: &[ParamValue],
) -> Result<Statement, ParseError>
Expand description

Parse PowQL with $N placeholders bound to positional params.

Binding happens at the token level: the input is lexed, each $N placeholder token is replaced in place with the literal token for params[N-1] (a string param becomes a StringLit byte-for-byte, null becomes Token::Null), and the resulting token stream is parsed normally. Values are never re-lexed or string-interpolated, so an injection-shaped string is inert data — it can never change the query’s shape.

Placeholders are 1-based ($1, $2, …). A reference to a placeholder with no corresponding parameter is a clean ParseError::Syntax, as is a non-numeric $name (the named-parameter form belongs to the in-process prepared API, not the positional wire-binding path).