diff --git a/src/jrd/trace/TraceDSQLHelpers.h b/src/jrd/trace/TraceDSQLHelpers.h index e425518d45b..a40d08e9b72 100644 --- a/src/jrd/trace/TraceDSQLHelpers.h +++ b/src/jrd/trace/TraceDSQLHelpers.h @@ -53,14 +53,14 @@ class TraceDSQLPrepare m_start_clock = fb_utils::query_performance_counter(); - static const char empty_string[] = ""; - if (!string) - { - m_string = empty_string; - m_string_len = 0; - } + if (m_string == nullptr) + traceEmptyStatement(); else if (m_string_len == 0) + { m_string_len = fb_strlen(m_string); + if (m_string_len == 0) + traceEmptyStatement(); + } } ~TraceDSQLPrepare() @@ -100,6 +100,15 @@ class TraceDSQLPrepare } private: + void traceEmptyStatement() + { + static constexpr const char* empty_string = ""; + static FB_SIZE_T empty_string_length = fb_strlen(empty_string); + + m_string = empty_string; + m_string_len = empty_string_length; + } + bool m_need_trace; Attachment* m_attachment; jrd_tra* const m_transaction;