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

Fix for decimal conversion overflow bug #368

Closed
wants to merge 1 commit into from

Conversation

pashokchakravarthi
Copy link

When mapping data from SQL Decimal(38,15) to .net decimal, this driver is throwing Conversion Overflow exception. Bug is already tracked under #95.
This fix tries to alter this functionality, by rounding to nearest allowable decimal value.

When mapping data from SQL Decimal(38,15) to .net decimal, this driver is throwing Conversion Overflow exception. Bug is already tracked under dotnet#95. 
This fix tries to alter this functionality, by rounding to nearest allowable decimal value.
@Wraith2
Copy link
Contributor

Wraith2 commented Jan 7, 2020

This introduces a silent possible loss of precision.

@cheenamalhotra
Copy link
Member

cc @DavoudEshtehari

@DavoudEshtehari
Copy link
Contributor

This solution solves some issues, though, we will miss the precise value.
So, I agree with @Wraith2. We must not implicitly round data.

For instance, 978123.4139989546_6619485619_32681216 will convert to 978123.4139989546_6619485619_33; as you can see we lost 6 last digits and 2 has rounded to 3.

@cheenamalhotra
Copy link
Member

I'll close this PR for now, due to data loss possibilities as captured by @Wraith2 and @DavoudEshtehari

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.

4 participants