ClickHouse/dbms/src/Parsers/ASTDropQuery.h

39 lines
786 B
C++
Raw Normal View History

2011-11-05 23:31:19 +00:00
#pragma once
#include <Parsers/ASTQueryWithTableAndOutput.h>
2017-04-21 12:39:28 +00:00
#include <Parsers/ASTQueryWithOnCluster.h>
2011-11-05 23:31:19 +00:00
2018-06-09 16:03:07 +00:00
namespace DB
{
2011-11-05 23:31:19 +00:00
2017-05-27 17:27:16 +00:00
/** DROP query
2011-11-05 23:31:19 +00:00
*/
class ASTDropQuery : public ASTQueryWithTableAndOutput, public ASTQueryWithOnCluster
2011-11-05 23:31:19 +00:00
{
public:
2018-04-21 00:35:20 +00:00
enum Kind
{
Drop,
Detach,
Truncate,
};
Kind kind;
bool if_exists{false};
2011-11-05 23:31:19 +00:00
2017-05-27 17:27:16 +00:00
/** Get the text that identifies this element. */
String getID(char) const override;
2018-06-09 16:03:07 +00:00
ASTPtr clone() const override;
2011-12-12 06:15:34 +00:00
ASTPtr getRewrittenASTWithoutOnCluster(const std::string & new_database) const override
{
return removeOnCluster<ASTDropQuery>(clone(), new_database);
}
protected:
2018-06-09 16:03:07 +00:00
void formatQueryImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
2011-11-05 23:31:19 +00:00
};
}