From e1617879525d55bab98c6f45637b01e90b3c6f96 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Mon, 30 Dec 2019 00:32:20 -0800 Subject: [PATCH] [MySQL] Rename ty.flag to ty.is_unsigned --- sqlx-core/src/mysql/protocol/com_stmt_execute.rs | 2 +- sqlx-core/src/mysql/types/mod.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sqlx-core/src/mysql/protocol/com_stmt_execute.rs b/sqlx-core/src/mysql/protocol/com_stmt_execute.rs index 56a5fd70..d0f36073 100644 --- a/sqlx-core/src/mysql/protocol/com_stmt_execute.rs +++ b/sqlx-core/src/mysql/protocol/com_stmt_execute.rs @@ -52,7 +52,7 @@ impl Encode for ComStmtExecute<'_> { buf.put_u8(ty.r#type.0); // parameter flag : byte<1> - buf.put_u8(ty.flag); + buf.put_u8(if ty.is_unsigned { 0x80 } else { 0 }); } // byte binary parameter value diff --git a/sqlx-core/src/mysql/types/mod.rs b/sqlx-core/src/mysql/types/mod.rs index fd2a4ad5..c53f0866 100644 --- a/sqlx-core/src/mysql/types/mod.rs +++ b/sqlx-core/src/mysql/types/mod.rs @@ -14,16 +14,22 @@ mod chrono; #[derive(Default, Debug)] pub struct MySqlTypeMetadata { pub(crate) r#type: Type, - pub(crate) flag: u8, // 0 or 0x80 for unsigned + pub(crate) is_unsigned: bool, } impl MySqlTypeMetadata { pub(crate) fn new(r#type: Type) -> Self { - Self { r#type, flag: 0 } + Self { + r#type, + is_unsigned: false, + } } pub(crate) fn unsigned(r#type: Type) -> Self { - Self { r#type, flag: 0x80 } + Self { + r#type, + is_unsigned: true, + } } }