microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
122 stars 40 forks source link

SQL_DATA_AT_FETCH & using the ARD's SQL_DESC_OCTET_LENGTH_PTR field for input #99

Closed matthew-wozniczka closed 7 years ago

matthew-wozniczka commented 7 years ago

Related to #98, the current implementation of SQL_DATA_AT_FETCH requires the driver to use the length indicator for input when fetching. This is a new requirement in ODBC 4.0, which will cause backwards compatibility issues.

Consider that in the past, when fetching data, the length indicator was output-only. This means that the application was not required to initialize the memory it pointed to. This means that it could inadvertently contain the value SQL_DATA_AT_FETCH, and cause the fetch to be interrupted (where the application may not be prepared for such a thing). Of course, such an application is likely using an earlier ODBC version for SQL_ATTR_ODBC_VERSION, but it could cause ('random') problems for applications which were upgraded.

This brings up a more fundamental point: If the application does not wish to bind the column as SQL_DATA_AT_FETCH, what value should the length indicator buffer be initialized to?

mikepizzo commented 7 years ago

I believe this ended up being resolved as part of issue #98.

Applications that specify odbc version 4.0 or greater will need to make sure the buffers are initialized to some value other than SQL_DATA_AT_FETCH (typically, SQL_DATA_UNAVAILABLE).