pub struct Hematite {
pub connection: Connection,
}Expand description
High-level interface for SQL operations
Fields§
§connection: ConnectionImplementations§
Source§impl Hematite
impl Hematite
Sourcepub fn new_in_memory() -> Result<Self>
pub fn new_in_memory() -> Result<Self>
Create a new database instance with an in-memory database
Sourcepub fn new(database_path: &str) -> Result<Self>
pub fn new(database_path: &str) -> Result<Self>
Create a new database instance with a file-based database
Sourcepub fn execute(&mut self, sql: &str) -> Result<StatementResult>
pub fn execute(&mut self, sql: &str) -> Result<StatementResult>
Execute a SQL statement and return the result
Sourcepub fn query(&mut self, sql: &str) -> Result<ResultSet>
pub fn query(&mut self, sql: &str) -> Result<ResultSet>
Execute a SQL query and return the result set
Sourcepub fn query_row<F, R>(&mut self, sql: &str, f: F) -> Result<Option<R>>
pub fn query_row<F, R>(&mut self, sql: &str, f: F) -> Result<Option<R>>
Execute a SQL statement and return the first row of the result
Sourcepub fn query_one<T>(&mut self, sql: &str) -> Result<Option<T>>where
T: FromValue,
pub fn query_one<T>(&mut self, sql: &str) -> Result<Option<T>>where
T: FromValue,
Execute a SQL statement and return the first column of the first row
pub fn query_as<T>(&mut self, sql: &str) -> Result<Vec<T>>where
T: FromRow,
pub fn query_one_as<T>(&mut self, sql: &str) -> Result<Option<T>>where
T: FromRow,
Sourcepub fn prepare(&mut self, sql: &str) -> Result<PreparedStatement>
pub fn prepare(&mut self, sql: &str) -> Result<PreparedStatement>
Prepare a SQL statement for repeated execution
Sourcepub fn execute_prepared(
&mut self,
stmt: &mut PreparedStatement,
) -> Result<StatementResult>
pub fn execute_prepared( &mut self, stmt: &mut PreparedStatement, ) -> Result<StatementResult>
Execute a prepared statement
pub fn execute_result(&mut self, sql: &str) -> Result<ExecutedStatement>
pub fn iter_script<'a>(&'a mut self, sql: &str) -> Result<ScriptIter<'a>>
Sourcepub fn transaction(&mut self) -> Result<Transaction<'_>>
pub fn transaction(&mut self) -> Result<Transaction<'_>>
Begin a new transaction
pub fn journal_mode(&self) -> Result<JournalMode>
pub fn set_journal_mode(&mut self, journal_mode: JournalMode) -> Result<()>
pub fn checkpoint_wal(&mut self) -> Result<()>
Sourcepub fn execute_batch(&mut self, sql: &str) -> Result<()>
pub fn execute_batch(&mut self, sql: &str) -> Result<()>
Execute multiple SQL statements in sequence
Auto Trait Implementations§
impl Freeze for Hematite
impl RefUnwindSafe for Hematite
impl Send for Hematite
impl Sync for Hematite
impl Unpin for Hematite
impl UnsafeUnpin for Hematite
impl UnwindSafe for Hematite
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