Execute

Trait Execute 

Source
pub trait Execute<'q, DB: Database>: Send + Sized {
    // Required methods
    fn sql(self) -> SqlStr;
    fn statement(&self) -> Option<&DB::Statement>;
    fn take_arguments(
        &mut self,
    ) -> Result<Option<<DB as Database>::Arguments>, BoxDynError>;
    fn persistent(&self) -> bool;
}
Expand description

A type that may be executed against a database connection.

Implemented for the following:

Required Methods§

Source

fn sql(self) -> SqlStr

Gets the SQL that will be executed.

Source

fn statement(&self) -> Option<&DB::Statement>

Gets the previously cached statement, if available.

Source

fn take_arguments( &mut self, ) -> Result<Option<<DB as Database>::Arguments>, BoxDynError>

Returns the arguments to be bound against the query string.

Returning Ok(None) for Arguments indicates to use a “simple” query protocol and to not prepare the query. Returning Ok(Some(Default::default())) is an empty arguments object that will be prepared (and cached) before execution.

Returns Err if encoding any of the arguments failed.

Source

fn persistent(&self) -> bool

Returns true if the statement should be cached.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<DB: Database, T> Execute<'_, DB> for (T, Option<<DB as Database>::Arguments>)
where T: SqlSafeStr + Send,

Implementors§

Source§

impl<'q, DB, A> Execute<'q, DB> for Query<'q, DB, A>
where DB: Database, A: Send + IntoArguments<DB>,

Source§

impl<'q, DB, F: Send, A> Execute<'q, DB> for Map<'q, DB, F, A>
where DB: Database, A: IntoArguments<DB> + Send,

Source§

impl<'q, DB, O: Send, A> Execute<'q, DB> for QueryAs<'q, DB, O, A>
where DB: Database, A: 'q + IntoArguments<DB> + Send,

Source§

impl<'q, DB: Database, O: Send, A> Execute<'q, DB> for QueryScalar<'q, DB, O, A>
where A: 'q + IntoArguments<DB> + Send,

Source§

impl<DB: Database> Execute<'_, DB> for RawSql

Source§

impl<DB: Database, T> Execute<'_, DB> for T
where T: SqlSafeStr + Send,