mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 11:04:10 +00:00
310ed66b00
This reverts commit 6f4f44ce7980cace32edd0913b8d1d53cd51682b.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
||
|
||
#include <DB/Parsers/IAST.h>
|
||
#include <DB/Parsers/ASTQueryWithOutput.h>
|
||
|
||
|
||
namespace DB
|
||
{
|
||
|
||
|
||
/** Запрос с указанием названия таблицы и, возможно, БД и секцией FORMAT.
|
||
*/
|
||
class ASTQueryWithTableAndOutput : public ASTQueryWithOutput
|
||
{
|
||
public:
|
||
String database;
|
||
String table;
|
||
|
||
ASTQueryWithTableAndOutput() = default;
|
||
ASTQueryWithTableAndOutput(const StringRange range_) : ASTQueryWithOutput(range_) {}
|
||
};
|
||
|
||
|
||
/// Объявляет класс-наследник ASTQueryWithTableAndOutput с реализованными методами getID и clone.
|
||
#define DEFINE_AST_QUERY_WITH_TABLE_AND_OUTPUT(Name, ID) \
|
||
class Name : public ASTQueryWithTableAndOutput \
|
||
{ \
|
||
public: \
|
||
Name() = default; \
|
||
Name(const StringRange range_) : ASTQueryWithTableAndOutput(range_) {} \
|
||
String getID() const override { return ID"_" + database + "_" + table; }; \
|
||
\
|
||
ASTPtr clone() const override \
|
||
{ \
|
||
Name * res = new Name(*this); \
|
||
ASTPtr ptr{res}; \
|
||
res->children.clear(); \
|
||
if (format) \
|
||
{ \
|
||
res->format = format->clone(); \
|
||
res->children.push_back(res->format); \
|
||
} \
|
||
return ptr; \
|
||
} \
|
||
};
|
||
}
|