pub struct SessionMut<'a> { /* private fields */ }Expand description
Mutable session for executing prepared statements that modify data
Use this session type when you need to execute INSERT, UPDATE, or DELETE statements in addition to SELECT.
Implementations§
Source§impl<'a> SessionMut<'a>
impl<'a> SessionMut<'a>
Sourcepub fn new(db: &'a mut Database) -> Self
pub fn new(db: &'a mut Database) -> Self
Create a new mutable session with a reference to the database
Sourcepub fn with_cache_size(db: &'a mut Database, cache_size: usize) -> Self
pub fn with_cache_size(db: &'a mut Database, cache_size: usize) -> Self
Create a new mutable session with a custom cache size
Create a new mutable session with a shared cache
Sourcepub fn database_mut(&mut self) -> &mut Database
pub fn database_mut(&mut self) -> &mut Database
Get the underlying database reference (mutable)
Sourcepub fn cache(&self) -> &PreparedStatementCache
pub fn cache(&self) -> &PreparedStatementCache
Get the prepared statement cache
Get the shared cache Arc
Sourcepub fn prepare(&self, sql: &str) -> Result<Arc<PreparedStatement>, SessionError>
pub fn prepare(&self, sql: &str) -> Result<Arc<PreparedStatement>, SessionError>
Prepare a SQL statement for execution
Sourcepub fn prepare_arena(
&self,
sql: &str,
) -> Result<Arc<ArenaPreparedStatement>, ArenaParseError>
pub fn prepare_arena( &self, sql: &str, ) -> Result<Arc<ArenaPreparedStatement>, ArenaParseError>
Prepare a SQL SELECT statement using arena allocation
See Session::prepare_arena for details.
Sourcepub fn execute_prepared(
&self,
stmt: &PreparedStatement,
params: &[SqlValue],
) -> Result<PreparedExecutionResult, SessionError>
pub fn execute_prepared( &self, stmt: &PreparedStatement, params: &[SqlValue], ) -> Result<PreparedExecutionResult, SessionError>
Execute a prepared statement with parameters (read-only)
Use this for SELECT queries.
Sourcepub fn execute_prepared_mut(
&mut self,
stmt: &PreparedStatement,
params: &[SqlValue],
) -> Result<PreparedExecutionResult, SessionError>
pub fn execute_prepared_mut( &mut self, stmt: &PreparedStatement, params: &[SqlValue], ) -> Result<PreparedExecutionResult, SessionError>
Execute a prepared statement with parameters (read-write)
Use this for INSERT, UPDATE, DELETE statements.
Auto Trait Implementations§
impl<'a> Freeze for SessionMut<'a>
impl<'a> !RefUnwindSafe for SessionMut<'a>
impl<'a> Send for SessionMut<'a>
impl<'a> Sync for SessionMut<'a>
impl<'a> Unpin for SessionMut<'a>
impl<'a> !UnwindSafe for SessionMut<'a>
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
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