2013-02-20 13:17:50 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2013-09-03 20:21:28 +00:00
|
|
|
|
/** Запрос с секцией FORMAT.
|
|
|
|
|
*/
|
|
|
|
|
class ASTQueryWithOutput : public IAST
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ASTPtr format;
|
|
|
|
|
|
|
|
|
|
ASTQueryWithOutput() {}
|
|
|
|
|
ASTQueryWithOutput(StringRange range_) : IAST(range_) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Объявляет класс-наследник ASTQueryWithOutput с реализованными методами getID и clone.
|
|
|
|
|
#define DEFINE_AST_QUERY_WITH_OUTPUT(Name, ID) \
|
|
|
|
|
class Name : public ASTQueryWithOutput \
|
|
|
|
|
{ \
|
|
|
|
|
public: \
|
|
|
|
|
Name() {} \
|
|
|
|
|
Name(StringRange range_) : ASTQueryWithOutput(range_) {} \
|
|
|
|
|
String getID() const { return ID; }; \
|
|
|
|
|
\
|
|
|
|
|
ASTPtr clone() const \
|
|
|
|
|
{ \
|
|
|
|
|
Name * res = new Name(*this); \
|
|
|
|
|
res->children.clear(); \
|
|
|
|
|
if (format) \
|
|
|
|
|
{ \
|
|
|
|
|
res->format = format->clone(); \
|
|
|
|
|
res->children.push_back(res->format); \
|
|
|
|
|
} \
|
|
|
|
|
return res; \
|
|
|
|
|
} \
|
|
|
|
|
};
|
|
|
|
|
|
2013-02-20 13:17:50 +00:00
|
|
|
|
}
|