Skip to content

Commit

Permalink
support bigger blob
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Apr 27, 2022
1 parent 719fce6 commit 8d8f8b7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/backend/mysql/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 8d8f8b7

Please sign in to comment.