From 1e237e9273f9be15e28fae0b6cf079a1b64c31c3 Mon Sep 17 00:00:00 2001 From: Weixin-Xu <1013438133@qq.com> Date: Wed, 26 Sep 2018 15:17:53 +0800 Subject: [PATCH] the error message is truncated --- win-odbc64/odbcclient/drvr35/cdiag.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win-odbc64/odbcclient/drvr35/cdiag.cpp b/win-odbc64/odbcclient/drvr35/cdiag.cpp index 01ac0231bd..e4b52a8087 100644 --- a/win-odbc64/odbcclient/drvr35/cdiag.cpp +++ b/win-odbc64/odbcclient/drvr35/cdiag.cpp @@ -378,7 +378,7 @@ SQLRETURN CDiagRec::GetDiagRec(SQLSMALLINT RecNumber, //Double strLen to circumvent the bug in driver manager, that requires us to give //the NO. OF BYTES instead of no. of characters - strLen = tmpStrLen * 2; + strLen = tmpStrLen; translateLengthMax = (BufferLength == SQL_NTS) ? strLen : BufferLength; @@ -386,7 +386,7 @@ SQLRETURN CDiagRec::GetDiagRec(SQLSMALLINT RecNumber, { // translate from UTF8 to WChar if ( (rc = UTF8ToWChar((char *)MsgStruct.lpsMsgText.c_str(), tmpStrLen, MessageText, - translateLengthMax/2, (int *)&translateLength, (char *)errorMsg)) != SQL_SUCCESS ) + translateLengthMax, (int *)&translateLength, (char *)errorMsg)) != SQL_SUCCESS ) rc = SQL_SUCCESS_WITH_INFO; //ERROR; ((wchar_t *)MessageText)[translateLength] = L'\0';