ClickHouse/dbms/Parsers/ParserShowQuotasQuery.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

43 lines
1020 B
C++

#include <Parsers/ParserShowQuotasQuery.h>
#include <Parsers/ASTShowQuotasQuery.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ExpressionElementParsers.h>
#include <Parsers/ASTLiteral.h>
#include <Parsers/parseIdentifierOrStringLiteral.h>
namespace DB
{
bool ParserShowQuotasQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
bool usage;
bool current;
if (ParserKeyword{"SHOW QUOTAS"}.ignore(pos, expected))
{
usage = false;
current = false;
}
else if (ParserKeyword{"SHOW QUOTA USAGE"}.ignore(pos, expected))
{
usage = true;
if (ParserKeyword{"ALL"}.ignore(pos, expected))
{
current = false;
}
else
{
ParserKeyword{"CURRENT"}.ignore(pos, expected);
current = true;
}
}
else
return false;
auto query = std::make_shared<ASTShowQuotasQuery>();
query->usage = usage;
query->current = current;
node = query;
return true;
}
}