8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:03:03 +01:00

Fix problem with statements and plan segments larger than 64K in the profiler plugin.

This commit is contained in:
Adriano dos Santos Fernandes 2023-09-21 08:38:47 -03:00
parent 78f2097ffa
commit dd317cc4c7

View File

@ -44,6 +44,12 @@ namespace
class ProfilerPlugin; class ProfilerPlugin;
static constexpr UCHAR STREAM_BLOB_BPB[] = {
isc_bpb_version1,
isc_bpb_type, 1, isc_bpb_type_stream,
};
static const CInt128 ONE_SECOND_IN_NS{1'000'000'000}; static const CInt128 ONE_SECOND_IN_NS{1'000'000'000};
static CInt128 ticksFrequency{0}; static CInt128 ticksFrequency{0};
@ -713,7 +719,7 @@ void ProfilerPlugin::flush(ThrowStatusExceptionWrapper* status)
if (profileStatement.sqlText.hasData()) if (profileStatement.sqlText.hasData())
{ {
auto blob = makeNoIncRef(userAttachment->createBlob( auto blob = makeNoIncRef(userAttachment->createBlob(
status, transaction, &statementMessage->sqlText, 0, nullptr)); status, transaction, &statementMessage->sqlText, sizeof(STREAM_BLOB_BPB), STREAM_BLOB_BPB));
blob->putSegment(status, profileStatement.sqlText.length(), profileStatement.sqlText.c_str()); blob->putSegment(status, profileStatement.sqlText.length(), profileStatement.sqlText.c_str());
blob->close(status); blob->close(status);
blob.clear(); blob.clear();
@ -779,8 +785,8 @@ void ProfilerPlugin::flush(ThrowStatusExceptionWrapper* status)
recSrcMessage->accessPathNull = FB_FALSE; recSrcMessage->accessPathNull = FB_FALSE;
{ // scope { // scope
auto blob = makeNoIncRef( auto blob = makeNoIncRef(userAttachment->createBlob(status, transaction, &recSrcMessage->accessPath,
userAttachment->createBlob(status, transaction, &recSrcMessage->accessPath, 0, nullptr)); sizeof(STREAM_BLOB_BPB), STREAM_BLOB_BPB));
blob->putSegment(status, recSrc.accessPath.length(), recSrc.accessPath.c_str()); blob->putSegment(status, recSrc.accessPath.length(), recSrc.accessPath.c_str());
blob->close(status); blob->close(status);
blob.clear(); blob.clear();