ClickHouse/dbms/src/Parsers/ASTInsertQuery.h

52 lines
1.2 KiB
C++
Raw Normal View History

2011-10-30 05:19:41 +00:00
#pragma once
#include <Parsers/IAST.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:
String database;
String table;
ASTPtr columns;
String format;
ASTPtr select;
ASTPtr table_function;
// Set to true if the data should only be inserted into attached views
bool no_destination = false;
2017-05-27 17:27:16 +00:00
/// Data to insert
const char * data = nullptr;
const char * end = nullptr;
2017-05-27 17:27:16 +00:00
/** Get the text that identifies this element. */
String getID() const override { return "InsertQuery_" + database + "_" + table; }
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);
}
return res;
}
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
2011-10-30 05:19:41 +00:00
};
}