https://bugs.documentfoundation.org/show_bug.cgi?id=149470

--- Comment #4 from Julien Nabet <[email protected]> ---
Value of the clob is added in OPreparedStatement::setClob here:
https://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/firebird/PreparedStatement.cxx?r=5200a736#646

I gave it a try and had weird values.

Indeed, I applied this patch locally:
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx
b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 9cd9157a7d6d..cb669ca05821 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -19,6 +19,7 @@

 #include <sal/config.h>
 #include <cmath>
+#include <iostream>

 #include "Connection.hxx"
 #include "PreparedStatement.hxx"
@@ -661,6 +662,7 @@ void OPreparedStatement::setClob( sal_Int32
nParameterIndex, const OUString& rSt
     OString sData = OUStringToOString(
             rStr,
             RTL_TEXTENCODING_UTF8);
+    std::cerr << "sData.getLength()=" << sData.getLength() << "\n";
     ISC_STATUS aErr = isc_put_segment( m_statusVector,
                             &aBlobHandle,
                             sData.getLength(),

with a length of 200647, I got 32312
with a length of 100323, I got 278296
(yes I got a higher value result with a lower input length).

Then I searched in Firebird code and found:
src/common/classes/BlobWrapper.cpp:30:static const USHORT SEGMENT_LIMIT =
65535;

65535 bytes, so 524280 bits.

Then when putting exactly a text of 65535 bytes, I obtain 524280
but if I put 65536 bytes, I get 0 and if I put 65537 bytes, I get 8.

So if input is more than 65535 bytes, it seems we must find a way to split the
input and call n times isc_put_segment

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to