macro_rules! table_bind_callback {
($name:ident, |$info:ident| $body:block) => { ... };
}Expand description
Generates a panic-safe unsafe extern "C" table function bind callback.
Emits unsafe extern "C" fn $name(info: duckdb_bind_info). A panic is
reported through duckdb_bind_set_error, which fails the query during
planning rather than aborting the process.
Table functions only. duckdb_bind_set_error casts its argument to the
table function’s info struct, which is much larger than a scalar
function’s: used on a scalar function, it wrote past the scalar bind info
(SIGSEGV in testing). A scalar callback takes a
RawScalarBindInfo (feature duckdb-1-5), so the compiler
refuses this macro’s output there. Use scalar_bind_callback! (feature
duckdb-1-5) for scalar functions.
§Example
quack_rs::table_bind_callback!(my_bind, |info| {
let bind = unsafe { quack_rs::table::BindInfo::new(info) };
bind.add_result_column("n", quack_rs::types::TypeId::BigInt);
});