pub trait ConnectionMethods {
    // Required methods
    fn execute(&self, sql: &str) -> Result<()>;
    fn query<'a, 'b, 'c: 'a>(
        &'c self,
        table: &str,
        columns: &'b [Column],
        expr: Option<BoolExpr>,
        limit: Option<i32>,
        offset: Option<i32>,
        sort: Option<&[Order]>
    ) -> Result<RawQueryResult<'a>>;
    fn insert_returning_pk(
        &self,
        table: &str,
        columns: &[Column],
        pkcol: &Column,
        values: &[SqlValRef<'_>]
    ) -> Result<SqlVal>;
    fn insert_only(
        &self,
        table: &str,
        columns: &[Column],
        values: &[SqlValRef<'_>]
    ) -> Result<()>;
    fn insert_or_replace(
        &self,
        table: &str,
        columns: &[Column],
        pkcol: &Column,
        values: &[SqlValRef<'_>]
    ) -> Result<()>;
    fn update(
        &self,
        table: &str,
        pkcol: Column,
        pk: SqlValRef<'_>,
        columns: &[Column],
        values: &[SqlValRef<'_>]
    ) -> Result<()>;
    fn delete_where(&self, table: &str, expr: BoolExpr) -> Result<usize>;
    fn has_table(&self, table: &str) -> Result<bool>;

    // Provided method
    fn delete(&self, table: &str, pkcol: &'static str, pk: SqlVal) -> Result<()> { ... }
}
Expand description

Methods available on a database connection. Most users do not need to call these methods directly and will instead use methods on DataObject or the query! macro. This trait is implemented by both database connections and transactions.

Required Methods§

source

fn execute(&self, sql: &str) -> Result<()>

source

fn query<'a, 'b, 'c: 'a>( &'c self, table: &str, columns: &'b [Column], expr: Option<BoolExpr>, limit: Option<i32>, offset: Option<i32>, sort: Option<&[Order]> ) -> Result<RawQueryResult<'a>>

source

fn insert_returning_pk( &self, table: &str, columns: &[Column], pkcol: &Column, values: &[SqlValRef<'_>] ) -> Result<SqlVal>

source

fn insert_only( &self, table: &str, columns: &[Column], values: &[SqlValRef<'_>] ) -> Result<()>

Like insert_returning_pk but with no return value

source

fn insert_or_replace( &self, table: &str, columns: &[Column], pkcol: &Column, values: &[SqlValRef<'_>] ) -> Result<()>

Insert unless there’s a conflict on the primary key column, in which case update

source

fn update( &self, table: &str, pkcol: Column, pk: SqlValRef<'_>, columns: &[Column], values: &[SqlValRef<'_>] ) -> Result<()>

source

fn delete_where(&self, table: &str, expr: BoolExpr) -> Result<usize>

source

fn has_table(&self, table: &str) -> Result<bool>

Tests if a table exists in the database.

Provided Methods§

source

fn delete(&self, table: &str, pkcol: &'static str, pk: SqlVal) -> Result<()>

Implementors§