sqlx_core::executor

Trait Execute

Source
pub trait Execute<'q, DB: Database>: Send + Sized {
    // Required methods
    fn sql(&self) -> &'q str;
    fn statement(&self) -> Option<&DB::Statement<'q>>;
    fn take_arguments(
        &mut self,
    ) -> Result<Option<<DB as Database>::Arguments<'q>>, 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) -> &'q str

Gets the SQL that will be executed.

Source

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

Gets the previously cached statement, if available.

Source

fn take_arguments( &mut self, ) -> Result<Option<<DB as Database>::Arguments<'q>>, 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<'q, DB: Database> Execute<'q, DB> for &'q str

Source§

fn sql(&self) -> &'q str

Source§

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

Source§

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

Source§

fn persistent(&self) -> bool

Source§

impl<'q, DB: Database> Execute<'q, DB> for (&'q str, Option<<DB as Database>::Arguments<'q>>)

Source§

fn sql(&self) -> &'q str

Source§

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

Source§

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

Source§

fn persistent(&self) -> bool

Implementors§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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