pub struct ReplacementScanInfo { /* private fields */ }Expand description
Ergonomic wrapper around duckdb_replacement_scan_info.
Provides safe methods for the common replacement scan operations.
Implementations§
Source§impl ReplacementScanInfo
impl ReplacementScanInfo
Sourcepub const EMPTY_ERROR_PLACEHOLDER: &'static str = "replacement scan reported an error without a message"
pub const EMPTY_ERROR_PLACEHOLDER: &'static str = "replacement scan reported an error without a message"
The message set_error reports in place of an empty
one.
Sourcepub const unsafe fn new(info: duckdb_replacement_scan_info) -> Self
pub const unsafe fn new(info: duckdb_replacement_scan_info) -> Self
Wraps a raw duckdb_replacement_scan_info.
§Safety
info must be a valid duckdb_replacement_scan_info provided by DuckDB.
Sourcepub fn set_function(&self, function_name: &str) -> &Self
pub fn set_function(&self, function_name: &str) -> &Self
Redirects this scan to the named table function.
Call this first to name the table function that will handle the scan,
then use add_varchar_parameter or add_parameter_raw to pass arguments.
If function_name contains an interior null byte it is truncated at that point.
Sourcepub fn add_varchar_parameter(&self, value: &str) -> &Self
pub fn add_varchar_parameter(&self, value: &str) -> &Self
Adds a VARCHAR string parameter to the redirected function call.
This is the most common use case: passing the original file path/name to the underlying table function.
Sourcepub unsafe fn add_parameter_raw(&self, value: duckdb_value) -> &Self
pub unsafe fn add_parameter_raw(&self, value: duckdb_value) -> &Self
Adds a raw duckdb_value parameter to the redirected function call.
Use this when you need to pass non-VARCHAR parameters (INTEGER, BIGINT,
BOOLEAN, etc.) that aren’t covered by add_varchar_parameter.
DuckDB copies the value; the caller still owns value and must destroy
it after this call.
§Safety
value must be a valid duckdb_value created via a duckdb_create_* function.
Sourcepub fn add_i64_parameter(&self, value: i64) -> &Self
pub fn add_i64_parameter(&self, value: i64) -> &Self
Adds a BIGINT (i64) parameter to the redirected function call.
Convenience method that creates a DuckDB BIGINT value, adds it as a
parameter, and destroys the temporary value.
Sourcepub fn add_bool_parameter(&self, value: bool) -> &Self
pub fn add_bool_parameter(&self, value: bool) -> &Self
Adds a BOOLEAN parameter to the redirected function call.
Convenience method that creates a DuckDB BOOLEAN value, adds it as a
parameter, and destroys the temporary value.
Sourcepub fn set_error(&self, message: &str)
pub fn set_error(&self, message: &str)
Reports an error, causing DuckDB to abort this replacement scan attempt.
An interior null byte in message is replaced by ?.
DuckDB only raises the error when the stored message is non-empty, so
an empty message would be silently ignored and the query would fall through
to “table does not exist”. It is replaced with
EMPTY_ERROR_PLACEHOLDER instead.