mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
feat: implement Order
message type
This commit is contained in:
parent
9ce596d492
commit
98a0de2cfd
4 changed files with 24 additions and 0 deletions
|
@ -12,6 +12,7 @@ use crate::mssql::protocol::error::Error as ProtocolError;
|
|||
use crate::mssql::protocol::info::Info;
|
||||
use crate::mssql::protocol::login_ack::LoginAck;
|
||||
use crate::mssql::protocol::message::{Message, MessageType};
|
||||
use crate::mssql::protocol::order::Order;
|
||||
use crate::mssql::protocol::packet::{PacketHeader, PacketType, Status};
|
||||
use crate::mssql::protocol::return_status::ReturnStatus;
|
||||
use crate::mssql::protocol::return_value::ReturnValue;
|
||||
|
@ -148,6 +149,7 @@ impl MssqlStream {
|
|||
MessageType::Done => Message::Done(Done::get(buf)?),
|
||||
MessageType::DoneInProc => Message::DoneInProc(Done::get(buf)?),
|
||||
MessageType::DoneProc => Message::DoneProc(Done::get(buf)?),
|
||||
MessageType::Order => Message::Order(Order::get(buf)?),
|
||||
|
||||
MessageType::Error => {
|
||||
let error = ProtocolError::get(buf)?;
|
||||
|
|
|
@ -2,6 +2,7 @@ use bytes::{Buf, Bytes};
|
|||
|
||||
use crate::mssql::protocol::done::Done;
|
||||
use crate::mssql::protocol::login_ack::LoginAck;
|
||||
use crate::mssql::protocol::order::Order;
|
||||
use crate::mssql::protocol::return_status::ReturnStatus;
|
||||
use crate::mssql::protocol::return_value::ReturnValue;
|
||||
use crate::mssql::protocol::row::Row;
|
||||
|
@ -15,6 +16,7 @@ pub(crate) enum Message {
|
|||
Row(Row),
|
||||
ReturnStatus(ReturnStatus),
|
||||
ReturnValue(ReturnValue),
|
||||
Order(Order),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -31,6 +33,7 @@ pub(crate) enum MessageType {
|
|||
ColMetaData,
|
||||
ReturnStatus,
|
||||
ReturnValue,
|
||||
Order,
|
||||
}
|
||||
|
||||
impl MessageType {
|
||||
|
@ -45,6 +48,7 @@ impl MessageType {
|
|||
0xd2 => MessageType::NbcRow,
|
||||
0xe3 => MessageType::EnvChange,
|
||||
0x79 => MessageType::ReturnStatus,
|
||||
0xa9 => MessageType::Order,
|
||||
0xfd => MessageType::Done,
|
||||
0xfe => MessageType::DoneProc,
|
||||
0xff => MessageType::DoneInProc,
|
||||
|
|
|
@ -7,6 +7,7 @@ pub(crate) mod info;
|
|||
pub(crate) mod login;
|
||||
pub(crate) mod login_ack;
|
||||
pub(crate) mod message;
|
||||
pub(crate) mod order;
|
||||
pub(crate) mod packet;
|
||||
pub(crate) mod pre_login;
|
||||
pub(crate) mod return_status;
|
||||
|
|
17
sqlx-core/src/mssql/protocol/order.rs
Normal file
17
sqlx-core/src/mssql/protocol/order.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use bytes::{Buf, Bytes};
|
||||
|
||||
use crate::error::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Order {
|
||||
columns: Bytes,
|
||||
}
|
||||
|
||||
impl Order {
|
||||
pub(crate) fn get(buf: &mut Bytes) -> Result<Self, Error> {
|
||||
let len = buf.get_u16_le();
|
||||
let columns = buf.split_to(len as usize);
|
||||
|
||||
Ok(Self { columns })
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue