Skip to main content

ClientContext

Struct ClientContext 

Source
pub struct ClientContext { /* private fields */ }
Expand description

RAII wrapper for a duckdb_client_context.

Provides access to the connection’s catalog, configuration, and file system. Automatically destroyed when dropped.

Implementations§

Source§

impl ClientContext

Source

pub unsafe fn from_connection( con: duckdb_connection, ) -> Result<Self, ExtensionError>

Obtain a client context from a duckdb_connection.

§Errors

Returns ExtensionError if the context cannot be obtained.

§Safety

con must be a valid, open duckdb_connection.

Source

pub const unsafe fn from_raw(ctx: duckdb_client_context) -> Self

Wrap a raw duckdb_client_context handle.

§Safety

ctx must be a valid, non-null duckdb_client_context.

Source

pub const fn as_raw(&self) -> duckdb_client_context

Returns the raw handle.

Source

pub unsafe fn catalog(&self, name: &CStr) -> Option<Catalog>

Retrieves a database catalog by name.

Pass an empty string to get the default catalog. This function can only be called from within an active transaction (e.g. during a registered function callback).

§Safety

Must be called from within an active transaction context.

Source

pub fn config_option(&self, name: &CStr) -> Option<String>

Retrieves a configuration option value by name.

Returns the value as a string, or None if the option does not exist.

Source

pub fn connection_id(&self) -> u64

Returns the connection ID associated with this client context.

Trait Implementations§

Source§

impl Drop for ClientContext

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.