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: allow DatabaseMetaData.getColumns to describe an unset scale #1716

Merged
merged 1 commit into from Feb 25, 2020

Conversation

crwr45
Copy link
Contributor

@crwr45 crwr45 commented Feb 24, 2020

fix: allow DatabaseMetaData.getColumns to describe an unset scale

getColumns returns a 0 for the scale of a Decimal or Numeric column when the
scale is 0, and when the scale is null. The caller can then not differentiate
between a 0 or a null without another query.

This change replaces the 0 in the ResultSet for scale with a null when describing
an unscaled Decimal or Numeric column. getInt will still convert the null to a 0,
but the caller can then use wasNull() to find out if the underlying value was 0
or null.

This addresses #1712. It is a breaking change, but if the correct getter
(getInt) is used for the column, there is no difference. Other getters may behave
differently.

Signed-off-by: crwr45 charlie.wheelerrobinson@gmail.com

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Does mvn checkstyle:check pass ?
  3. Have you added your new test classes to an existing test suite in alphabetical order?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

getColumns returns a 0 for the scale of a Decimal or Numeric column when the
scale is 0, and when the scale is null. The caller can then not differentiate
between a 0 or a null without another query.

This change replaces the 0 in the ResultSet for scale with a null when describing
an unscaled Decimal or Numeric column. getInt will still convert the null to a 0,
but the caller can then use wasNull() to find out if the underlying value was 0
or null.

This addresses Issue 1712. It is a breaking change, but if the correct getter
(getInt) is used for the column, there is no difference. Other getters may behave
differently.

Signed-off-by: crwr45 <charlie.wheelerrobinson@gmail.com>
@davecramer davecramer added this to In progress in 42.3.0 Release via automation Feb 24, 2020
@codecov-io
Copy link

Codecov Report

Merging #1716 into master will increase coverage by 2.67%.
The diff coverage is 33.33%.

@@             Coverage Diff              @@
##             master    #1716      +/-   ##
============================================
+ Coverage     68.26%   70.93%   +2.67%     
- Complexity     4145     4693     +548     
============================================
  Files           187      189       +2     
  Lines         17193    19550    +2357     
  Branches       2852     3482     +630     
============================================
+ Hits          11736    13868    +2132     
- Misses         4180     4274      +94     
- Partials       1277     1408     +131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants