[ODBC-111] SQLGetData() should allow a NULL TargetValuePtr to fetch the length Created: 2017-08-28 Updated: 2017-08-28 Resolved: 2017-08-28 |
|
| Status: | Closed |
| Project: | MariaDB Connector/ODBC |
| Component/s: | None |
| Affects Version/s: | 3.0.1 |
| Fix Version/s: | 3.0.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Brad House | Assignee: | Lawrin Novitsky |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04, but not specific to Ubuntu |
||
| Description |
|
In SQLGetData() in odbc_3_api.c, there is a check for if (TargetValuePtr == NULL) and if it is NULL, it returns HY009. However, it is common practice when fetching data from TEXT field to not know what buffer size is needed, and therefore simply pass NULL for TargetValuePtr and 0 for BufferLength to get the buffer size needed returned via StrLen_or_IndPtr then call SQLGetData() again with a sufficient buffer. Simply commenting out this sanity check appears to work as expected. |
| Comments |
| Comment by Lawrin Novitsky [ 2017-08-28 ] |
|
But what do we do with https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function that explicitly states, that "TargetValuePtr cannot be NULL."? |