pub trait SqlConnection {
Show 13 methods
// Required methods
fn select(
&self,
table: &str,
columns: &[String],
where_clause: Option<&Expr>,
order_by: &[OrderByItem],
limit: Option<usize>,
offset: Option<usize>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>;
fn insert(
&mut self,
table: &str,
columns: Option<&[String]>,
rows: &[Vec<Expr>],
on_conflict: Option<&OnConflict>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>;
fn update(
&mut self,
table: &str,
assignments: &[Assignment],
where_clause: Option<&Expr>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>;
fn delete(
&mut self,
table: &str,
where_clause: Option<&Expr>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>;
fn create_table(
&mut self,
stmt: &CreateTableStmt,
) -> SqlResult<ExecutionResult>;
fn drop_table(&mut self, stmt: &DropTableStmt) -> SqlResult<ExecutionResult>;
fn create_index(
&mut self,
stmt: &CreateIndexStmt,
) -> SqlResult<ExecutionResult>;
fn drop_index(&mut self, stmt: &DropIndexStmt) -> SqlResult<ExecutionResult>;
fn begin(&mut self, stmt: &BeginStmt) -> SqlResult<ExecutionResult>;
fn commit(&mut self) -> SqlResult<ExecutionResult>;
fn rollback(
&mut self,
savepoint: Option<&str>,
) -> SqlResult<ExecutionResult>;
fn table_exists(&self, table: &str) -> SqlResult<bool>;
fn index_exists(&self, index: &str) -> SqlResult<bool>;
}Expand description
Storage connection trait for executing SQL against actual storage
Implementations of this trait provide the bridge between parsed SQL and the underlying storage engine.
Required Methods§
Sourcefn select(
&self,
table: &str,
columns: &[String],
where_clause: Option<&Expr>,
order_by: &[OrderByItem],
limit: Option<usize>,
offset: Option<usize>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>
fn select( &self, table: &str, columns: &[String], where_clause: Option<&Expr>, order_by: &[OrderByItem], limit: Option<usize>, offset: Option<usize>, params: &[SochValue], ) -> SqlResult<ExecutionResult>
Execute a SELECT query
Sourcefn insert(
&mut self,
table: &str,
columns: Option<&[String]>,
rows: &[Vec<Expr>],
on_conflict: Option<&OnConflict>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>
fn insert( &mut self, table: &str, columns: Option<&[String]>, rows: &[Vec<Expr>], on_conflict: Option<&OnConflict>, params: &[SochValue], ) -> SqlResult<ExecutionResult>
Execute an INSERT
Sourcefn update(
&mut self,
table: &str,
assignments: &[Assignment],
where_clause: Option<&Expr>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>
fn update( &mut self, table: &str, assignments: &[Assignment], where_clause: Option<&Expr>, params: &[SochValue], ) -> SqlResult<ExecutionResult>
Execute an UPDATE
Sourcefn delete(
&mut self,
table: &str,
where_clause: Option<&Expr>,
params: &[SochValue],
) -> SqlResult<ExecutionResult>
fn delete( &mut self, table: &str, where_clause: Option<&Expr>, params: &[SochValue], ) -> SqlResult<ExecutionResult>
Execute a DELETE
Sourcefn create_table(&mut self, stmt: &CreateTableStmt) -> SqlResult<ExecutionResult>
fn create_table(&mut self, stmt: &CreateTableStmt) -> SqlResult<ExecutionResult>
Create a table
Sourcefn drop_table(&mut self, stmt: &DropTableStmt) -> SqlResult<ExecutionResult>
fn drop_table(&mut self, stmt: &DropTableStmt) -> SqlResult<ExecutionResult>
Drop a table
Sourcefn create_index(&mut self, stmt: &CreateIndexStmt) -> SqlResult<ExecutionResult>
fn create_index(&mut self, stmt: &CreateIndexStmt) -> SqlResult<ExecutionResult>
Create an index
Sourcefn drop_index(&mut self, stmt: &DropIndexStmt) -> SqlResult<ExecutionResult>
fn drop_index(&mut self, stmt: &DropIndexStmt) -> SqlResult<ExecutionResult>
Drop an index
Sourcefn begin(&mut self, stmt: &BeginStmt) -> SqlResult<ExecutionResult>
fn begin(&mut self, stmt: &BeginStmt) -> SqlResult<ExecutionResult>
Begin transaction
Sourcefn commit(&mut self) -> SqlResult<ExecutionResult>
fn commit(&mut self) -> SqlResult<ExecutionResult>
Commit transaction
Sourcefn rollback(&mut self, savepoint: Option<&str>) -> SqlResult<ExecutionResult>
fn rollback(&mut self, savepoint: Option<&str>) -> SqlResult<ExecutionResult>
Rollback transaction
Sourcefn table_exists(&self, table: &str) -> SqlResult<bool>
fn table_exists(&self, table: &str) -> SqlResult<bool>
Check if table exists
Sourcefn index_exists(&self, index: &str) -> SqlResult<bool>
fn index_exists(&self, index: &str) -> SqlResult<bool>
Check if index exists