Skip to content
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

Implement DECIMAL type support for mysql #234

Merged
merged 7 commits into from
Apr 10, 2020

Conversation

xiaopengli89
Copy link
Contributor

Implement DECIMAL type support for mysql.

Close #202

@mehcode
Copy link
Member

mehcode commented Apr 7, 2020

Please add integration tests to mysql-types under tests/. See postgres-types for an example of big decimal tests.

Ok(BigDecimal::new(r, scale.unwrap_or(0)))
}
MySqlData::Text(_) => Err(Error::Decode(
"`BigDecimal` can only be decoded from the binary protocol".into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to figure this out unless this is a MySQL limitation. It should probably just be like BigDecimal::from_str I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Text format is supported now, and I simplify the Encode/Decode implementation.

@mehcode
Copy link
Member

mehcode commented Apr 7, 2020

General framework of this looks fine. We do want to support both text and binary formats.

Assigning @abonander to review the details when he gets a chance as he did the big decimal stuff for postgres.

@mehcode
Copy link
Member

mehcode commented Apr 8, 2020

@xiaopengli89 Sorry for not pointing this out but you'll need to add the bigdecimal feature to CI for mysql around here: https://github.com/launchbadge/sqlx/blob/master/.github/workflows/rust.yml#L206

@mehcode mehcode merged commit c40288a into launchbadge:master Apr 10, 2020
@mehcode
Copy link
Member

mehcode commented Apr 10, 2020

Thanks for the work on this. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement NUMERIC support for MySQL
3 participants