2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ParserKillQueryQuery.h>
|
|
|
|
#include <Parsers/ASTKillQueryQuery.h>
|
|
|
|
|
|
|
|
#include <Parsers/CommonParsers.h>
|
|
|
|
#include <Parsers/ExpressionListParsers.h>
|
|
|
|
|
2016-11-30 17:31:05 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2017-07-10 03:28:12 +00:00
|
|
|
bool ParserKillQueryQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
2016-11-30 17:31:05 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
auto query = std::make_shared<ASTKillQueryQuery>();
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-07-10 03:28:12 +00:00
|
|
|
if (!ParserKeyword{"KILL QUERY"}.ignore(pos, expected))
|
2017-04-01 07:20:54 +00:00
|
|
|
return false;
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-07-10 03:28:12 +00:00
|
|
|
if (!ParserKeyword{"WHERE"}.ignore(pos, expected))
|
2017-04-01 07:20:54 +00:00
|
|
|
return false;
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-07-12 02:42:34 +00:00
|
|
|
ParserExpression p_where_expression;
|
2017-07-10 03:28:12 +00:00
|
|
|
if (!p_where_expression.parse(pos, query->where_expression, expected))
|
2017-04-01 07:20:54 +00:00
|
|
|
return false;
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-07-10 03:28:12 +00:00
|
|
|
if (ParserKeyword{"SYNC"}.ignore(pos))
|
2017-04-01 07:20:54 +00:00
|
|
|
query->sync = true;
|
2017-07-10 03:28:12 +00:00
|
|
|
else if (ParserKeyword{"ASYNC"}.ignore(pos))
|
2017-04-01 07:20:54 +00:00
|
|
|
query->sync = false;
|
2017-07-10 03:28:12 +00:00
|
|
|
else if (ParserKeyword{"TEST"}.ignore(pos))
|
2017-04-01 07:20:54 +00:00
|
|
|
query->test = true;
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
node = std::move(query);
|
2016-11-30 17:31:05 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
return true;
|
2016-11-30 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|