From c9197916fb22a3ed888bc2635db6deb2c84bac53 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Sat, 27 Feb 2021 13:53:10 -0800 Subject: [PATCH] fix(mysql): allow reading a bool from any integer type --- sqlx-mysql/src/types/bool.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlx-mysql/src/types/bool.rs b/sqlx-mysql/src/types/bool.rs index 4b860b2a..ec338c40 100644 --- a/sqlx-mysql/src/types/bool.rs +++ b/sqlx-mysql/src/types/bool.rs @@ -18,13 +18,13 @@ impl Type for bool { impl Encode for bool { fn encode(&self, ty: &MySqlTypeInfo, out: &mut MySqlOutput<'_>) -> encode::Result<()> { - >::encode(&(*self as u8), ty, out) + >::encode(&(*self as i128), ty, out) } } impl<'r> Decode<'r, MySql> for bool { fn decode(raw: MySqlRawValue<'r>) -> decode::Result { - Ok(raw.decode::()? != 0) + Ok(raw.decode::()? != 0) } }