Expand description
AST-level parameter binding for prepared statements.
Every Value::Placeholder("$N") in a parsed statement is rewritten to
a concrete literal value via sqlparser’s VisitorMut. The visitor
traverses every expression position the AST defines — CTE bodies,
window specs, Update.from/returning/limit, Delete.returning,
Insert.on_conflict, Expr::Array elements, Expr::AnyOp/AllOp
right-hand sides, Expr::Interval, and any variant sqlparser adds in
the future — without us maintaining a hand-written walker.
§Why a visitor, not a hand-written walker
The previous implementation was a recursive match on ~20 Expr /
Statement / Query variants. Every new sqlparser variant it didn’t
enumerate was a silent bug: placeholders survived into the planner and
surfaced as “unsupported expression: $1” in the resolver. The walker
was opt-in where it had to be exhaustive to be correct. VisitorMut
moves the exhaustiveness burden to sqlparser itself.
Enums§
- Param
Value - Parameter value for AST substitution.
Functions§
- bind_
params - Substitute all
$Nplaceholders in a parsed statement with concrete values.