-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add DataType::Char and add LEN to Describe
#174
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
Conversation
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.
select * from t;
ERROR: Unsupported Datatype CHARYou need add LogicalType::Char to into_pg_type method
| // https://dev.mysql.com/doc/refman/8.0/en/char.html#:~:text=If%20a%20given%20value%20is%20stored%20into%20the%20CHAR(4)%20and%20VARCHAR(4)%20columns%2C%20the%20values%20retrieved%20from%20the%20columns%20are%20not%20always%20the%20same%20because%20trailing%20spaces%20are%20removed%20from%20CHAR%20columns%20upon%20retrieval.%20The%20following%20example%20illustrates%20this%20difference%3A | ||
| let value = (!bytes.is_empty()).then(|| { | ||
| let last_non_zero_index = match bytes.iter().rposition(|&x| x != b' ') { | ||
| Some(index) => index + 1, | ||
| None => 0, | ||
| }; | ||
| String::from_utf8(bytes[0..last_non_zero_index].to_owned()).unwrap() | ||
| }); |
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.
maybe use trim_end()
String::from_utf8(bytes.to_owned()).unwrap().trim_end();and the link is too long 😂
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.
I tried it and it will make ' foo ' become 'foo', but it should be ' foo' in mysql
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.
trim_end only remove trailing whitespace. You might used trim().
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.
trim_endonly remove trailing whitespace. You might usedtrim().
oh, you are right, but I found that trim_end() returns &str, which may cause String to be copied again.
What problem does this PR solve?
on mysql
Issue link: #130
Code changes
Check List
Tests
Side effects
Note for reviewer