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

BigDecimal Precision/Scale Fix #1912

Merged
merged 10 commits into from
Sep 21, 2022
Merged

BigDecimal Precision/Scale Fix #1912

merged 10 commits into from
Sep 21, 2022

Conversation

Jeffery-Wasty
Copy link
Member

For operations with BigDecimal, precision and scale of 38 and 1 respectively (decimal(38,1)) are used, as opposed to the actual values for the object. This leads to loss of accuracy in transactions involving BigDecimal. This changes the param.typeDefinition to match the precision from the BigDecimal object. Four tests to confirm the fix for subtraction, addition, multiplication, and division operations are also present. This fixes issues 1489 and 942.

Parameter.java

  • 535 - 540: Given a BigDecimal object, whose value is not null, and whose precision is larger than the present scale (default 1), assigns param.typeDefinition a precision based on the object, as opposed to the maximum value (38) previously used.

StatementTest.java

  • 1483 - 1657: Tests confirming the fix works for operations involving subtraction, addition, multiplication, and division.

@Jeffery-Wasty Jeffery-Wasty marked this pull request as ready for review September 3, 2022 09:12
@Jeffery-Wasty Jeffery-Wasty added the Under Review Used for pull requests under review label Sep 3, 2022
@Jeffery-Wasty
Copy link
Member Author

I've applied the formatting change with tableName to other similar variables, where the only use case was AbstractSQLGenerator.escapeIdentifier. This can be rolled back if not appropriate for this PR.

@lilgreenbird lilgreenbird moved this from In progress to Under Peer Review in MSSQL JDBC Sep 21, 2022
@Jeffery-Wasty Jeffery-Wasty merged commit 05ef7c0 into main Sep 21, 2022
MSSQL JDBC automation moved this from Under Peer Review to Closed/Merged PRs Sep 21, 2022
@Jeffery-Wasty Jeffery-Wasty deleted the bigDecimalPrecision branch September 21, 2022 20:13
lilgreenbird added a commit that referenced this pull request Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Under Review Used for pull requests under review
Projects
MSSQL JDBC
  
Closed/Merged PRs
3 participants