#pragma once #include #include #include #include #include namespace DB { /** Запрос SHOW PROCESSLIST */ class ParserShowProcesslistQuery : public IParserBase { protected: const char * getName() const { return "SHOW PROCESSLIST query"; } bool parseImpl(Pos & pos, Pos end, ASTPtr & node, Expected & expected) { Pos begin = pos; ParserWhiteSpaceOrComments ws; ParserString s_show("SHOW", true, true); ParserString s_processlist("PROCESSLIST", true, true); ParserString s_format("FORMAT", true, true); ASTPtr format; ws.ignore(pos, end); if (!s_show.ignore(pos, end, expected)) return false; ws.ignore(pos, end); if (!s_processlist.ignore(pos, end, expected)) return false; ws.ignore(pos, end); if (s_format.ignore(pos, end, expected)) { ws.ignore(pos, end); ParserIdentifier format_p; if (!format_p.parse(pos, end, format, expected)) return false; typeid_cast(*format).kind = ASTIdentifier::Format; ws.ignore(pos, end); } ASTShowProcesslistQuery * query = new ASTShowProcesslistQuery(StringRange(begin, pos)); query->format = format; node = query; return true; } }; }