Skip to content

Commit b2fd8b8

Browse files
author
Artyom Abakumov
committed
Use explicit way to update calculate SQL length
1 parent a3d8e65 commit b2fd8b8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/jrd/trace/TraceDSQLHelpers.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ class TraceDSQLPrepare
5555

5656
m_start_clock = fb_utils::query_performance_counter();
5757

58-
static constexpr std::string_view empty_string = "<empty statement>";
59-
if (m_string == nullptr || (m_string_len == 0 && (m_string_len = fb_strlen(m_string)) == 0))
58+
if (m_string == nullptr)
59+
traceEmptyStatement();
60+
else if (m_string_len == 0)
6061
{
61-
m_string = empty_string.data();
62-
m_string_len = empty_string.length();
62+
m_string_len = fb_strlen(m_string);
63+
if (m_string_len == 0)
64+
traceEmptyStatement();
6365
}
6466
}
6567

@@ -105,6 +107,13 @@ class TraceDSQLPrepare
105107
}
106108

107109
private:
110+
void traceEmptyStatement()
111+
{
112+
static constexpr std::string_view empty_string = "<empty statement>";
113+
m_string = empty_string.data();
114+
m_string_len = empty_string.length();
115+
}
116+
108117
bool m_need_trace;
109118
Attachment* m_attachment;
110119
jrd_tra* const m_transaction;

0 commit comments

Comments
 (0)