From 8d8f8b75a7c585413ffcda4e0104fa9124b352ff Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 27 Apr 2022 11:05:11 +0800 Subject: [PATCH] support bigger blob --- src/backend/mysql/table.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend/mysql/table.rs b/src/backend/mysql/table.rs index 9e4546e2b..a0418134c 100644 --- a/src/backend/mysql/table.rs +++ b/src/backend/mysql/table.rs @@ -78,7 +78,19 @@ impl TableBuilder for MysqlQueryBuilder { ColumnType::Date => "date".into(), ColumnType::Interval(_, _) => "unsupported".into(), ColumnType::Binary(length) => match length { - Some(length) => format!("binary({})", length), + Some(length) => { + if *length <= 255 { + format!("binary({})", length) + } else if *length <= 65535 { + //64KiB + "blob".into() + } else if *length <= 16777215 { + //16MiB + "mediumblob".into() + } else { + "longblob".into() //longblob max to 4294967295 4GiB but this limit can be config + } + } None => "blob".into(), }, ColumnType::Boolean => "bool".into(),