pub trait Executor: Send + Sized {
type Driver: Driver;
// Required method
fn run<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Stream<Item = Result<QueryResult>> + Send;
// Provided methods
fn accepts_multiple_statements(&self) -> bool { ... }
fn driver(&self) -> Self::Driver
where Self: Sized { ... }
fn prepare<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Future<Output = Result<Query<Self::Driver>>> + Send { ... }
fn do_prepare(
&mut self,
_sql: String,
) -> impl Future<Output = Result<Query<Self::Driver>>> + Send { ... }
fn fetch<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Stream<Item = Result<Row>> + Send { ... }
fn execute<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Future<Output = Result<RowsAffected>> + Send { ... }
fn append<'a, E, It>(
&mut self,
entities: It,
) -> impl Future<Output = Result<RowsAffected>> + Send
where E: Entity + 'a,
It: IntoIterator<Item = &'a E> + Send,
<It as IntoIterator>::IntoIter: Send { ... }
}Expand description
Async query execution.
Implemented by connections.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn accepts_multiple_statements(&self) -> bool
fn accepts_multiple_statements(&self) -> bool
Checks if the driver supports multiple SQL statements in a single request.
Sourcefn driver(&self) -> Self::Driverwhere
Self: Sized,
fn driver(&self) -> Self::Driverwhere
Self: Sized,
Returns the driver instance associated with this executor.
Sourcefn prepare<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Future<Output = Result<Query<Self::Driver>>> + Send
fn prepare<'s>( &'s mut self, query: impl AsQuery<Self::Driver> + 's, ) -> impl Future<Output = Result<Query<Self::Driver>>> + Send
Prepares a query for execution, returning a handle to the prepared statement.
Sourcefn do_prepare(
&mut self,
_sql: String,
) -> impl Future<Output = Result<Query<Self::Driver>>> + Send
fn do_prepare( &mut self, _sql: String, ) -> impl Future<Output = Result<Query<Self::Driver>>> + Send
Internal hook for implementing prepared statement support.
Sourcefn fetch<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Stream<Item = Result<Row>> + Send
fn fetch<'s>( &'s mut self, query: impl AsQuery<Self::Driver> + 's, ) -> impl Stream<Item = Result<Row>> + Send
Executes a query and streams the resulting rows, ignoring affected counts.
Sourcefn execute<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Future<Output = Result<RowsAffected>> + Send
fn execute<'s>( &'s mut self, query: impl AsQuery<Self::Driver> + 's, ) -> impl Future<Output = Result<RowsAffected>> + Send
Executes a query and returns the total number of affected rows.
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.