Treatment executeBatch
sql::executeBatch
Configuration
⬡ sql_pool: sql::SqlPool
Parameters
↳ var base: string
↳ var batch: string
↳ var bind_limit: u64 = 65535
↳ var bind_symbol: string = "?"
↳ var bindings: Vec<string>
↳ var separator: string = ", "
↳ var stop_on_failure: bool = true
Inputs
⇥ bind: Stream<Map> (std/data/map::Map)
Outputs
↦ affected: Stream<u64>
↦ completed: Block<void>
↦ errors: Stream<string>
↦ failed: Block<void>
↦ finished: Block<void>
Execute a SQL statement in bulk using batched parameter binding.
Collects incoming bind maps into batches of at most bind_limit / len(bindings) rows,
builds one statement per batch using base + repeated batch fragments joined by separator,
and executes it. This is significantly more efficient than execute_each for large inserts.
affected emits the row count per batch.
completed or failed is emitted at the end; finished is always emitted.
ℹ️ bind_limit caps the total number of bind parameters per statement; the default (65535)
matches the maximum supported by most SQL drivers.
graph LR
T("executeBatch()")
B["🟦 🟦 🟦 …"] -->|bind| T
T -->|affected| A["🟨 🟨 …"]
T -->|completed| C["〈🟩〉"]
T -->|failed| F["〈🟥〉"]
T -->|errors| E["🟫 …"]
T -->|finished| FN["〈🟦〉"]
style B fill:#ffff,stroke:#ffff
style A fill:#ffff,stroke:#ffff
style C fill:#ffff,stroke:#ffff
style F fill:#ffff,stroke:#ffff
style E fill:#ffff,stroke:#ffff
style FN fill:#ffff,stroke:#ffff