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

Sql decimal to crystal big decimal #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nfesselet
Copy link

Here is my go at issue #3.

While testing I also found a bug triggered when reading data after a NULL value.

@naqvis
Copy link
Owner

naqvis commented Jul 21, 2023

Nice work 👍 . Handling Nermics is a bit tricky as different vendors and drivers either support or ignore it. SQL Server ignores scale on input params and output columns, Oracle handling of this is totally weired, as it inserts group separators (commas in US, periods in some countries).

Some database vendors supports a money type which also inserts currency symbols. So keeping track of all these different treatments by different vendors is quite difficult and heavy.

I believe BigDecimal is going to blow with these scenarios, best bet would be to manually parse the String and ignore all specials characters, just keep digits, decimal point, negtive signs and then pass it to BigDecimal for conversion.

While testing I also found a bug triggered when reading data after a NULL value.

Can you please be more specific on what error you encountered? and is that re-producible?

Please also run the specs to ensure that code still passing the db api specs.

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