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 NUMERIC support for MySQL #202

Closed
abonander opened this issue Mar 30, 2020 · 0 comments · Fixed by #234
Closed

Implement NUMERIC support for MySQL #202

abonander opened this issue Mar 30, 2020 · 0 comments · Fixed by #234
Labels
E-easy enhancement New feature or request question Further information is requested

Comments

@abonander
Copy link
Collaborator

abonander commented Mar 30, 2020

This is a lot easier than Postgres as MySQL transmits and receives NUMERIC values as decimal strings, so you can just decode the value as String and deal with parsing it later.

I think like PgNumeric, we should have a MySqlNumeric type that's just a newtype around String which implements Decode<MySql>, and then a impl TryFrom<MySqlNumeric> for BigDecimal which is gated on the bigdecimal feature.

In fact, we can probably use Cow<'_, str> in MySqlNumeric instead so we can decode a value without copying/allocation.

I can't figure out why MYSQL_TYPE_DECIMAL and MYSQL_TYPE_NEWDECIMAL both exist as types in the binary protocol but everything I can find just says to use MYSQL_TYPE_NEWDECIMAL. I'm told MariaDB may be different, though.

@abonander abonander added enhancement New feature or request E-easy question Further information is requested labels Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant