[][src]Struct mysql::QueryResult

pub struct QueryResult<'a> { /* fields omitted */ }

Mysql result set for text and binary protocols.

If you want to get rows from QueryResult you should rely on implementation of Iterator over MyResult<Row> on QueryResult.

Row is the current row representation. To get something useful from Row you should rely on FromRow trait implemented for tuples of FromValue implementors up to arity 12, or on FromValue trait for rows with higher arity.

let mut conn = pool.get_conn().unwrap();

for row in conn.prep_exec("SELECT ?, ?", (42, 2.5)).unwrap() {
    let (a, b) = from_row(row.unwrap());
    assert_eq!((a, b), (42u8, 2.5_f32));
}

For more info on how to work with values please look at Value documentation.

Methods

impl<'a> QueryResult<'a>[src]

pub fn affected_rows(&self) -> u64[src]

Returns OkPacket's affected rows.

pub fn last_insert_id(&self) -> u64[src]

Returns OkPacket's last insert id.

pub fn warnings(&self) -> u16[src]

Returns OkPacket's warnings count.

pub fn info(&self) -> Vec<u8>[src]

Returns OkPacket's info.

pub fn column_index<T: AsRef<str>>(&self, name: T) -> Option<usize>[src]

Returns index of a QueryResult's column by name.

pub fn column_indexes(&self) -> HashMap<String, usize, BldHshrDflt<FnvHasher>>[src]

Returns HashMap which maps column names to column indexes.

pub fn columns_ref(&self) -> &[Column][src]

Returns a slice of a Columns which represents QueryResult's columns if any.

pub fn more_results_exists(&self) -> bool[src]

This predicate will help you to consume multiple result sets.

Note

Note that it'll also return true for unconsumed singe-result set.

Example

This example is not tested
conn.query(r#"
           CREATE PROCEDURE multi() BEGIN
               SELECT 1;
               SELECT 2;
           END
           "#);
let mut result = conn.query("CALL multi()").unwrap();
while result.more_results_exists() {
    for x in result.by_ref() {
        // On first iteration of `while` you will get result set from
        // SELECT 1 and from SELECT 2 on second.
    }
}

pub fn consumed(&self) -> bool[src]

Returns true if current result set is consumed.

See also QueryResult::more_results_exists.

Trait Implementations

impl<'a> Drop for QueryResult<'a>[src]

impl<'a> Iterator for QueryResult<'a>[src]

type Item = MyResult<Row>

The type of the elements being iterated over.

impl<'a> Debug for QueryResult<'a>[src]

Auto Trait Implementations

impl<'a> Send for QueryResult<'a>

impl<'a> Sync for QueryResult<'a>

impl<'a> Unpin for QueryResult<'a>

impl<'a> !UnwindSafe for QueryResult<'a>

impl<'a> !RefUnwindSafe for QueryResult<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self