Skip to content

Commit

Permalink
add autoload extension config api (#214)
Browse files Browse the repository at this point in the history
* add autoload extension config api

* add test
  • Loading branch information
wangfenjin authored Sep 30, 2023
1 parent aca73f7 commit d130b95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ impl Config {
self.config.unwrap_or(std::ptr::null_mut() as ffi::duckdb_config)
}

/// enable autoload extensions
pub fn enable_autoload_extension(mut self, enabled: bool) -> Result<Config> {
self.set("autoinstall_known_extensions", &(enabled as i32).to_string())?;
self.set("autoload_known_extensions", &(enabled as i32).to_string())?;
Ok(self)
}

/// Access mode of the database ([AUTOMATIC], READ_ONLY or READ_WRITE)
pub fn access_mode(mut self, mode: AccessMode) -> Result<Config> {
self.set("access_mode", &mode.to_string())?;
Expand Down Expand Up @@ -174,6 +181,7 @@ mod test {
.default_order(crate::DefaultOrder::Desc)?
.enable_external_access(true)?
.enable_object_cache(false)?
.enable_autoload_extension(true)?
.allow_unsigned_extensions()?
.max_memory("2GB")?
.threads(4)?;
Expand Down

0 comments on commit d130b95

Please sign in to comment.