Skip to main content

Module batch_executor

Module batch_executor 

Source
Expand description

v9.5.0 BatchExecutor:端到端批量执行

串联 QueryBuilder::build_batch_insert_with_params(query.rs:2953) → Connection::execute_with_params(pool.rs:98), 含自动分片、空批边界、UPSERT 端到端。

§设计要点

  • 参数化:所有值通过 ?/$N 占位符绑定,杜绝 SQL 注入(spec 5.1.1 规则 5)
  • 空批短路:空 rows 返回 Ok(0),不执行 SQL(spec 5.1.1 规则 4)
  • 自动分片:rows.len() > max_batch_rows 时按 max_batch_rows 分片执行并聚合影响行数
  • 多值 INSERT:生成单条多值 INSERT SQL,非逐行循环(spec 5.1.1 规则 6)

Structs§

BatchExecutor
v9.5.0 批量执行器:端到端批量 INSERT/UPSERT。
BatchParallelResult
v9.6.0 并行批量执行结果