ClickHouse/src/Parsers/ASTInsertQuery.h

53 lines
1.5 KiB
C++
Raw Normal View History

2011-10-30 05:19:41 +00:00
#pragma once
#include <Parsers/IAST.h>
2020-03-13 10:30:55 +00:00
#include <Interpreters/StorageID.h>
2011-10-30 05:19:41 +00:00
namespace DB
{
2017-05-27 17:27:16 +00:00
/** INSERT query
2011-10-30 05:19:41 +00:00
*/
class ASTInsertQuery : public IAST
{
public:
2020-03-02 20:23:58 +00:00
StorageID table_id = StorageID::createEmpty();
ASTPtr columns;
String format;
ASTPtr select;
ASTPtr table_function;
ASTPtr settings_ast;
2017-05-27 17:27:16 +00:00
/// Data to insert
const char * data = nullptr;
const char * end = nullptr;
2019-02-08 13:24:24 +00:00
/// Query has additional data, which will be sent later
bool has_tail = false;
/// Try to find table function input() in SELECT part
2019-05-30 21:33:06 +00:00
void tryFindInputFunction(ASTPtr & input_function) const;
2017-05-27 17:27:16 +00:00
/** Get the text that identifies this element. */
2020-03-02 20:23:58 +00:00
String getID(char delim) const override { return "InsertQuery" + (delim + table_id.database_name) + delim + table_id.table_name; }
ASTPtr clone() const override
{
auto res = std::make_shared<ASTInsertQuery>(*this);
res->children.clear();
if (columns) { res->columns = columns->clone(); res->children.push_back(res->columns); }
2018-11-26 00:56:50 +00:00
if (select) { res->select = select->clone(); res->children.push_back(res->select); }
if (table_function) { res->table_function = table_function->clone(); res->children.push_back(res->table_function); }
if (settings_ast) { res->settings_ast = settings_ast->clone(); res->children.push_back(res->settings_ast); }
return res;
}
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
2011-10-30 05:19:41 +00:00
};
}