Implement SQLGetInfo(SQL_DBMV_VER) to get the version of the ClickHouse Server#496
Merged
slabko merged 1 commit intoClickHouse:masterfrom May 21, 2025
slabko:get_dbms_version
Merged
Implement SQLGetInfo(SQL_DBMV_VER) to get the version of the ClickHouse Server#496slabko merged 1 commit intoClickHouse:masterfrom slabko:get_dbms_version
slabko merged 1 commit intoClickHouse:masterfrom
slabko:get_dbms_version
Conversation
The ODBC standard has a special way to get the version of the DBMS using `SQLGetInfo` with `SQL_DBMV_VER`. This change implements this option.
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to retrieve the DBMS version via SQLGetInfo using SQL_DBMS_VER. Key changes include:
- Adding a new test (test_dbms_version) to verify the DBMS version retrieval.
- Implementing getServerVersion in the driver APIs and updating the SQLGetInfo switch.
- Introducing a helper to propagate diagnostics between handles.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/src/e2e/test_sanity.py | Added test to compare driver-retrieved versus query version |
| driver/test/misc_it.cpp | Added integration test for GetDatabaseVersion |
| driver/diagnostics.h & diagnostics.cpp | Added helper copyDiagnosticsRecords for diagnostics propagation |
| driver/api/odbc.cpp | Updated SQLGetInfo switch to delegate SQL_DBMS_VER handling |
| driver/api/impl/impl.h & impl.cpp | Added getServerVersion implementation for retrieving DBMS version |
| if (string_length_ptr) | ||
| *string_length_ptr = indicator; | ||
|
|
||
| if (indicator < 0) |
There was a problem hiding this comment.
Consider refining the error handling here by explicitly checking for SQL_NULL_DATA instead of any value less than 0. This would clarify that the error is due to a null or missing version value.
Suggested change
| if (indicator < 0) | |
| if (indicator == SQL_NULL_DATA) |
Contributor
Author
There was a problem hiding this comment.
Negative indicator, wither it SQL_NULL_DATA or anything else, means that we did not get the data we expected and we cannot go further. SQL_NULL_DATA is just a special case of the same problem.
mshustov
approved these changes
May 21, 2025
slvrtrn
approved these changes
May 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ODBC standard has a special way to get the version of the DBMS using
SQLGetInfowithSQL_DBMV_VER. This change implements this option.