Trait mysql::prelude::BatchQuery
source · pub trait BatchQuery {
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)?;