1#include <Parsers/ParserShowQuotasQuery.h>
2#include <Parsers/ASTShowQuotasQuery.h>
3#include <Parsers/CommonParsers.h>
4#include <Parsers/ExpressionElementParsers.h>
5#include <Parsers/ASTLiteral.h>
6#include <Parsers/parseIdentifierOrStringLiteral.h>
7
8
9namespace DB
10{
11bool ParserShowQuotasQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
12{
13 bool usage;
14 bool current;
15 if (ParserKeyword{"SHOW QUOTAS"}.ignore(pos, expected))
16 {
17 usage = false;
18 current = false;
19 }
20 else if (ParserKeyword{"SHOW QUOTA USAGE"}.ignore(pos, expected))
21 {
22 usage = true;
23 if (ParserKeyword{"ALL"}.ignore(pos, expected))
24 {
25 current = false;
26 }
27 else
28 {
29 ParserKeyword{"CURRENT"}.ignore(pos, expected);
30 current = true;
31 }
32 }
33 else
34 return false;
35
36 auto query = std::make_shared<ASTShowQuotasQuery>();
37 query->usage = usage;
38 query->current = current;
39 node = query;
40 return true;
41}
42}
43