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:06:58 +0100
commit51c8bb3242ad1e8e1a5906c4af2ba94c0252b36e (patch)
tree6e700649b3e489887499e30f4e5499e6e8d1a2c8
parent3016e7d84433a1b3bfce91a7a78ffef3c3d71bd9 (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 831eb3a1eba3..d568b7f911fe 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -444,6 +444,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
@@ -456,7 +458,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection,
}
else
{
- nReadChars = pcbValue;
+ nReadChars = pcbValue/sizeof(sal_Unicode);
}
aData.append(waCharArray, nReadChars);