Struct mysql::conn::pool::MyPooledConn [] [src]

pub struct MyPooledConn {
    // some fields omitted
}

Pooled mysql connection which will return to the pool at the end of its lifetime.

You should prefer using prepare instead of query where possible because of speed and security. query is a part of mysql text protocol, so you will always receive Value::Bytes as a result.

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

conn.query("SELECT 42").map(|mut result| {
    assert_eq!(result.next().unwrap().unwrap(), vec![Value::Bytes(b"42".to_vec())]);
});
conn.prepare("SELECT 42").map(|mut stmt| {
    let mut result = stmt.execute(&[]).unwrap();
    assert_eq!(result.next().unwrap().unwrap(), vec![Value::Int(42)]);
});

For more info on how to work with query results please look at QueryResult documentation.

Methods

impl MyPooledConn

fn query<'a, T: AsRef<str> + 'a>(&'a mut self, query: T) -> MyResult<QueryResult<'a>>

Redirects to MyConn#query.

fn prepare<'a, T: AsRef<str> + 'a>(&'a mut self, query: T) -> MyResult<Stmt<'a>>

Redirects to MyConn#prepare.

fn start_transaction<'a>(&'a mut self, consistent_snapshot: bool, isolation_level: Option<IsolationLevel>, readonly: Option<bool>) -> MyResult<Transaction<'a>>

fn as_mut<'a>(&'a mut self) -> &'a mut MyConn

Gives mutable reference to the wrapped MyConn.

fn as_ref<'a>(&'a self) -> &'a MyConn

Gives reference to the wrapped MyConn.

fn unwrap(self) -> MyConn

Unwraps wrapped MyConn.

Trait Implementations

impl Drop for MyPooledConn

fn drop(&mut self)

Derived Implementations

impl Debug for MyPooledConn

fn fmt(&self, __arg_0: &mut Formatter) -> Result