Skip to content

Conversation

@Paultagoras
Copy link
Contributor

Summary

  • Tweaked DatabaseMetaData.getIndexInfo to return an empty ResultSet rather than null

Closes #2286

Checklist

Delete items not relevant to your PR:

@Paultagoras Paultagoras self-assigned this Apr 17, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates DatabaseMetaData.getIndexInfo to return an empty ResultSet instead of null, ensuring that JDBC calls do not unexpectedly receive a null value. It also renames the DatabaseMetaData class to DatabaseMetaDataImpl and updates its references, and adds a new integration test for the getIndexInfo behavior.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java Updated test to reference DatabaseMetaDataImpl and assert an empty ResultSet for getIndexInfo
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java Renamed class from DatabaseMetaData and modified getIndexInfo to return an empty ResultSet using a SQL query
jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java Updated to import and reference DatabaseMetaDataImpl instead of the previous class

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
7 Security Hotspots
29.6% Coverage on New Code (required ≥ 80%)
34.8% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException {
return null;
try {
String sql = "SELECT null AS TABLE_CAT, null AS TABLE_SCHEM, null AS TABLE_NAME, null AS NON_UNIQUE," +
Copy link
Contributor

Choose a reason for hiding this comment

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

@Paultagoras Paultagoras requested a review from chernser April 22, 2025 06:16
Copy link
Contributor

@mzitnik mzitnik left a comment

Choose a reason for hiding this comment

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

LGTM

@Paultagoras Paultagoras merged commit a245c1f into main Apr 22, 2025
24 of 25 checks passed
@Paultagoras Paultagoras deleted the tweak-databasemetadata branch April 22, 2025 16:23
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.

If not implemented, null should not be returned

4 participants