Skip to content

Commit 3d1aed0

Browse files
author
Artyom Abakumov
committed
Use explicit way to update calculate SQL length
1 parent b7e80a9 commit 3d1aed0

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/jrd/trace/TraceDSQLHelpers.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@ class TraceDSQLPrepare
5353

5454
m_start_clock = fb_utils::query_performance_counter();
5555

56-
if (m_string == nullptr || (m_string_len == 0 && (m_string_len = fb_strlen(m_string)) == 0))
57-
{
58-
static constexpr const char* empty_string = "<empty statement>";
59-
static FB_SIZE_T empty_string_length = fb_strlen(empty_string);
60-
61-
m_string = empty_string;
62-
m_string_len = empty_string_length;
63-
}
56+
if (m_string == nullptr)
57+
traceEmptyStatement();
6458
else if (m_string_len == 0)
59+
{
6560
m_string_len = fb_strlen(m_string);
61+
if (m_string_len == 0)
62+
traceEmptyStatement();
63+
}
6664
}
6765

6866
~TraceDSQLPrepare()
@@ -102,6 +100,15 @@ class TraceDSQLPrepare
102100
}
103101

104102
private:
103+
void traceEmptyStatement()
104+
{
105+
static constexpr const char* empty_string = "<empty statement>";
106+
static FB_SIZE_T empty_string_length = fb_strlen(empty_string);
107+
108+
m_string = empty_string;
109+
m_string_len = empty_string_length;
110+
}
111+
105112
bool m_need_trace;
106113
Attachment* m_attachment;
107114
jrd_tra* const m_transaction;

0 commit comments

Comments
 (0)