2011-10-30 05:19:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/ASTExpressionList.h>
|
|
|
|
#include <DB/Parsers/ASTFunction.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/** INSERT запрос
|
|
|
|
*/
|
|
|
|
class ASTInsertQuery : public IAST
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
String database;
|
|
|
|
String table;
|
|
|
|
ASTPtr columns;
|
|
|
|
String format;
|
|
|
|
ASTPtr select;
|
2014-03-24 13:59:04 +00:00
|
|
|
/// Идентификатор запроса INSERT. Используется при репликации.
|
|
|
|
String insert_id;
|
2011-10-30 05:19:41 +00:00
|
|
|
/// Данные для вставки
|
2014-04-08 07:31:51 +00:00
|
|
|
const char * data = nullptr;
|
|
|
|
const char * end = nullptr;
|
2011-10-30 05:19:41 +00:00
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTInsertQuery() = default;
|
|
|
|
ASTInsertQuery(const StringRange range_) : IAST(range_) {}
|
2011-10-30 05:19:41 +00:00
|
|
|
|
|
|
|
/** Получить текст, который идентифицирует этот элемент. */
|
2014-12-17 15:26:24 +00:00
|
|
|
String getID() const override { return "InsertQuery_" + database + "_" + table; };
|
2011-12-12 06:15:34 +00:00
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTPtr clone() const override
|
2011-12-12 06:15:34 +00:00
|
|
|
{
|
|
|
|
ASTInsertQuery * res = new ASTInsertQuery(*this);
|
2014-12-17 15:26:24 +00:00
|
|
|
ASTPtr ptr{res};
|
|
|
|
|
2011-12-12 06:15:34 +00:00
|
|
|
res->children.clear();
|
|
|
|
|
|
|
|
if (columns) { res->columns = columns->clone(); res->children.push_back(res->columns); }
|
|
|
|
if (select) { res->select = select->clone(); res->children.push_back(res->select); }
|
|
|
|
|
2014-12-17 15:26:24 +00:00
|
|
|
return ptr;
|
2011-12-12 06:15:34 +00:00
|
|
|
}
|
2011-10-30 05:19:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|