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

OCI_GetServerMajorVersion() returns wrong values for Oracle Server version < 18.1 #333

Open
freakout42 opened this issue Feb 23, 2023 · 1 comment

Comments

@freakout42
Copy link

the code below produces weird shifted results with 4.7.6 compared to 4.7.3 on a 32-bit compile:

< ocilib 4.7.6 0 9 20 920
---
> ocilib 4.7.3 9 2 0 920

fprintf(stderr, "ocilib %d.%d.%d %i %i %i %i\n",
    OCILIB_MAJOR_VERSION, OCILIB_MINOR_VERSION, OCILIB_REVISION_VERSION,
    OCI_GetServerMajorVersion(cn),
    OCI_GetServerMinorVersion(cn),
    OCI_GetServerRevisionVersion(cn),
    OCI_GetVersionConnection(cn));
@vrogier
Copy link
Owner

vrogier commented Feb 23, 2023

Hi,

Found the issue in ocilib code.

In your example, with current versions of OCILIB, OCI_GetVersionConnection() should return 90200 instead of 920 for a Oracle 9.2.0 server version.
In v4.7.5, I changed the version integer values returned by OCI_GetVersionConnection() to be on 6 digits instead of 4 to handle the minor and rev number on more than 1 digits.

When using oracle 18+, ver_maj, ver_min and ver_rev are retrieved from oracle OCI APIs and then assembled into a single integer value on 6 digits and OCI_GetVersionConnection() returns a correct integer value.
By for previous Oracle version, the version is computed by parsing the server banner (same as the one shown in SQL*PLUS).
And the extracted ver_maj, ver_min and ver_rev are not assembled using the new 6 digit scheme introduced in v4.7.5 but with the old scheme on 4 digits.

As OCI_GetServerMajorVersion, OCI_GetServerMinorVersion and OCI_GetServerRevisionVersion are extracting their value from the combined 6 digits integer value, in case the server is pre 18, they are parsing a 4 digits integer value and then lead to the erroneous value you've seen.

It will be fixed in the current 4.7.7 dev branch by the end of the day :)

Regards,

Vincent

vrogier pushed a commit that referenced this issue Feb 23, 2023
@vrogier vrogier changed the title server version numbers reported wrong with 32-bit compiled 4.7.6 OCI_GetServerMajorVersion() returns wrong values for Oracle Server version < 18.1 Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants