ClickHouse/src/Parsers/ParserDescribeCacheQuery.cpp
2022-09-19 14:02:51 +02:00

35 lines
826 B
C++

#include <Parsers/ParserDescribeCacheQuery.h>
#include <Parsers/ASTDescribeCacheQuery.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ASTLiteral.h>
namespace DB
{
bool ParserDescribeCacheQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserKeyword p_describe("DESCRIBE");
ParserKeyword p_desc("DESC");
ParserKeyword p_cache("FILESYSTEM CACHE");
ParserLiteral p_cache_name;
if ((!p_describe.ignore(pos, expected) && !p_desc.ignore(pos, expected))
|| !p_cache.ignore(pos, expected))
return false;
auto query = std::make_shared<ASTDescribeCacheQuery>();
ASTPtr ast;
if (!p_cache_name.parse(pos, ast, expected))
return false;
query->cache_name = ast->as<ASTLiteral>()->value.safeGet<String>();
node = query;
return true;
}
}