From 7a707179448a1787f106138f4821ab3fa062db2a Mon Sep 17 00:00:00 2001 From: Julius de Bruijn Date: Mon, 3 Aug 2020 18:20:23 +0200 Subject: [PATCH] Use flags to detect MySQL enums In some cases the returned value is of `ColumnType::String`, but it has the `ENUM` flag set. --- sqlx-core/src/mysql/protocol/text/column.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlx-core/src/mysql/protocol/text/column.rs b/sqlx-core/src/mysql/protocol/text/column.rs index 9c92696e5a..0a539bb1c6 100644 --- a/sqlx-core/src/mysql/protocol/text/column.rs +++ b/sqlx-core/src/mysql/protocol/text/column.rs @@ -167,6 +167,7 @@ impl ColumnType { ) -> &'static str { let is_binary = char_set == 63; let is_unsigned = flags.contains(ColumnFlags::UNSIGNED); + let is_enum = flags.contains(ColumnFlags::ENUM); match self { ColumnType::Tiny if max_size == Some(1) => "BOOLEAN", @@ -196,6 +197,7 @@ impl ColumnType { ColumnType::Json => "JSON", ColumnType::String if is_binary => "BINARY", + ColumnType::String if is_enum => "ENUM", ColumnType::VarChar | ColumnType::VarString if is_binary => "VARBINARY", ColumnType::String => "CHAR",