1#pragma once
2
3#include <Parsers/ASTQueryWithTableAndOutput.h>
4#include <Parsers/ASTQueryWithOnCluster.h>
5
6
7namespace DB
8{
9
10/** DROP query
11 */
12class ASTDropQuery : public ASTQueryWithTableAndOutput, public ASTQueryWithOnCluster
13{
14public:
15 enum Kind
16 {
17 Drop,
18 Detach,
19 Truncate,
20 };
21
22 Kind kind;
23 bool if_exists{false};
24
25 /// Useful if we already have a DDL lock
26 bool no_ddl_lock{false};
27
28 /// We dropping dictionary, so print correct word
29 bool is_dictionary{false};
30
31 /** Get the text that identifies this element. */
32 String getID(char) const override;
33 ASTPtr clone() const override;
34
35 ASTPtr getRewrittenASTWithoutOnCluster(const std::string & new_database) const override
36 {
37 return removeOnCluster<ASTDropQuery>(clone(), new_database);
38 }
39
40protected:
41 void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
42};
43
44}
45