... 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.
... as the comment suggests:
pyodbc/src/getdata.cpp
Line 95 in a4b0b75
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
cbAllocatedinstead ofcbAvailableas the 5th parameter in theSQLGetDatacall. And even worse: it continues to returnSQL_SUCCESS_WITH_INFOwith a single NULL-byte when it has no more data until the 5th parameter is as big ascbData.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_INFOreturn. Which means make the initial buffer as big as the maximum column size.