mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Slightly better code #3940
This commit is contained in:
parent
e21f414a34
commit
06095340c7
@ -28,29 +28,30 @@ public:
|
||||
if (!enabled_)
|
||||
return;
|
||||
|
||||
String full_comment;
|
||||
Lexer lexer(query.data(), query.data() + query.size());
|
||||
|
||||
for (Token token = lexer.nextToken(); !token.isEnd(); token = lexer.nextToken())
|
||||
{
|
||||
if (token.type == TokenType::Comment)
|
||||
full_comment += String(token.begin, token.begin + token.size()) + ' ';
|
||||
}
|
||||
|
||||
if (!full_comment.empty())
|
||||
{
|
||||
size_t pos_start = full_comment.find('{', 0);
|
||||
String comment(token.begin, token.begin + token.size());
|
||||
|
||||
if (!comment.empty())
|
||||
{
|
||||
size_t pos_start = comment.find('{', 0);
|
||||
if (pos_start != String::npos)
|
||||
{
|
||||
size_t pos_end = full_comment.find('}', pos_start);
|
||||
size_t pos_end = comment.find('}', pos_start);
|
||||
if (pos_end != String::npos)
|
||||
{
|
||||
String hint(full_comment.begin() + pos_start + 1, full_comment.begin() + pos_end);
|
||||
String hint(comment.begin() + pos_start + 1, comment.begin() + pos_end);
|
||||
parse(hint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @returns true if it's possible to continue without reconnect
|
||||
bool checkActual(int & actual_server_error, int & actual_client_error,
|
||||
|
Loading…
Reference in New Issue
Block a user