Treatment execute

sql::execute


Configuration

⬡ sql_pool: sql::SqlPool

Parameters

↳ var bind_symbol: string = "?"
↳ var bindings: Vec<string>
↳ var sql: string

Inputs

⇥ bind: Block<Map> (std/data/map::Map)

Outputs

↦ affected: Block<u64>
↦ completed: Block<void>
↦ error: Block<string>
↦ failed: Block<void>
↦ finished: Block<void>


Execute a parameterised SQL statement with a single binding map.

bind supplies the parameter values as a Map; bindings lists the keys to extract in order. bind_symbol is the placeholder token in sql (default "?"; for PostgreSQL the treatment automatically converts it to $1, $2, …).

completed and affected are emitted on success; failed and error on failure. finished is always emitted.

graph LR
     T("execute()")
     B["〈🟦〉"] -->|bind| T
     T -->|completed| C["〈🟩〉"]
     T -->|affected| A["〈🟨〉"]
     T -->|failed| F["〈🟥〉"]
     T -->|error| E["〈🟫〉"]
     T -->|finished| FN["〈🟦〉"]
     style B fill:#ffff,stroke:#ffff
     style C fill:#ffff,stroke:#ffff
     style A fill:#ffff,stroke:#ffff
     style F fill:#ffff,stroke:#ffff
     style E fill:#ffff,stroke:#ffff
     style FN fill:#ffff,stroke:#ffff