Skip to main content
DuckDB supports named parameters written $name. Bind them with execute_with_named, passing (name, value) pairs. Binding is by name, so the order of the pairs is irrelevant.

execute_with_named

execute_with_named(sql, binds: &mut [(&str, &mut dyn AppendAble)]) -> Result<DuckResult>.
The value type is the same &mut dyn AppendAble used by positional binding — every DuckValue and the primitive Rust types qualify.
Give the name without the leading $: use "id" to bind $id.

Unknown names are reported

A name that is not a parameter of the SQL is not silently ignored:
See Error::InvalidParameterName. An interior NUL in a name is caught as Error::NulError.

See also