pub struct CopySinkInfo { /* private fields */ }Expand description
Wrapper around the duckdb_copy_function_sink_info handle provided to a
copy function sink callback.
Implementations§
Source§impl CopySinkInfo
impl CopySinkInfo
Sourcepub const unsafe fn new(info: duckdb_copy_function_sink_info) -> Self
pub const unsafe fn new(info: duckdb_copy_function_sink_info) -> Self
Wraps a raw duckdb_copy_function_sink_info handle.
§Safety
info must be a valid handle passed by DuckDB to a copy function
sink callback.
Sourcepub unsafe fn get_bind_data(&self) -> *mut c_void
pub unsafe fn get_bind_data(&self) -> *mut c_void
Retrieves the bind data pointer set during the bind phase.
§Safety
The returned pointer must be cast back to the original type.
Sourcepub unsafe fn get_extra_info(&self) -> *mut c_void
pub unsafe fn get_extra_info(&self) -> *mut c_void
Retrieves the extra-info pointer previously set on the copy function.
§Safety
The returned pointer is only valid as long as the copy function is
registered and DuckDB has not yet called the destructor.
Sourcepub unsafe fn get_global_state(&self) -> *mut c_void
pub unsafe fn get_global_state(&self) -> *mut c_void
Retrieves the global state pointer set during the global init phase.
§Safety
The returned pointer must be cast back to the original type.
Sourcepub unsafe fn bind_data_ref<T: 'static>(&self) -> Option<&T>
pub unsafe fn bind_data_ref<T: 'static>(&self) -> Option<&T>
Borrows the bind data as a T; see
CopyGlobalInitInfo::bind_data_ref.
§Safety
Sourcepub unsafe fn global_state_ref<T: 'static>(&self) -> Option<&T>
pub unsafe fn global_state_ref<T: 'static>(&self) -> Option<&T>
Borrows the global state set with
CopyGlobalInitInfo::set_global_state_typed as a T; None when
none was set or it holds another type.
§Safety
The global state, if any, was set through set_global_state_typed,
not the raw set_global_state, whose pointer carries no type tag.
Sourcepub unsafe fn extra_info_ref<T: 'static>(&self) -> Option<&T>
pub unsafe fn extra_info_ref<T: 'static>(&self) -> Option<&T>
Borrows the copy function’s extra info as a T; see
CopyBindInfo::extra_info_ref.
§Safety
As for CopyBindInfo::extra_info_ref.
Sourcepub fn set_error(&self, message: &str)
pub fn set_error(&self, message: &str)
Reports a fatal error, causing DuckDB to abort the current query.
An interior null byte in message is replaced by ?, and an empty
message by EMPTY_ERROR_PLACEHOLDER.
Sourcepub unsafe fn get_client_context(&self) -> ClientContext
pub unsafe fn get_client_context(&self) -> ClientContext
Returns the client context for this callback.
§Safety
The inner handle must be valid (requires DuckDB runtime), and the
returned context must not be used after the connection running this
query is closed — see
ClientContext.