hdbc/hdbc-odbc

SQLGetData called on bound columns regardless of SQL_GD_BOUND

Opened this issue · 2 comments

For fields exceeding the buffer size, SQLGetData is used to retrieve the data with multiple fetches. At this point the columns are already bound, which generates an error with drivers without SQL_GD_BOUND.

"If the driver does not support extensions to SQLGetData, the function can return data only for unbound columns with a number greater than that of the last bound column." - http://msdn.microsoft.com/en-us/library/ms715441%28v=vs.85%29.aspx

Thanks for reporting this! I'd be very happy to receive a patch if you have one to fix this.

Sorry, but I don't have a fix available. I'm using SQLSetStmtAttr
to set SQL_ATTR_MAX_LENGTH to colBufSizeDefault to truncate these
fields to the size of the buffer and avoid the error (Invalid descriptor index), but it's
just a workaround (currently I have no way of retrieving all the data).