mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
Use flags to detect MySQL enums
In some cases the returned value is of `ColumnType::String`, but it has the `ENUM` flag set.
This commit is contained in:
parent
277d0413bc
commit
7a70717944
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user