pub struct DbConfig { /* private fields */ }Expand description
Implementations§
Source§impl DbConfig
impl DbConfig
Sourcepub fn new() -> Result<Self, ExtensionError>
pub fn new() -> Result<Self, ExtensionError>
Creates a new, empty DuckDB configuration object.
§Errors
Returns ExtensionError if DuckDB fails to allocate the config
(which is extremely rare in practice).
Sourcepub fn set(self, name: &str, value: &str) -> Result<Self, ExtensionError>
pub fn set(self, name: &str, value: &str) -> Result<Self, ExtensionError>
Sets a single configuration option.
Common options include "access_mode" ("READ_ONLY" / "READ_WRITE"),
"threads" (number of CPU threads), and "memory_limit" (e.g. "1GB").
Use DbConfig::flag_count / DbConfig::get_flag to enumerate all
available options at runtime.
§Errors
Returns ExtensionError if the option name or value is not recognised
by DuckDB.
§Errors
Returns ExtensionError if name or value contain interior null bytes,
or if DuckDB does not recognise the option.
Sourcepub fn flag_count() -> usize
pub fn flag_count() -> usize
Returns the total number of available configuration flags.
Use this together with get_flag to enumerate all
configuration options that DuckDB accepts.
Sourcepub fn get_flag(index: usize) -> Result<(String, String), ExtensionError>
pub fn get_flag(index: usize) -> Result<(String, String), ExtensionError>
Returns the name and description for the configuration flag at index.
index must be less than flag_count().
§Errors
Returns ExtensionError if index is out of range or DuckDB fails
to retrieve the flag information.
Sourcepub const fn as_raw(&self) -> duckdb_config
pub const fn as_raw(&self) -> duckdb_config
Returns the underlying duckdb_config handle.
Pass this to duckdb_open_ext to open a database with these settings.
The handle remains owned by DbConfig; do not call
duckdb_destroy_config on the returned value.