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;
|
2014-12-17 15:26:24 +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};
|
|
|
|
|
2022-06-23 07:59:13 +00:00
|
|
|
bool sync{false};
|
2020-03-20 00:07:52 +00:00
|
|
|
|
2020-11-30 17:52:32 +00:00
|
|
|
// We detach the object permanently, so it will not be reattached back during server restart.
|
|
|
|
bool permanently{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
|
|
|
|
2022-04-22 11:31:39 +00:00
|
|
|
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams & params) const override
|
2018-10-24 15:31:07 +00:00
|
|
|
{
|
2022-04-22 11:31:39 +00:00
|
|
|
return removeOnCluster<ASTDropQuery>(clone(), params.default_database);
|
2018-10-24 15:31:07 +00:00
|
|
|
}
|
2017-04-13 16:12:56 +00:00
|
|
|
|
2022-07-05 20:55:19 +00:00
|
|
|
QueryKind getQueryKind() const override { return QueryKind::Drop; }
|
2021-08-04 14:09:23 +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
|
|
|
};
|
|
|
|
|
|
|
|
}
|