Trait BatchQuery

Source
pub trait BatchQuery {
    // Required method
    fn batch<'a, 'b, 'c: 'b, C>(self, conn: C) -> Result<()>
       where C: TryInto<ConnMut<'a, 'b, 'c>>,
             Error: From<<C as TryInto<ConnMut<'a, 'b, 'c>>>::Error>;
}
Expand description

Helper trait for batch statement execution.

This trait covers the Queryable::exec_batch method. Please see the corresponding section of the crate level docs for details.

Example:

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

// This will prepare `DO ?` and execute `DO 0`, `DO 1`, `DO 2` and so on.
"DO ?"
    .with((0..10).map(|x| (x,)))
    .batch(&pool)?;

Required Methods§

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Q, I, P> BatchQuery for QueryWithParams<Q, I>
where Q: AsStatement, I: IntoIterator<Item = P>, P: Into<Params>,