Struct mysql_async::QueryResult
[−]
[src]
pub struct QueryResult<T, P>(_);
Result of a query or statement execution.
Methods
impl<T, P> QueryResult<T, P> where
T: ConnectionLike + Sized + 'static,
P: Protocol + 'static,
[src]
T: ConnectionLike + Sized + 'static,
P: Protocol + 'static,
fn last_insert_id(&self) -> Option<u64>
Last insert id (if not 0).
fn affected_rows(&self) -> u64
Value of affected_rows
returned from a server.
fn is_empty(&self) -> bool
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.
fn collect<R>(self) -> BoxFuture<(Self, Vec<R>)> where
R: FromRow + 'static,
R: FromRow + '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.
fn collect_and_drop<R>(self) -> BoxFuture<(T, Vec<R>)> where
R: FromRow + 'static,
R: FromRow + '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.
fn for_each<F>(
self,
fun: F
) -> Either<FutureResult<Self, Error>, ForEach<T, P, F>> where
F: FnMut(Row),
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).
fn for_each_and_drop<F>(
self,
fun: F
) -> AndThen<Either<FutureResult<Self, Error>, ForEach<T, P, F>>, BoxFuture<T>, fn(_: Self) -> BoxFuture<T>> where
F: FnMut(Row),
self,
fun: F
) -> AndThen<Either<FutureResult<Self, Error>, ForEach<T, P, F>>, BoxFuture<T>, fn(_: Self) -> BoxFuture<T>> where
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
.
fn map<F, U>(
self,
fun: F
) -> Either<FutureResult<(Self, Vec<U>), Error>, Map<T, P, F, U>> where
F: FnMut(Row) -> U,
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).
fn map_and_drop<F, U>(
self,
fun: F
) -> AndThen<Either<FutureResult<(Self, Vec<U>), Error>, Map<T, P, F, U>>, (BoxFuture<T>, FutureResult<Vec<U>, Error>), fn(_: (Self, Vec<U>)) -> (BoxFuture<T>, FutureResult<Vec<U>, Error>)> where
F: FnMut(Row) -> U,
self,
fun: F
) -> AndThen<Either<FutureResult<(Self, Vec<U>), Error>, Map<T, P, F, U>>, (BoxFuture<T>, FutureResult<Vec<U>, Error>), fn(_: (Self, Vec<U>)) -> (BoxFuture<T>, FutureResult<Vec<U>, Error>)> where
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.
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,
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).
fn reduce_and_drop<F, U>(
self,
init: U,
fun: F
) -> AndThen<Either<FutureResult<(Self, U), Error>, Reduce<T, P, F, U>>, (BoxFuture<T>, FutureResult<U, Error>), fn(_: (Self, U)) -> (BoxFuture<T>, FutureResult<U, Error>)> where
F: FnMut(U, Row) -> U,
self,
init: U,
fun: F
) -> AndThen<Either<FutureResult<(Self, U), Error>, Reduce<T, P, F, U>>, (BoxFuture<T>, FutureResult<U, Error>), fn(_: (Self, U)) -> (BoxFuture<T>, FutureResult<U, Error>)> 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
.
fn drop_result(self) -> BoxFuture<T>
Returns future that will drop this query result end resolve to a wrapped Queryable
.