-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: (#3387) use collation to determine if string type is compatible #3400
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,3 +1,4 @@ | ||||||
use crate::collation::Collation; | ||||||
use crate::decode::Decode; | ||||||
use crate::encode::{Encode, IsNull}; | ||||||
use crate::error::BoxDynError; | ||||||
|
@@ -12,6 +13,7 @@ impl Type<MySql> for str { | |||||
MySqlTypeInfo { | ||||||
r#type: ColumnType::VarString, // VARCHAR | ||||||
flags: ColumnFlags::empty(), | ||||||
collation: Collation::utf8mb3_bin, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think using CollationType {
Binary,
String
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was one of the pieces I wasn't sure about, what the default should be for some of these. I think you're right, As for changing the type of
This could be handled with that enum, if the value is I think my preference is to keep track of each unique collation here, since it's only a byte, but I'll defer to you and @abonander to decide what makes more sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ @alu (sorry, I'm terrible at remembering to directly @ people in replies here) |
||||||
max_size: None, | ||||||
} | ||||||
} | ||||||
|
@@ -28,7 +30,7 @@ impl Type<MySql> for str { | |||||
| ColumnType::String | ||||||
| ColumnType::VarString | ||||||
| ColumnType::Enum | ||||||
) && !ty.flags.contains(ColumnFlags::BINARY) | ||||||
) && ty.collation != Collation::binary | ||||||
} | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to suggest which of these links we should keep - the original link here was dead when i tried it.