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

Please make the initial allocation size in ReadVarColumn configurable #1071

Open
defransen opened this issue Jun 20, 2022 · 1 comment
Open

Comments

@defransen
Copy link

... as the comment suggests:

// TODO: Make the initial allocation size configurable?

Ideally a configured value of 0 (or -1) would mean: use columnSize * cbElement.

This would help to work around a bug in the Oracle BI ODBC drivers SQLGetData implementation.
The driver expects to get cbAllocated instead of cbAvailable as the 5th parameter in the SQLGetData call. And even worse: it continues to return SQL_SUCCESS_WITH_INFO with a single NULL-byte when it has no more data until the 5th parameter is as big as cbData.
The result is that pyodbc seg-faults after all RAM has been allocated for the buffer.

The only sane way to work around this, without breaking compatibility, is to ensure to never get a SQL_SUCCESS_WITH_INFO return. Which means make the initial buffer as big as the maximum column size.

@defransen defransen changed the title Please make the initial allocation size in ReadVarolumn configurable Please make the initial allocation size in ReadVarColumn configurable Jun 20, 2022
@mkleehammer
Copy link
Owner

I don't have an Oracle install to test against. Would a flag that caused pyodbc to pass cbAllocated actually fix the issue? That is, would it return SQL_SUCCESS if it thought it had the right amount of buffer?

Also, is there a bug report open somewhere on the driver we link to and follow?

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

3 participants