ClickHouse/dbms/src/Parsers/ParserShowProcesslistQuery.h

43 lines
922 B
C++
Raw Normal View History

#pragma once
#include <Parsers/IParserBase.h>
#include <Parsers/ParserQueryWithOutput.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ExpressionElementParsers.h>
#include <Parsers/ASTShowProcesslistQuery.h>
namespace DB
{
2017-05-27 17:29:55 +00:00
/** Query SHOW PROCESSLIST
*/
class ParserShowProcesslistQuery : public IParserBase
{
protected:
const char * getName() const { return "SHOW PROCESSLIST query"; }
bool parseImpl(Pos & pos, Pos end, ASTPtr & node, Pos & max_parsed_pos, Expected & expected)
{
Pos begin = pos;
2017-06-15 17:55:57 +00:00
ParserWhitespaceOrComments ws;
auto query = std::make_shared<ASTShowProcesslistQuery>();
ws.ignore(pos, end);
if (!ParserKeyword("SHOW PROCESSLIST").ignore(pos, end, max_parsed_pos, expected))
return false;
ws.ignore(pos, end);
query->range = StringRange(begin, pos);
node = query;
return true;
}
};
}