Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEFINE_CURSOR_LIB_VER never defined, causes PHP's odbc_connect to fail in certain configurations #201

Closed
hughmcmaster opened this issue Dec 13, 2024 · 3 comments · Fixed by #202

Comments

@hughmcmaster
Copy link
Contributor

While looking into Debian bug 1089695 (Ubuntu bug 2085815), it is clear DEFINE_CURSOR_LIB_VER is never defined at compile-time or build-time and the #define is not used anywhere else.

The #ifdef guard seems to serve no purpose in the source. Removing the guard and building resolves the first half of the bug. Alternatively, configure.ac could be patched to achieve the same thing via config.h.

It also brings to mind the usefulness of #ifndef CURSOR_LIB_VER in DriverManager/SQLConnect.c. Wouldn't it be simpler to always #define CURSOR_LIB_VER 2?

@hughmcmaster hughmcmaster changed the title DEFINE_CURSOR_LIB_VER never defined, causes PHP's odbc_connect to fail in certain configurations DEFINE_CURSOR_LIB_VER never defined, causes PHP's odbc_connect to fail in certain configurations Dec 13, 2024
@lurcher
Copy link
Owner

lurcher commented Dec 13, 2024 via email

@hughmcmaster
Copy link
Contributor Author

Debian builds libodbc.so.2 and libodbccr.so.2 by default.

The libodbc*.so symlinks are only installed in the unixodbc-dev development package.

When CURSOR_LIB_VER is not defined (and it isn't in the current Debian package due to the guard against DEFINE_CURSOR_LIB_VER), the driver tries to dlopen libodbccr.so and fails.

Do you want me to prepare a patch with your suggested configure flag?

@lurcher
Copy link
Owner

lurcher commented Dec 13, 2024 via email

hughmcmaster added a commit to hughmcmaster/unixODBC that referenced this issue Dec 16, 2024
This patch modifies configure.ac so DEFINE_CURSOR_LIB_VER can be
defined in config.h. Doing so subsequently defines CURSOR_LIB_VER,
allowing a versioned cursor library to be accessed via dlopen in
DriverManager/SQLConnect.c.

This new configure switch is not enabled by default, so existing
behaviour is retained.

Closes lurcher#201.
lurcher pushed a commit that referenced this issue Dec 16, 2024
This patch modifies configure.ac so DEFINE_CURSOR_LIB_VER can be
defined in config.h. Doing so subsequently defines CURSOR_LIB_VER,
allowing a versioned cursor library to be accessed via dlopen in
DriverManager/SQLConnect.c.

This new configure switch is not enabled by default, so existing
behaviour is retained.

Closes #201.
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 a pull request may close this issue.

2 participants