Struct libsql::connection::Connection
source · pub struct Connection { /* private fields */ }Expand description
A connection to a libSQL database.
Implementations§
source§impl Connection
impl Connection
sourcepub fn disconnect(&self)
pub fn disconnect(&self)
Disconnect from the database.
sourcepub fn execute<S, P>(&self, sql: S, params: P) -> Result<Option<Rows>>where
S: Into<String>,
P: Into<Params>,
pub fn execute<S, P>(&self, sql: S, params: P) -> Result<Option<Rows>>where S: Into<String>, P: Into<Params>,
Execute the SQL statement synchronously.
If you execute a SQL query statement (e.g. SELECT statement) that
returns rows, then this method returns Some(Rows)on success; otherwise
this method returns None.
This method blocks the thread until the SQL statement is executed.
However, for SQL query statements, the method blocks only until the
first row is available. To fetch all rows, you need to call Rows::next()
consecutively.
sourcepub fn execute_async<S, P>(&self, sql: S, params: P) -> RowsFuture ⓘwhere
S: Into<String>,
P: Into<Params>,
pub fn execute_async<S, P>(&self, sql: S, params: P) -> RowsFuture ⓘwhere S: Into<String>, P: Into<Params>,
Execute the SQL statement synchronously.
This method never blocks the thread until, but instead returns a
RowsFuture object immediately that can be used to deferredly
execute the statement.
Trait Implementations§
impl Send for Connection
Auto Trait Implementations§
impl RefUnwindSafe for Connection
impl !Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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
Mutably borrows from an owned value. Read more