From 5e951de92544bceb19e03244f4ffef19c62c4d90 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Thu, 30 Jan 2014 06:07:56 +0100 Subject: fdo#74160 firebird XParameters::setString truncate to 65535 characters as opposed to 17 characters Change-Id: I65c82243946c22eee0f033977b1cd0c5a84d226b --- connectivity/source/drivers/firebird/PreparedStatement.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'connectivity/source/drivers/firebird') diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 7c7b3d3e769d..1be05f7c507a 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -208,10 +208,11 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 nParameterIndex, switch (dtype) { case SQL_VARYING: { + const sal_Int32 max_varchar_len = 0xFFFF; // First 2 bytes indicate string size - if (str.getLength() > (2^16)-1) + if (str.getLength() > max_varchar_len) { - str = str.copy(0, (2^16)-1); + str = str.copy(0, max_varchar_len); } const short nLength = str.getLength(); memcpy(pVar->sqldata, &nLength, 2); -- cgit