1 | #pragma once |
2 | |
3 | #include <Parsers/IParserBase.h> |
4 | #include <Parsers/ExpressionElementParsers.h> |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | /** Query like this: |
10 | * ALTER TABLE [db.]name [ON CLUSTER cluster] |
11 | * [ADD COLUMN [IF NOT EXISTS] col_name type [AFTER col_after],] |
12 | * [DROP COLUMN [IF EXISTS] col_to_drop, ...] |
13 | * [CLEAR COLUMN [IF EXISTS] col_to_clear [IN PARTITION partition],] |
14 | * [MODIFY COLUMN [IF EXISTS] col_to_modify type, ...] |
15 | * [MODIFY PRIMARY KEY (a, b, c...)] |
16 | * [MODIFY SETTING setting_name=setting_value, ...] |
17 | * [COMMENT COLUMN [IF EXISTS] col_name string] |
18 | * [DROP|DETACH|ATTACH PARTITION|PART partition, ...] |
19 | * [FETCH PARTITION partition FROM ...] |
20 | * [FREEZE [PARTITION] [WITH NAME name]] |
21 | * [DELETE WHERE ...] |
22 | * [UPDATE col_name = expr, ... WHERE ...] |
23 | * ALTER LIVE VIEW [db.name] |
24 | * [REFRESH] |
25 | */ |
26 | |
27 | class ParserAlterQuery : public IParserBase |
28 | { |
29 | protected: |
30 | const char * getName() const { return "ALTER query" ; } |
31 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected); |
32 | }; |
33 | |
34 | |
35 | class ParserAlterCommandList : public IParserBase |
36 | { |
37 | protected: |
38 | const char * getName() const { return "a list of ALTER commands" ; } |
39 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected); |
40 | |
41 | public: |
42 | bool is_live_view; |
43 | |
44 | ParserAlterCommandList(bool is_live_view_ = false) : is_live_view(is_live_view_) {} |
45 | }; |
46 | |
47 | |
48 | class ParserAlterCommand : public IParserBase |
49 | { |
50 | protected: |
51 | const char * getName() const { return "ALTER command" ; } |
52 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected); |
53 | |
54 | public: |
55 | bool is_live_view; |
56 | |
57 | ParserAlterCommand(bool is_live_view_ = false) : is_live_view(is_live_view_) {} |
58 | }; |
59 | |
60 | |
61 | /// Part of the UPDATE command of the form: col_name = expr |
62 | class ParserAssignment : public IParserBase |
63 | { |
64 | protected: |
65 | const char * getName() const { return "column assignment" ; } |
66 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected); |
67 | }; |
68 | |
69 | } |
70 | |