Avoid calling deprecated ODBC functions #17556
Draft
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.
SQLGetConnectOption
,SQLSetConnectOption
andSQLSetStmtOption
are deprecated, so if ODBC 3 is available, we useSQLSetConnectAttr
,SQLGetConnectAttr
, andSQLSetStmtAttr
instead.I'm not quite sure how to actually handle this best. Assuming that we won't require ODBC >= 3, some of the error messages would need to be adapted (e.g. we should not report an issue with
SQLConnectOption
, when we actually calledSQLSetConnectAttr
. Furthermore, the generic replacement inodbc_setoption()
might be too presumptious (from looking at sqlext.h, it seems to be okay, but who knows). Possibly, we should deprecate this PHP function altogether (at least the docs could need some update).¯\(ツ)/¯
A possible alternative to the PR as is would be to introduce general shims as macros, but this might cause even more confusion.
Anyhow, we should have a look at the double casts
(SQLPOINTER) (intptr_t)
(without, Clang 18.1.8 complains); we should probably use integer types which have the same size as a pointer in the first place.