ClickHouse/dbms/include/DB/Parsers/ASTSelectQuery.h

53 lines
2.0 KiB
C
Raw Normal View History

2011-08-28 00:31:30 +00:00
#pragma once
2010-06-24 19:12:10 +00:00
#include <DB/Parsers/IAST.h>
namespace DB
{
/** SELECT запрос
*/
class ASTSelectQuery : public IAST
{
public:
2011-08-28 00:31:30 +00:00
ASTPtr select_expression_list;
ASTPtr database;
2011-11-06 02:29:13 +00:00
ASTPtr table; /// Идентификатор или подзапрос (рекурсивно ASTSelectQuery)
2011-08-28 00:31:30 +00:00
ASTPtr where_expression;
ASTPtr group_expression_list;
ASTPtr having_expression;
ASTPtr order_expression_list;
ASTPtr limit_offset;
ASTPtr limit_length;
2011-10-30 05:19:41 +00:00
ASTPtr format;
2012-08-22 18:46:09 +00:00
2010-06-25 16:36:13 +00:00
ASTSelectQuery() {}
2011-08-13 21:05:18 +00:00
ASTSelectQuery(StringRange range_) : IAST(range_) {}
2010-06-24 19:12:10 +00:00
2011-08-09 19:19:00 +00:00
/** Получить текст, который идентифицирует этот элемент. */
String getID() { return "SelectQuery"; };
2011-12-12 06:15:34 +00:00
ASTPtr clone() const
{
ASTSelectQuery * res = new ASTSelectQuery(*this);
res->children.clear();
if (select_expression_list) { res->select_expression_list = select_expression_list->clone(); res->children.push_back(res->select_expression_list); }
if (database) { res->database = database->clone(); res->children.push_back(res->database); }
if (table) { res->table = table->clone(); res->children.push_back(res->table); }
if (where_expression) { res->where_expression = where_expression->clone(); res->children.push_back(res->where_expression); }
if (group_expression_list) { res->group_expression_list = group_expression_list->clone(); res->children.push_back(res->group_expression_list); }
if (having_expression) { res->having_expression = having_expression->clone(); res->children.push_back(res->having_expression); }
if (order_expression_list) { res->order_expression_list = order_expression_list->clone(); res->children.push_back(res->order_expression_list); }
if (limit_offset) { res->limit_offset = limit_offset->clone(); res->children.push_back(res->limit_offset); }
if (limit_length) { res->limit_length = limit_length->clone(); res->children.push_back(res->limit_length); }
if (format) { res->format = format->clone(); res->children.push_back(res->format); }
return res;
}
2010-06-24 19:12:10 +00:00
};
}