trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <>
Subject [GitHub] incubator-trafodion pull request #871: [TRAFODION-2375]ODBC:SQLGetDiagRec re...
Date Wed, 07 Dec 2016 22:01:52 GMT
Github user selvaganesang commented on a diff in the pull request:
    --- Diff: win-odbc64/odbcclient/drvr35/cdiag.cpp ---
    @@ -389,8 +389,8 @@ SQLRETURN CDiagRec::GetDiagRec(SQLSMALLINT	RecNumber,
     					translateLengthMax/2, (int *)&translateLength, (char *)errorMsg)) != SQL_SUCCESS
    -			strLen = translateLength; 
    -			((wchar_t *)MessageText)[strLen] = L'\0' ; 
    +			((wchar_t *)MessageText)[translateLength] = L'\0';
    +			strLen = tmpStrLen;
    --- End diff --
    As per the ODBC specification, if the MessageText is NULL, the TextLengthPtr should give
the caller the number of characters that will be returned. 
    Usually, the ODBC applications are expected to get the number of characters needed for
the error message by passing in MessageText as NULL, then allocate that many characters in
their space and then request for the error message by passing the pointer to the buffer allocated
as the MessageText.  
    It looks like the logic of returning the actual number of characters needed when MessageText
is NULL is missing

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message