Skip to content

Commit 2c5b146

Browse files
committed
Postfix for #8409 - Error message "SQL -104 / Unexpected end of command" appears in a trace log when 'SET AUTOTERM ON;' is used.
1 parent e62f341 commit 2c5b146

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/dsql/dsql.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ static DsqlRequest* prepareRequest(thread_db* tdbb, dsql_dbb* database, jrd_tra*
490490
{
491491
trace.prepare(ITracePlugin::RESULT_FAILED);
492492
}
493+
else
494+
trace.avoidTrace();
493495

494496
throw;
495497
}

src/jrd/jrd.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,12 +1406,14 @@ static void successful_completion(CheckStatusWrapper* s, ISC_STATUS acceptCode =
14061406

14071407
// Stuff exception transliterated to the client charset.
14081408
static ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, FbStatusVector* vector,
1409-
const char* func) noexcept
1409+
const char* func, std::function<bool (const FbStatusVector* vector)> avoidTrace = {}) noexcept
14101410
{
14111411
ex.stuffException(vector);
14121412

14131413
Jrd::Attachment* attachment = tdbb->getAttachment();
1414-
if (func && attachment && attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_ERROR))
1414+
1415+
if ((!avoidTrace || !avoidTrace(vector)) && func &&
1416+
attachment && attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_ERROR))
14151417
{
14161418
TraceConnectionImpl conn(attachment);
14171419
TraceStatusVectorImpl traceStatus(vector, TraceStatusVectorImpl::TS_ERRORS);
@@ -5683,7 +5685,13 @@ JStatement* JAttachment::prepare(CheckStatusWrapper* user_status, ITransaction*
56835685
}
56845686
catch (const Exception& ex)
56855687
{
5686-
transliterateException(tdbb, ex, user_status, "JStatement::prepare");
5688+
transliterateException(tdbb, ex, user_status, "JStatement::prepare",
5689+
[&](const FbStatusVector* vector)
5690+
{
5691+
return (flags & IStatement::PREPARE_REQUIRE_SEMICOLON) &&
5692+
fb_utils::containsErrorCode(vector->getErrors(), isc_command_end_err2);
5693+
});
5694+
56875695
if (statement)
56885696
{
56895697
try

src/jrd/trace/TraceDSQLHelpers.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ class TraceDSQLPrepare
9797
}
9898
}
9999

100+
void avoidTrace()
101+
{
102+
m_need_trace = false;
103+
}
104+
100105
private:
101106
bool m_need_trace;
102107
Attachment* m_attachment;

0 commit comments

Comments
 (0)