From b86f321ecae3a54d1bcdc8ff8069fe6030350894 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Thu, 18 Sep 2025 19:15:14 -0400 Subject: [PATCH] Add comments to bind_and_rewrite_expr --- core/translate/expr.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 68ab0bafc..56649f715 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -3250,6 +3250,10 @@ where Ok(WalkControl::Continue) } +/// Context needed to walk all expressions in a INSERT|UPDATE|SELECT|DELETE body, +/// in the order they are encountered, to ensure that the parameters are rewritten from +/// anonymous ("?") to our internal named scheme so when the columns are re-ordered we are able +/// to bind the proper parameter values. pub struct ParamState { /// ALWAYS starts at 1 pub next_param_idx: usize, @@ -3261,6 +3265,9 @@ impl Default for ParamState { } } +/// Rewrite ast::Expr in place, binding Column references/rewriting Expr::Id -> Expr::Column +/// using the provided TableReferences, and replacing anonymous parameters with internal named +/// ones, as well as normalizing any DoublyQualified/Qualified quoted identifiers. pub fn bind_and_rewrite_expr<'a>( top_level_expr: &mut ast::Expr, mut referenced_tables: Option<&'a mut TableReferences>,