-
Notifications
You must be signed in to change notification settings - Fork 437
Stored procedure call returns wrong BigDecimal scale and integrated Mockito Dependency into JDBC Driver Codebase. #2582
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run ADO tests with this branch
/azp run public-mssql-jdbc.windows |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run public-mssql-jdbc.linux |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run CI-MacOS |
Azure Pipelines successfully started running 1 pipeline(s). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2582 +/- ##
============================================
+ Coverage 51.35% 51.37% +0.01%
- Complexity 3972 3975 +3
============================================
Files 147 147
Lines 33664 33672 +8
Branches 5626 5627 +1
============================================
+ Hits 17288 17298 +10
+ Misses 13939 13937 -2
Partials 2437 2437 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/StatementTest.java
Outdated
Show resolved
Hide resolved
…est case to validate registerOutParameter method catch block for BigDecimal.
… higher versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue sounds very familiar... I will try to look for some history here.
// Dynamically handle the scale for DECIMAL output parameters. | ||
// The scale for the DECIMAL type is fetched from the ParameterMetaData. | ||
// This provides flexibility to automatically apply the correct scale as per the database metadata. | ||
ParameterMetaData parameterMetaData = this.getParameterMetaData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this will incur a round trip to the database to get the metadata. That would be a significant performance hit if so. You can validate by running the SQL Server Profiler, watching executions against the DB while exercising this code. We would not want to add a round trip to the server for this.
We’ll be closing this MR as, after reviewing the proposed changes, we’ve decided not to proceed with merging it. The update introduces an additional round trip to the database to fetch metadata, which could negatively impact performance. Minimizing unnecessary database calls is a key design principle of the driver, and adding this overhead would go against that objective. A separate PR has been created to include the Mockito-related changes: #2644 |
#2534 - Set scale value dynamically for DECIMAL output parameters in registerOutParameter method.
This change retrieves the scale from the ParameterMetaData and applies it to the DECIMAL output parameter. This provides a more flexible approach for handling DECIMAL data types.
As an alternative, users can directly call registerOutParameter(index, sqlType, scale) to specify the scale explicitly.
And integrated Mockito Dependency into JDBC Driver Codebase. https://sqlclientdrivers.visualstudio.com/mssql-jdbc/_workitems/edit/33295