pub struct TursoConnection { /* private fields */ }Implementations§
Source§impl TursoConnection
impl TursoConnection
pub fn new( config: &TursoDatabaseConfig, connection: Arc<Connection>, ) -> Arc<Self> ⓘ
pub fn new_with_sync_busy( config: &TursoDatabaseConfig, connection: Arc<Connection>, sync_busy: Option<Arc<SyncBusyGate>>, ) -> Arc<Self> ⓘ
Sourcepub fn set_busy_timeout(&self, duration: Duration)
pub fn set_busy_timeout(&self, duration: Duration)
Set busy timeout for the connection
Sourcepub fn interrupt(&self)
pub fn interrupt(&self)
Request interruption of the statement currently running on this connection.
Mirrors sqlite3_interrupt: the in-flight step/execute aborts with an
Interrupt error. Safe to call from another thread. If no statement is
active the request is ignored.
Sourcepub fn set_query_timeout(&self, duration: Duration)
pub fn set_query_timeout(&self, duration: Duration)
Set the maximum wall-clock duration a single statement is allowed to run
before it is interrupted. Duration::ZERO disables the timeout.
Sourcepub fn get_query_timeout(&self) -> Duration
pub fn get_query_timeout(&self) -> Duration
Get the current per-statement query timeout (Duration::ZERO when disabled).
pub fn get_auto_commit(&self) -> bool
pub fn last_insert_rowid(&self) -> i64
pub fn register_external_scalar_function( &self, name: String, argc: i32, deterministic: bool, context: usize, callback: ScalarFunction, context_destructor: Option<ContextDestructor>, value_destructor: Option<ValueDestructor>, ) -> Result<(), TursoError>
pub fn register_external_aggregate_function( &self, name: String, argc: i32, context: usize, init: InitAggFunction, step: StepFunction, finalize: FinalizeFunction, context_destructor: Option<ContextDestructor>, aggregate_destructor: Option<ContextDestructor>, value_destructor: Option<ValueDestructor>, ) -> Result<(), TursoError>
pub fn unregister_external_function(&self, name: &str) -> Result<(), TursoError>
pub fn register_external_collation( &self, name: String, context: usize, callback: ContextCollationFunction, context_destructor: Option<ContextDestructor>, )
pub fn unregister_external_collation(&self, name: &str)
pub fn set_load_extension_enabled(&self, enabled: bool)
pub fn load_extension(&self, path: &str) -> Result<(), TursoError>
Sourcepub fn prepare_single(
&self,
sql: impl AsRef<str>,
) -> Result<Box<TursoStatement>, TursoError>
pub fn prepare_single( &self, sql: impl AsRef<str>, ) -> Result<Box<TursoStatement>, TursoError>
prepares single SQL statement
Sourcepub fn prepare_cached(
&self,
sql: impl AsRef<str>,
) -> Result<Box<TursoStatement>, TursoError>
pub fn prepare_cached( &self, sql: impl AsRef<str>, ) -> Result<Box<TursoStatement>, TursoError>
Prepare a statement from the provided SQL string and cache it for future use.
Sourcepub fn prepare_first(
&self,
sql: impl AsRef<str>,
) -> Result<Option<(Box<TursoStatement>, usize)>, TursoError>
pub fn prepare_first( &self, sql: impl AsRef<str>, ) -> Result<Option<(Box<TursoStatement>, usize)>, TursoError>
prepares first SQL statement from the string and return prepared statement and position after the end of the parsed statement this method can be useful if SDK provides an execute(…) method which run all statements from the provided input in sequence
Sourcepub fn close(&self) -> Result<(), TursoError>
pub fn close(&self) -> Result<(), TursoError>
close the connection preventing any further operations executed over it SAFETY: caller must guarantee that no ongoing operations are running over connection before calling close(…) method
Sourcepub fn cacheflush(&self) -> Result<(), TursoError>
pub fn cacheflush(&self) -> Result<(), TursoError>
low-level method used only by the Rust SDK
Sourcepub fn to_capi(self: Arc<Self>) -> *mut turso_connection_t
pub fn to_capi(self: Arc<Self>) -> *mut turso_connection_t
helper method to get C raw container to the TursoConnection instance this method is used in the capi wrappers
Sourcepub unsafe fn ref_from_capi<'a>(
value: *const turso_connection_t,
) -> Result<&'a Self, TursoError>
pub unsafe fn ref_from_capi<'a>( value: *const turso_connection_t, ) -> Result<&'a Self, TursoError>
helper method to restore TursoConnection ref from C raw container this method is used in the capi wrappers
§Safety
value must be a pointer returned from Self::to_capi method
Sourcepub unsafe fn arc_from_capi(value: *const turso_connection_t) -> Arc<Self> ⓘ
pub unsafe fn arc_from_capi(value: *const turso_connection_t) -> Arc<Self> ⓘ
helper method to restore TursoConnection instance from C raw container this method is used in the capi wrappers
§Safety
value must be a pointer returned from Self::to_capi method
Trait Implementations§
Source§impl Clone for TursoConnection
impl Clone for TursoConnection
Source§fn clone(&self) -> TursoConnection
fn clone(&self) -> TursoConnection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TursoConnection
impl !UnwindSafe for TursoConnection
impl Freeze for TursoConnection
impl Send for TursoConnection
impl Sync for TursoConnection
impl Unpin for TursoConnection
impl UnsafeUnpin for TursoConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more