[MySQL] Rename ty.flag to ty.is_unsigned

This commit is contained in:
Ryan Leckey 2019-12-30 00:32:20 -08:00
parent 3a645a1824
commit e161787952
2 changed files with 10 additions and 4 deletions

View File

@ -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<n> binary parameter value

View File

@ -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,
}
}
}