Kaydet (Commit) 2f54f2a4 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

fdo#58693 ODBC SQLGetData returns byte length, not data size

Change-Id: Icd2f6503d9452c36f858180e4193af993ae7e288
üst 26eaea11
...@@ -447,6 +447,8 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, ...@@ -447,6 +447,8 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
return ::rtl::OUString(); return ::rtl::OUString();
SQLLEN nReadChars; SQLLEN nReadChars;
OSL_ENSURE( (pcbValue < 0) || (pcbValue % 2 == 0),
"ODBC: SQLGetData of SQL_C_WCHAR returned odd number of bytes");
if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue >= nMaxLen) ) if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue >= nMaxLen) )
{ {
// we filled the buffer; remove the terminating null character // we filled the buffer; remove the terminating null character
...@@ -459,7 +461,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, ...@@ -459,7 +461,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
} }
else else
{ {
nReadChars = pcbValue; nReadChars = pcbValue/sizeof(sal_Unicode);
} }
aData.append(waCharArray, nReadChars); aData.append(waCharArray, nReadChars);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment