From 3f188ec758fa16164e2b34fd62940779e248a713 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Wed, 22 Jan 2025 07:53:18 -0300 Subject: [PATCH] Fix #8409 - Error message "SQL -104 / Unexpected end of command" appears in a trace log when 'SET AUTOTERM ON;' is used. --- doc/README.isql_enhancements.txt | 8 +++++--- src/dsql/dsql.cpp | 12 ++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/README.isql_enhancements.txt b/doc/README.isql_enhancements.txt index b37997cdf7..b9a81f49a1 100644 --- a/doc/README.isql_enhancements.txt +++ b/doc/README.isql_enhancements.txt @@ -337,8 +337,8 @@ It is set to OFF by default. The name WIRE_STATS could be shortened up to WIRE. The statistics counters shown in two groups: 'logical' and 'physical': - logical counters show numbers of packets in terms of Firebird wire protocol and number of bytes send before compression and received after decompression; - - physical counters show number of physical packets and bytes send and - received over the wire, number of bytes could be affected by wire compression, + - physical counters show number of physical packets and bytes send and + received over the wire, number of bytes could be affected by wire compression, if present. Also, number of network roundtrips is shown: it is number of changes of IO direction from 'send' to 'receive'. @@ -489,7 +489,9 @@ If engine prepares the statement correctly, it's run and ISQL is put in new stat mode. If engine returns error isc_command_end_err2, then ISQL is put in statement -continuation mode and asks for another line, repeating the process. +continuation mode and asks for another line, repeating the process. When this error +happens together with IStatement::PREPARE_REQUIRE_SEMICOLON, trace does not log the +error. If engine returns a different error, the error is shown and ISQL is put in new statement mode. diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index a6b9550662..bc6e876719 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -480,9 +480,17 @@ static DsqlRequest* prepareRequest(thread_db* tdbb, dsql_dbb* database, jrd_tra* return dsqlRequest; } - catch (const Exception&) + catch (const Exception& ex) { - trace.prepare(ITracePlugin::RESULT_FAILED); + StaticStatusVector st; + ex.stuffException(st); + + if (!((prepareFlags & IStatement::PREPARE_REQUIRE_SEMICOLON) && + fb_utils::containsErrorCode(st.begin(), isc_command_end_err2))) + { + trace.prepare(ITracePlugin::RESULT_FAILED); + } + throw; } }