Fix conn string parsing with unsupported options #60
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 specification does not mandate how the driver should deal with unsupported options specified by client in the connection string (link).
When encountering an unsupported option, DuckDB driver registers a diagnostic message in a format:
Invalid keyword: <option_name>
, that can be fetched by client usingSQLGetDiagRec
function, and returnsSQL_SUCCESS_WITH_INFO
instead ofSQL_SUCCESS
.This is a reasonable approach, but there is inconsistent error handling in its implementation in Connect::ParseInputStr. It only checks for
SQL_SUCCESS
and treatsSQL_SUCCESS_WITH_INFO
as an error. This causes the early exit from this function that prevents subsequent options in the connection string to be processed. It also prevents the DSN name to be set on the connection (even when the DSN option comes before the unsupported one).To fix this it is proposed to check for both
SQL_SUCCESS
andSQL_SUCCESS_WITH_INFO
and only do the early exit if some other error code is returned by FindKeyValPair routine.Testing: tests are included for a common option and for the DSN option.
Fixes: #59