pub struct StatementQuery<'a, P> { /* private fields */ }Expand description
an unprepared statement with it’s query params
Certain executor can make use of unprepared statement and offer addtional functionality
§Examples
async fn execute_with_pool(pool: &Pool) {
// connection pool can execute unprepared statement directly where statement preparing
// execution and caching happens internally
let rows = Statement::named("SELECT * FROM user WHERE id = $1", &[Type::INT4])
.bind([9527])
.query(pool)
.await;
}Implementations§
Source§impl<'a, P> StatementQuery<'a, P>
impl<'a, P> StatementQuery<'a, P>
Sourcepub fn into_single_rtt(self) -> StatementSingleRTTQuery<'a, P>
pub fn into_single_rtt(self) -> StatementSingleRTTQuery<'a, P>
transform self to a single use of statement query with given executor
See StatementSingleRTTQuery for explaination
Trait Implementations§
Source§impl<'c, C, P> Execute<&'c C> for StatementQuery<'_, P>where
C: Prepare,
P: AsParams,
impl<'c, C, P> Execute<&'c C> for StatementQuery<'_, P>where
C: Prepare,
P: AsParams,
Source§type ExecuteOutput = ResultFuture<RowAffected>
type ExecuteOutput = ResultFuture<RowAffected>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Ready<Result<RowStreamGuarded<'c, C>, Error>>
type QueryOutput = Ready<Result<RowStreamGuarded<'c, C>, Error>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, cli: &C) -> Self::ExecuteOutput
fn execute(self, cli: &C) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, cli: &'c C) -> Self::QueryOutput
fn query(self, cli: &'c C) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, 's, P> Execute<&'c Pool> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's, P> Execute<&'c Pool> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, pool: &'c Pool) -> Self::QueryOutput
fn query(self, pool: &'c Pool) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, 's, P> Execute<&'c mut PoolConnection<'_>> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's, P> Execute<&'c mut PoolConnection<'_>> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<RowAffected, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<RowAffected, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, conn: &'c mut PoolConnection<'_>) -> Self::ExecuteOutput
fn execute(self, conn: &'c mut PoolConnection<'_>) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, conn: &'c mut PoolConnection<'_>) -> Self::QueryOutput
fn query(self, conn: &'c mut PoolConnection<'_>) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, C, P> ExecuteBlocking<&'c C> for StatementQuery<'_, P>where
C: Prepare,
P: AsParams,
impl<'c, C, P> ExecuteBlocking<&'c C> for StatementQuery<'_, P>where
C: Prepare,
P: AsParams,
type ExecuteOutput = Result<u64, Error>
type QueryOutput = Result<RowStreamGuarded<'c, C>, Error>
fn execute_blocking(self, cli: &C) -> Result<u64, Error>
fn query_blocking(self, cli: &'c C) -> Self::QueryOutput
Auto Trait Implementations§
impl<'a, P> Freeze for StatementQuery<'a, P>where
P: Freeze,
impl<'a, P> RefUnwindSafe for StatementQuery<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for StatementQuery<'a, P>where
P: Send,
impl<'a, P> Sync for StatementQuery<'a, P>where
P: Sync,
impl<'a, P> Unpin for StatementQuery<'a, P>where
P: Unpin,
impl<'a, P> UnwindSafe for StatementQuery<'a, P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more