[−][src]Struct mysql_async::Stmt
Prepared statement.
Methods
impl<T> Stmt<T> where
T: ConnectionLike + Sized + 'static,
[src]
T: ConnectionLike + Sized + 'static,
pub fn id(&self) -> u32
[src]
Returns statement identifier.
pub fn columns(&self) -> &[Column]
[src]
Returns statement columns.
use mysql_async::{consts::{ColumnFlags, ColumnType}, Pool}; use mysql_async::prelude::*; #[tokio::main] async fn main() -> Result<(), mysql_async::error::Error> { let pool = Pool::new(get_opts()); let conn = pool.get_conn().await?; let stmt = conn.prepare("SELECT 'foo', CAST(42 AS UNSIGNED)").await?; let columns = stmt.columns(); assert_eq!(columns.len(), 2); assert_eq!(columns[0].column_type(), ColumnType::MYSQL_TYPE_VAR_STRING); assert!(columns[1].flags().contains(ColumnFlags::UNSIGNED_FLAG)); Ok(()) }
pub fn params(&self) -> &[Column]
[src]
Returns statement parameters.
use mysql_async::{consts::{ColumnFlags, ColumnType}, Pool}; use mysql_async::prelude::*; #[tokio::main] async fn main() -> Result<(), mysql_async::error::Error> { let pool = Pool::new(get_opts()); let conn = pool.get_conn().await?; let stmt = conn.prepare("SELECT ?, ?").await?; assert_eq!(stmt.params().len(), 2); Ok(()) }
pub async fn execute<P>(
self,
params: P
) -> Result<QueryResult<Self, BinaryProtocol>> where
P: Into<Params>,
[src]
self,
params: P
) -> Result<QueryResult<Self, BinaryProtocol>> where
P: Into<Params>,
See Queryable::execute
pub async fn first<P, R>(self, params: P) -> Result<(Self, Option<R>)> where
P: Into<Params> + 'static,
R: FromRow,
[src]
P: Into<Params> + 'static,
R: FromRow,
See Queryable::first
pub async fn batch<I, P>(self, params_iter: I) -> Result<Self> where
I: IntoIterator<Item = P>,
I::IntoIter: Send + 'static,
Params: From<P>,
P: 'static,
[src]
I: IntoIterator<Item = P>,
I::IntoIter: Send + 'static,
Params: From<P>,
P: 'static,
See Queryable::batch
pub async fn close(__arg0: Self) -> Result<T>
[src]
This will close statement (if it's not in the cache) and resolve to a wrapped queryable.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Stmt<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Stmt<T> where
T: Send,
T: Send,
impl<T> Sync for Stmt<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Stmt<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Stmt<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ConnectionLike for T where
T: ConnectionLike,
[src]
T: ConnectionLike,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,