summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-12-25 13:04:44 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2012-12-25 13:05:57 +0100
commit2f54f2a4ac508de3984d2865da984b9ecf30f602 (patch)
tree760e6881e595c9941597db7914abff2df12a9b52
parent26eaea11f3ede272dd18289e1caa550daa153fb0 (diff)
fdo#58693 ODBC SQLGetData returns byte length, not data size
Change-Id: Icd2f6503d9452c36f858180e4193af993ae7e288
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
index 290aa611d015..fbeeec65fd37 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -447,6 +447,8 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
return ::rtl::OUString();
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) )
{
// we filled the buffer; remove the terminating null character
@@ -459,7 +461,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
}
else
{
- nReadChars = pcbValue;
+ nReadChars = pcbValue/sizeof(sal_Unicode);
}
aData.append(waCharArray, nReadChars);