[][src]Trait mysql::prelude::BinQuery

pub trait BinQuery: Sized {
    pub fn run<'a, 'b, 'c, C>(
        self,
        conn: C
    ) -> Result<QueryResult<'a, 'b, 'c, Binary>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>
; pub fn first<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Option<T>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow
, { ... }
pub fn first_opt<'a, 'b, 'c: 'b, T, C>(
        self,
        conn: C
    ) -> Result<Option<StdResult<T, FromRowError>>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow
, { ... }
pub fn fetch<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Vec<T>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow
, { ... }
pub fn fetch_opt<'a, 'b, 'c: 'b, T, C>(
        self,
        conn: C
    ) -> Result<Vec<StdResult<T, FromRowError>>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow
, { ... }
pub fn fold<'a, 'b, 'c: 'b, T, U, F, C>(
        self,
        conn: C,
        init: U,
        next: F
    ) -> Result<U>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow,
        F: FnMut(U, T) -> U
, { ... }
pub fn fold_opt<'a, 'b, 'c: 'b, T, U, F, C>(
        self,
        conn: C,
        init: U,
        next: F
    ) -> Result<U>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow,
        F: FnMut(U, StdResult<T, FromRowError>) -> U
, { ... }
pub fn map<'a, 'b, 'c: 'b, T, U, F, C>(
        self,
        conn: C,
        map: F
    ) -> Result<Vec<U>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow,
        F: FnMut(T) -> U
, { ... }
pub fn map_opt<'a, 'b, 'c: 'b, T, U, F, C>(
        self,
        conn: C,
        map: F
    ) -> Result<Vec<U>>
    where
        C: TryInto<ConnMut<'a, 'b, 'c>>,
        Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
        T: FromRow,
        F: FnMut(StdResult<T, FromRowError>) -> U
, { ... } }

MySql prepared statement query.

This trait covers the set of exec* methods on the Queryable trait. Please see the corresponding section of the crate level docs for details.

Example:

use mysql::*;
use mysql::prelude::*;
let pool = Pool::new(get_opts())?;

let num: Option<u32> = "SELECT ?"
    .with((42,))
    .first(&pool)?;

assert_eq!(num, Some(42));

Required methods

pub fn run<'a, 'b, 'c, C>(
    self,
    conn: C
) -> Result<QueryResult<'a, 'b, 'c, Binary>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>, 

This methods corresponds to Queryable::exec_iter.

Loading content...

Provided methods

pub fn first<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Option<T>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow

This methods corresponds to Queryable::exec_first.

pub fn first_opt<'a, 'b, 'c: 'b, T, C>(
    self,
    conn: C
) -> Result<Option<StdResult<T, FromRowError>>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow

Same as BinQuery::first but useful when you not sure what your schema is.

pub fn fetch<'a, 'b, 'c: 'b, T, C>(self, conn: C) -> Result<Vec<T>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow

This methods corresponds to Queryable::exec.

pub fn fetch_opt<'a, 'b, 'c: 'b, T, C>(
    self,
    conn: C
) -> Result<Vec<StdResult<T, FromRowError>>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow

Same as BinQuery::fetch but useful when you not sure what your schema is.

pub fn fold<'a, 'b, 'c: 'b, T, U, F, C>(
    self,
    conn: C,
    init: U,
    next: F
) -> Result<U> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow,
    F: FnMut(U, T) -> U, 

This methods corresponds to Queryable::exec_fold.

pub fn fold_opt<'a, 'b, 'c: 'b, T, U, F, C>(
    self,
    conn: C,
    init: U,
    next: F
) -> Result<U> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow,
    F: FnMut(U, StdResult<T, FromRowError>) -> U, 

Same as BinQuery::fold but useful when you not sure what your schema is.

pub fn map<'a, 'b, 'c: 'b, T, U, F, C>(self, conn: C, map: F) -> Result<Vec<U>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow,
    F: FnMut(T) -> U, 

This methods corresponds to Queryable::exec_map.

pub fn map_opt<'a, 'b, 'c: 'b, T, U, F, C>(
    self,
    conn: C,
    map: F
) -> Result<Vec<U>> where
    C: TryInto<ConnMut<'a, 'b, 'c>>,
    Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>,
    T: FromRow,
    F: FnMut(StdResult<T, FromRowError>) -> U, 

Same as BinQuery::map but useful when you not sure what your schema is.

Loading content...

Implementors

impl<Q, P> BinQuery for QueryWithParams<Q, P> where
    Q: AsStatement,
    P: Into<Params>, 
[src]

Loading content...