Trim exit string before checking. #2510

This commit is contained in:
Nikolai Kochetov 2018-06-14 22:15:35 +03:00
parent c8bdc1e8ba
commit 27c6df7e20
3 changed files with 10 additions and 1 deletions

View File

@ -731,7 +731,7 @@ private:
bool processSingleQuery(const String & line, ASTPtr parsed_query_ = nullptr)
{
if (exit_strings.end() != exit_strings.find(line))
if (exit_strings.end() != exit_strings.find(trim(line, [](char c){ return isWhitespaceASCII(c) || c == ';'; })))
return false;
resetOutput();

View File

@ -1,4 +1,5 @@
#include "StringUtils.h"
#include <boost/algorithm/string.hpp>
namespace detail
{
@ -14,3 +15,10 @@ bool endsWith(const std::string & s, const char * suffix, size_t suffix_size)
}
}
std::string trim(const std::string & str, const std::function<bool(char)> & predicate)
{
std::string trimmed = str;
boost::trim_if(trimmed, predicate);
return trimmed;
}

View File

@ -133,3 +133,4 @@ inline bool equalsCaseInsensitive(char a, char b)
return a == b || (isAlphaASCII(a) && alternateCaseIfAlphaASCII(a) == b);
}
std::string trim(const std::string & str, const std::function<bool(char)> & predicate);