Skip to content

Fix | Align DatabaseMetadata.getColumns with JDBC 4.3 Specifications#1016

Merged
rene-ye merged 23 commits intomicrosoft:devfrom
rene-ye:issue1013
Jun 7, 2019
Merged

Fix | Align DatabaseMetadata.getColumns with JDBC 4.3 Specifications#1016
rene-ye merged 23 commits intomicrosoft:devfrom
rene-ye:issue1013

Conversation

@rene-ye
Copy link
Copy Markdown
Member

@rene-ye rene-ye commented Apr 1, 2019

Addresses #1013. Aligns ResultSet retrieved from DatabaseMetaData.getColumns() with what's described in the JDBC Specifications here. Requires a change in our current MSDN docs and possibly a major version bump.

Changes in createSqlKeyWords() due to formatting. Removed Katmai checks and explicitly uses sp_columns_100 as we no longer provide support for SQL Server 2008 and below.

SCOPE_CATALOG, SCOPE_SCHEMA, and SCOPE_TABLE explicitly always returns NULL as SQL Server currently doesn't seem to support REF column types. The description for these fields is pasted below from the JDBC specification link above:

SCOPE_CATALOG String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
SCOPE_SCHEMA String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
SCOPE_TABLE String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 2, 2019

Codecov Report

Merging #1016 into dev will decrease coverage by 0.33%.
The diff coverage is 73.84%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev    #1016      +/-   ##
============================================
- Coverage     53.43%   53.09%   -0.34%     
+ Complexity     3235     3167      -68     
============================================
  Files           119      119              
  Lines         28036    28118      +82     
  Branches       4680     4694      +14     
============================================
- Hits          14980    14930      -50     
- Misses        10911    10954      +43     
- Partials       2145     2234      +89
Impacted Files Coverage Δ Complexity Δ
...soft/sqlserver/jdbc/SQLServerDatabaseMetaData.java 39.8% <73.84%> (+3.62%) 76 <9> (+6) ⬆️
...oft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java 56.25% <0%> (-3.75%) 5% <0%> (-3%)
...om/microsoft/sqlserver/jdbc/ReaderInputStream.java 43.95% <0%> (-3.3%) 15% <0%> (-1%)
...soft/sqlserver/jdbc/SQLServerPooledConnection.java 77.89% <0%> (-3.16%) 27% <0%> (-3%)
...m/microsoft/sqlserver/jdbc/SQLServerException.java 72.85% <0%> (-2.86%) 32% <0%> (-3%)
...ooglecode/concurrentlinkedhashmap/LinkedDeque.java 26.15% <0%> (-2.31%) 18% <0%> (-2%)
...oft/sqlserver/jdbc/SQLServerPreparedStatement.java 53.31% <0%> (-1.87%) 216% <0%> (-32%)
...SQLServerColumnEncryptionJavaKeyStoreProvider.java 63.12% <0%> (-1.42%) 10% <0%> (-2%)
...a/com/microsoft/sqlserver/jdbc/PLPInputStream.java 59.76% <0%> (-1.19%) 34% <0%> (-1%)
src/main/java/com/microsoft/sqlserver/jdbc/AE.java 74.22% <0%> (-1.04%) 0% <0%> (ø)
... and 12 more

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 b2ecbdc...d85364b. Read the comment docs.

Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
peterbae
peterbae previously approved these changes Apr 8, 2019
@cheenamalhotra cheenamalhotra added this to the 7.3.1 milestone Apr 8, 2019
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Copy link
Copy Markdown
Contributor

@lilgreenbird lilgreenbird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test

@rene-ye
Copy link
Copy Markdown
Member Author

rene-ye commented Apr 11, 2019

add test

Existing API with tests, already being tested.

@rene-ye rene-ye dismissed lilgreenbird’s stale review April 12, 2019 22:00

Already being tested

@rene-ye rene-ye requested a review from cheenamalhotra April 12, 2019 22:01
peterbae
peterbae previously approved these changes Apr 17, 2019
cheenamalhotra
cheenamalhotra previously approved these changes Apr 18, 2019
lilgreenbird
lilgreenbird previously approved these changes May 13, 2019
@ulvii
Copy link
Copy Markdown
Contributor

ulvii commented May 16, 2019

Please add the new columns to DatabaseMetaDataTest.testGetDBColumn() to make sure they are tested.

Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
@rene-ye rene-ye requested a review from ulvii May 16, 2019 15:33
@rene-ye rene-ye dismissed stale reviews from lilgreenbird, cheenamalhotra, and peterbae via f582cc6 May 16, 2019 16:49
@rene-ye rene-ye requested a review from lilgreenbird May 16, 2019 16:49
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
Comment thread src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java Outdated
ulvii
ulvii previously approved these changes Jun 5, 2019
cheenamalhotra
cheenamalhotra previously approved these changes Jun 5, 2019
lilgreenbird
lilgreenbird previously approved these changes Jun 5, 2019
@rene-ye rene-ye dismissed stale reviews from lilgreenbird, cheenamalhotra, and ulvii via 81bb73d June 6, 2019 17:02
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.

6 participants