Skip to content

Commit

Permalink
Fix str compatibility check.
Browse files Browse the repository at this point in the history
  • Loading branch information
alu committed Aug 1, 2023
1 parent bf16b38 commit a977c4f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions sqlx-mysql/src/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ impl PartialEq<MySqlTypeInfo> for MySqlTypeInfo {
== other.flags.contains(ColumnFlags::UNSIGNED);
}

// for string types, check that our charset matches
ColumnType::VarChar
| ColumnType::Blob
| ColumnType::TinyBlob
| ColumnType::MediumBlob
| ColumnType::LongBlob
| ColumnType::String
| ColumnType::VarString
| ColumnType::Enum => {
return self.flags.contains(ColumnFlags::BLOB)
== other.flags.contains(ColumnFlags::BLOB)
&& self.flags.contains(ColumnFlags::BINARY)
== other.flags.contains(ColumnFlags::BINARY)
}

_ => {}
}

Expand Down
3 changes: 2 additions & 1 deletion sqlx-mysql/src/types/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ impl Type<MySql> for str {
| ColumnType::String
| ColumnType::VarString
| ColumnType::Enum
)
) && !ty.flags.contains(ColumnFlags::BLOB)
&& !ty.flags.contains(ColumnFlags::BINARY)
}
}

Expand Down

0 comments on commit a977c4f

Please sign in to comment.