Unable to fetch empty string with ODBC driver #6690
Closed
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Date: 2019-03-08 17:42:48 +0100
From: jpastuszek
To: clients devs <>
Version: 11.31.13 (Aug2018-SP2)
Last updated: 2019-04-30 12:36:04 +0200
Comment 26917
Date: 2019-03-08 17:42:48 +0100
From: jpastuszek
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0
Build Identifier:
ODBC SQLGetData call for empty string returns SQL_NO_DATA instead of empty string (buffer of "\0" or "\0\0" (UTF-16)) and SQL_SUCCESS result.
Reproducible: Always
Steps to Reproduce:
Actual Results:
Returned result is SQL_NO_DATA
Expected Results:
Returned result is SQL_SUCCESS and buffer is filled with one NULL byte (two NULL bytes for WCHAR case).
https://github.com/MonetDB/MonetDB/blob/c1904ad32054585575e6e28028ae608435282cc6/clients/odbc/driver/ODBCConvert.cL1285
Probably the check
if (irdrec->already_returned >= datalen) {
will be true for first call of SQLGetData on empty string as both values will be 0. SQL_NO_DATA is returned immediately andcopyString
will not be called in this case.My client works correctly with SQL Server. Documentation (https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-2017) says "Returns SQL_NO_DATA if it has already returned all of the data for the column." which would suggest that SQL_NO_DATA should not be returned for the first time the SQLGetData is called.
Comment 26918
Date: 2019-03-08 18:30:01 +0100
From: MonetDB Mercurial Repository <>
Changeset 13337bea12f3 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.
For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=13337bea12f3
Changeset description:
Comment 26919
Date: 2019-03-08 18:31:19 +0100
From: @sjoerdmullender
You completely nailed the problem. Fix was therefore easy.
The text was updated successfully, but these errors were encountered: