5#ifndef TABLEAU_HYPER_INSERTER_HPP
6#define TABLEAU_HYPER_INSERTER_HPP
12#include <hyperapi/hyperapi.h>
60 std::string asSelectListExpression()
const;
193 Inserter(
Connection& connection,
const TableName& name, std::vector<Inserter::ColumnMapping> columnMappings, std::vector<TableDefinition::Column> inserterDefinition);
250 template <typename ValueType>
261 template <typename... ValueTypes>
306 void newChunk() noexcept;
319 internal::HyperTableDefinition tableDefinitionHandle_;
323 internal::HyperTableDefinition streamDefinitionHandle_;
325 hyper_inserter_t* inserter_ =
nullptr;
327 std::vector<uint8_t> currentChunk_;
329 size_t chunkOffset_ = 0;
331 size_t headerSize_ = 0;
333 hyper_field_index_t currentField_ = 0;
335 std::
string selectList_;
337 friend class InserterTest;
338 friend struct internal::ValueInserter;
342#include <hyperapi/impl/Inserter.impl.hpp>
Defines a Hyper connection.
Maps an expression to a column
const Name & getColumnName() const noexcept
Returns the name of the column.
optional< std::string > getExpression() const noexcept
Returns the expression mapped to the column.
ColumnMapping(Name name, std::string expression)
Creates a column mapping.
ColumnMapping(Name name)
Creates a column mapping.
Inserter(Connection &connection, hyperapi::TableDefinition tableDefinition)
Creates an inserter on a table.
void execute()
Submits the previously added data.
Inserter & endRow()
Advances the inserter to the next row.
Inserter(Connection &connection, const hyperapi::TableDefinition &tableDefinition, std::vector< std::string > columns)
Creates an inserter on a table.
Inserter & addRow(ValueTypes... values)
Inserts all given values.
Inserter & add(ValueType value)
Sets the current field to the given value.
bool isOpen() const noexcept
Returns whether the inserter is open.
Inserter(Connection &connection, const TableName &name, std::vector< Inserter::ColumnMapping > columnMappings, std::vector< TableDefinition::Column > inserterDefinition)
Creates an inserter for an existing table.
Inserter(Connection &connection, const hyperapi::TableDefinition &tableDefinition, std::vector< Inserter::ColumnMapping > columnMappings, std::vector< TableDefinition::Column > inserterDefinition)
Creates an inserter for an existing table.
Inserter()
Constructs an Inserter object that does not represent an inserter.
void close() noexcept
Closes the inserter.
Inserter(Connection &connection, const TableName &name)
Creates an inserter on a table.
~Inserter() noexcept
Destroys the inserter.
Inserter(Connection &connection, const TableName &name, std::vector< std::string > columns)
Creates an inserter on a table.
Represents an escaped SQL name.
Represents an escaped SQL table name.
Surrogate for C++17 std::optional
The primary namespace of the Hyper API for C++.