Skip to content

Conversation

@c5soft
Copy link

@c5soft c5soft commented Jun 5, 2025

In MSSQL, the MONEY and SMALLMONEY types are specialized variants of DECIMAL with fixed decimal precision:
MONEY is equivalent to DECIMAL(19,4) (19 total digits with 4 decimal places)
SMALLMONEY corresponds to DECIMAL(10,4) (10 total digits with 4 decimal places)
When mapping these to Rust, the most suitable data types are rust_decimal or bigdecimal to preserve exact precision without floating-point errors.
In financial software development, the MONEY data type is widely used. Therefore, we strongly recommend adding support for the MONEY type in sqlx-oldapi.
This PR extracts shared codes into decimal_tools.rs included with testing code.

Copy link
Collaborator

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

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

I added tests and fixed a bug with decoding large values. When the tests pass, we can merge

@lovasoa lovasoa merged commit 6d22180 into sqlpage:main Jun 5, 2025
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.

2 participants