Skip to content

Commit

Permalink
Excess conversion of sql statement to UTF8 is removed from fbtrace (#103
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ilya071294 authored and AlexPeshkoff committed Jul 25, 2017
1 parent dd49fa6 commit ee9085a
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/utilities/ntrace/TracePluginImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1516,24 +1516,18 @@ void TracePluginImpl::register_sql_statement(ITraceSQLStatement* statement)
if (!sql_length)
return;

if (config.include_filter.hasData() || config.exclude_filter.hasData())
if (config.include_filter.hasData())
{
const char* sqlUtf8 = statement->getTextUTF8();

This comment has been minimized.

Copy link
@asfernandes

asfernandes Aug 26, 2017

Member

Old code was reading a single time getTextUTF8 (why excess?) but new code is never reading it, as in sql there is the value returned by getText (not getTextUTF8).

This comment has been minimized.

Copy link
@ilya071294

ilya071294 Aug 31, 2017

Author Collaborator

Conversion is not needed because value in sql already in UTF8. Conversion was added in commit 173b231.

FB_SIZE_T utf8_length = fb_strlen(sqlUtf8);

if (config.include_filter.hasData())
{
include_matcher->reset();
include_matcher->process((const UCHAR*) sqlUtf8, utf8_length);
need_statement = include_matcher->result();
}
include_matcher->reset();
include_matcher->process((const UCHAR*)sql, sql_length);
need_statement = include_matcher->result();
}

if (need_statement && config.exclude_filter.hasData())
{
exclude_matcher->reset();
exclude_matcher->process((const UCHAR*) sqlUtf8, utf8_length);
need_statement = !exclude_matcher->result();
}
if (need_statement && config.exclude_filter.hasData())
{
exclude_matcher->reset();
exclude_matcher->process((const UCHAR*)sql, sql_length);
need_statement = !exclude_matcher->result();
}

if (need_statement)
Expand Down

0 comments on commit ee9085a

Please sign in to comment.