sqlx/sqlx-mysql/src/raw_statement.rs
Ryan Leckey 7db850da71
feat(mysql): thread E: Execute through the executor
+ handle normal errors separate from unexpected errors, an unexpected
   error causes the connection to close (in which case, if this was
   behind a pool, the pool would not allow this connection to be
   acquired again)
2021-02-18 23:46:07 -08:00

24 lines
545 B
Rust

use crate::protocol::PrepareOk;
use crate::{MySqlColumn, MySqlTypeInfo};
#[derive(Debug)]
pub(crate) struct RawStatement {
id: u32,
pub(crate) columns: Vec<MySqlColumn>,
pub(crate) parameters: Vec<MySqlTypeInfo>,
}
impl RawStatement {
pub(crate) fn new(ok: &PrepareOk) -> Self {
Self {
id: ok.statement_id,
columns: Vec::with_capacity(ok.columns.into()),
parameters: Vec::with_capacity(ok.params.into()),
}
}
pub(crate) fn id(&self) -> u32 {
self.id
}
}