Skip to content

Fix | Fix SQL Exception Error State length to respect SQLSTATE Standards#977

Merged
cheenamalhotra merged 2 commits intomicrosoft:devfrom
cheenamalhotra:sqlState
Mar 11, 2019
Merged

Fix | Fix SQL Exception Error State length to respect SQLSTATE Standards#977
cheenamalhotra merged 2 commits intomicrosoft:devfrom
cheenamalhotra:sqlState

Conversation

@cheenamalhotra
Copy link
Copy Markdown
Member

@cheenamalhotra cheenamalhotra commented Mar 8, 2019

Fixes #956

Calling SQLException.getErrorState() would result in SQL State of length more than 5 characters allowed as per SQL State Specifications. This fix restricts length of SQLException Error State and appends zeroes (0) as needed to Error State received from SQL Server.

As per SQL Server specifications, the values of ERROR_STATE ranges from 0 - 255 as one can raise an error with custom Error State using RAISEERROR as well. Accordingly, we must adjust trailing zeroes to the SQLException Error State.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 8, 2019

Codecov Report

Merging #977 into dev will decrease coverage by 0.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #977      +/-   ##
============================================
- Coverage     50.58%   50.56%   -0.02%     
- Complexity     2915     2918       +3     
============================================
  Files           120      120              
  Lines         27987    27991       +4     
  Branches       4678     4679       +1     
============================================
- Hits          14156    14155       -1     
- Misses        11535    11540       +5     
  Partials       2296     2296
Flag Coverage Δ Complexity Δ
#JDBC42 50.15% <83.33%> (+0.13%) 2879 <0> (+12) ⬆️
#JDBC43 50.51% <83.33%> (-0.01%) 2914 <0> (ø)
Impacted Files Coverage Δ Complexity Δ
...m/microsoft/sqlserver/jdbc/SQLServerException.java 78.1% <83.33%> (+0.65%) 33 <0> (+1) ⬆️
...om/microsoft/sqlserver/jdbc/ReaderInputStream.java 43.95% <0%> (-3.3%) 15% <0%> (ø)
...ncurrentlinkedhashmap/ConcurrentLinkedHashMap.java 38.36% <0%> (-1.08%) 42% <0%> (-2%)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 55.58% <0%> (-0.17%) 0% <0%> (ø)
...rc/main/java/com/microsoft/sqlserver/jdbc/dtv.java 68.47% <0%> (-0.06%) 0% <0%> (ø)
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 51.63% <0%> (+0.12%) 254% <0%> (+1%) ⬆️
...m/microsoft/sqlserver/jdbc/SQLServerResultSet.java 43.82% <0%> (+0.15%) 316% <0%> (+1%) ⬆️
...n/java/com/microsoft/sqlserver/jdbc/DataTypes.java 79.92% <0%> (+0.19%) 6% <0%> (+1%) ⬆️
...c/main/java/com/microsoft/sqlserver/jdbc/Util.java 62.5% <0%> (+0.43%) 91% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb72f76...e9863dc. Read the comment docs.

Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java
@cheenamalhotra cheenamalhotra added this to the 7.3.0 milestone Mar 8, 2019
@cheenamalhotra cheenamalhotra merged commit 5c202b1 into microsoft:dev Mar 11, 2019
@cheenamalhotra cheenamalhotra deleted the sqlState branch March 14, 2019 19:16
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.

[BUG] Driver returns SQL State longer than 5 characters

6 participants