[−][src]Struct mysql_async::QueryResult
Result of a query or statement execution.
Methods
impl<T, P> QueryResult<T, P> where
P: Protocol,
P: Send + 'static,
T: ConnectionLike,
T: Sized + Send + 'static,
[src]
P: Protocol,
P: Send + 'static,
T: ConnectionLike,
T: Sized + Send + 'static,
pub fn last_insert_id(&self) -> Option<u64>
[src]
Last insert id (if not 0).
pub fn affected_rows(&self) -> u64
[src]
Value of affected_rows
returned from a server.
pub fn is_empty(&self) -> bool
[src]
true
if there is no more rows nor result sets in this query.
One could use it to check if there is more than one result set in this query result.
pub fn collect<R>(self) -> impl MyFuture<(Self, Vec<R>)> where
R: FromRow,
R: Send + 'static,
[src]
R: FromRow,
R: Send + 'static,
Returns future that collects result set of this query result.
It is parametrized by R
and internally calls R::from_row(Row)
on each row.
It will stop collecting on result set boundary. This means that you should call collect
as many times as result sets in your query result. For example query
SELECT 'foo'; SELECT 'foo', 'bar';
will produce QueryResult
with two result sets in it.
One can use QueryResult::is_empty
to make sure that there is no more result sets.
Panic
It'll panic if any row isn't convertible to R
(i.e. programmer error or unknown schema).
- In case of programmer error see
FromRow
docs; - In case of unknown schema use
QueryResult::try_collect
.
pub fn try_collect<R>(
self
) -> impl MyFuture<(Self, Vec<StdResult<R, FromRowError>>)> where
R: FromRow,
R: Send + 'static,
[src]
self
) -> impl MyFuture<(Self, Vec<StdResult<R, FromRowError>>)> where
R: FromRow,
R: Send + 'static,
Returns future that collects result set of this query.
It works the same way as QueryResult::collect
but won't panic
if row isn't convertible to R
.
pub fn collect_and_drop<R>(self) -> impl MyFuture<(T, Vec<R>)> where
R: FromRow,
R: Send + 'static,
[src]
R: FromRow,
R: Send + 'static,
Returns future that collects result set of a query result and drops everything else.
It will resolve to a pair of wrapped Queryable
and collected result set.
Panic
It'll panic if any row isn't convertible to R
(i.e. programmer error or unknown schema).
- In case of programmer error see
FromRow
docs; - In case of unknown schema use
QueryResult::try_collect
.
pub fn try_collect_and_drop<R>(
self
) -> impl MyFuture<(T, Vec<StdResult<R, FromRowError>>)> where
R: FromRow,
R: Send + 'static,
[src]
self
) -> impl MyFuture<(T, Vec<StdResult<R, FromRowError>>)> where
R: FromRow,
R: Send + 'static,
Returns future that collects result set of a query result and drops everything else.
It will resolve to a pair of wrapped Queryable
and collected result set.
It works the same way as QueryResult::collect_and_drop
but won't panic
if row isn't convertible to R
.
pub fn for_each<F>(
self,
fun: F
) -> Either<FutureResult<Self, Error>, ForEach<T, P, F>> where
F: FnMut(Row),
[src]
self,
fun: F
) -> Either<FutureResult<Self, Error>, ForEach<T, P, F>> where
F: FnMut(Row),
Returns future that will execute fun
on every row of current result set.
It will stop on result set boundary (see QueryResult::collect
docs).
pub fn for_each_and_drop<F>(self, fun: F) -> ForEachAndDrop<Self, T, P, F> where
F: FnMut(Row),
[src]
F: FnMut(Row),
Returns future that will execute fun
on every row of current result set and drop
everything else. It will resolve to a wrapped Queryable
.
pub fn map<F, U>(
self,
fun: F
) -> Either<FutureResult<(Self, Vec<U>), Error>, Map<T, P, F, U>> where
F: FnMut(Row) -> U,
[src]
self,
fun: F
) -> Either<FutureResult<(Self, Vec<U>), Error>, Map<T, P, F, U>> where
F: FnMut(Row) -> U,
Returns future that will map every row of current result set to U
using fun
.
It will stop on result set boundary (see QueryResult::collect
docs).
pub fn map_and_drop<F, U>(self, fun: F) -> MapAndDrop<Self, T, P, F, U> where
F: FnMut(Row) -> U,
[src]
F: FnMut(Row) -> U,
Returns future that will map every row of current result set to U
using fun
and drop
everything else. It will resolve to a pair of wrapped Queryable
and mapped result set.
pub fn reduce<F, U>(
self,
init: U,
fun: F
) -> Either<FutureResult<(Self, U), Error>, Reduce<T, P, F, U>> where
F: FnMut(U, Row) -> U,
[src]
self,
init: U,
fun: F
) -> Either<FutureResult<(Self, U), Error>, Reduce<T, P, F, U>> where
F: FnMut(U, Row) -> U,
Returns future that will reduce rows of current result set to U
using fun
.
It will stop on result set boundary (see QueryResult::collect
docs).
pub fn reduce_and_drop<F, U>(
self,
init: U,
fun: F
) -> ReduceAndDrop<Self, T, P, F, U> where
F: FnMut(U, Row) -> U,
[src]
self,
init: U,
fun: F
) -> ReduceAndDrop<Self, T, P, F, U> where
F: FnMut(U, Row) -> U,
Returns future that will reduce rows of current result set to U
using fun
and drop
everything else. It will resolve to a pair of wrapped Queryable
and U
.
pub fn drop_result(self) -> impl MyFuture<T>
[src]
Returns future that will drop this query result end resolve to a wrapped Queryable
.
pub fn columns_ref(&self) -> &[Column]
[src]
Returns reference to columns in this query result.
pub fn columns(&self) -> Option<Arc<Vec<Column>>>
[src]
Returns copy of columns of this query result.
Auto Trait Implementations
impl<T, P> Unpin for QueryResult<T, P> where
P: Unpin,
T: Unpin,
P: Unpin,
T: Unpin,
impl<T, P> Send for QueryResult<T, P> where
P: Send,
T: Send,
P: Send,
T: Send,
impl<T, P> Sync for QueryResult<T, P> where
P: Sync,
T: Sync,
P: Sync,
T: Sync,
impl<T, P> RefUnwindSafe for QueryResult<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> UnwindSafe for QueryResult<T, P> where
P: UnwindSafe,
T: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> ConnectionLike for T where
T: ConnectionLike,
[src]
T: ConnectionLike,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> Same<T> for T
type Output = T
Should always be Self