@@ -759,28 +759,20 @@ void LogQuery ( const CSphQuery & q, const CSphQuery & tJoinOptions, const CSphQ
759759 }
760760}
761761
762- void LogSphinxqlError ( const char * sStmt , const Str_t & sError )
762+ void LogSphinxqlError ( const char * szStmt , const Str_t & sError )
763763{
764- if ( g_eLogFormat != LOG_FORMAT::SPHINXQL || g_iQueryLogFile < 0 || !sStmt || IsEmpty ( sError ) )
765- return ;
766-
767- // some mysql cli, like mysql 9.0.1, 9.1.0, 9.3.0, may be others, fire 'select $$' query after connect
768- // that produces some noise in query log, so let's just filter out these queries. #2772
769- if ( !strcmp (sStmt , " select $$" ) )
770- return ;
771-
772- StringBuilder_c tBuf;
773- tBuf << " /* " ;
774- FormatTimeConnClient ( tBuf );
775- tBuf << " */ " << sStmt << " # error=" << sError << ' \n ' ;
776-
777- WriteQuery ( tBuf );
764+ LogSphinxqlError ( FromSz ( szStmt ), sError );
778765}
779766
780-
781767void LogSphinxqlError ( const Str_t & sStmt , const Str_t & sError )
782768{
783- if ( g_eLogFormat != LOG_FORMAT::SPHINXQL || g_iQueryLogFile < 0 || IsEmpty ( sStmt ) || IsEmpty ( sError ) )
769+ if ( g_eLogFormat != LOG_FORMAT::SPHINXQL || g_iQueryLogFile < 0 || !IsFilled ( sStmt ) || IsEmpty ( sError ) )
770+ return ;
771+
772+ // some mysql cli, like mysql 9.0.1, 9.1.0, 9.3.0, may be others, fire 'select $$' query after connect
773+ // that produces some noise in query log, so let's just filter out these queries. #2772
774+ constexpr Str_t selectSS = FROMS (" select $$" );
775+ if ( sStmt .second ==selectSS.second && !strncmp (sStmt .first , selectSS.first , selectSS.second ) )
784776 return ;
785777
786778 QuotationEscapedBuilder tBuf;
0 commit comments