2011-11-05 23:31:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-18 15:03:14 +00:00
|
|
|
#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
|
2018-05-05 16:14:06 +00:00
|
|
|
{
|
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
|
|
|
*/
|
2018-10-18 15:03:14 +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;
|
2017-04-01 07:20:54 +00:00
|
|
|
bool if_exists{false};
|
2011-11-05 23:31:19 +00:00
|
|
|
|
2019-03-11 16:50:31 +00:00
|
|
|
/// Useful if we already have a DDL lock
|
|
|
|
bool no_ddl_lock{false};
|
|
|
|
|
2019-10-08 11:10:29 +00:00
|
|
|
/// We dropping dictionary, so print correct word
|
|
|
|
bool is_dictionary{false};
|
|
|
|
|
2020-03-23 22:28:30 +00:00
|
|
|
/// Same as above
|
|
|
|
bool is_view{false};
|
|
|
|
|
2020-03-20 00:07:52 +00:00
|
|
|
bool no_delay{false};
|
|
|
|
|
2017-05-27 17:27:16 +00:00
|
|
|
/** Get the text that identifies this element. */
|
2018-12-07 12:34:40 +00:00
|
|
|
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
|
|
|
|
2018-10-24 15:31:07 +00:00
|
|
|
ASTPtr getRewrittenASTWithoutOnCluster(const std::string & new_database) const override
|
|
|
|
{
|
|
|
|
return removeOnCluster<ASTDropQuery>(clone(), new_database);
|
|
|
|
}
|
2017-04-13 16:12:56 +00:00
|
|
|
|
2015-08-05 21:38:31 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|