| 1 | use crate::io::ProtocolEncode; |
| 2 | use crate::protocol::Capabilities; |
| 3 | |
| 4 | // https://dev.mysql.com/doc/internals/en/com-stmt-prepare.html#packet-COM_STMT_PREPARE |
| 5 | |
| 6 | pub struct Prepare<'a> { |
| 7 | pub query: &'a str, |
| 8 | } |
| 9 | |
| 10 | impl ProtocolEncode<'_, Capabilities> for Prepare<'_> { |
| 11 | fn encode_with(&self, buf: &mut Vec<u8>, _: Capabilities) -> Result<(), crate::Error> { |
| 12 | buf.push(0x16); // COM_STMT_PREPARE |
| 13 | buf.extend(self.query.as_bytes()); |
| 14 | Ok(()) |
| 15 | } |
| 16 | } |