From 51c8bb3242ad1e8e1a5906c4af2ba94c0252b36e Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Tue, 25 Dec 2012 13:04:44 +0100 Subject: fdo#58693 ODBC SQLGetData returns byte length, not data size Change-Id: Icd2f6503d9452c36f858180e4193af993ae7e288 --- connectivity/source/drivers/odbcbase/OTools.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 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 OTools::getBytesValue(const OConnection* _pConnection, } else { - nReadChars = pcbValue; + nReadChars = pcbValue/sizeof(sal_Unicode); } aData.append(waCharArray, nReadChars); -- cgit v1.2.3