ClickHouse/src/Processors/Formats/Impl/ODBCDriver2BlockOutputFormat.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.3 KiB
C++
Raw Normal View History

2019-02-19 18:41:18 +00:00
#pragma once
#include <string>
#include <Core/Block.h>
#include <Processors/Formats/IOutputFormat.h>
#include <Formats/FormatSettings.h>
namespace DB
{
class WriteBuffer;
/** A data format designed to simplify the implementation of the ODBC driver.
* ODBC driver is designed to be build for different platforms without dependencies from the main code,
* so the format is made that way so that it can be as easy as possible to parse it.
* A header is displayed with the required information.
* The data is then output in the order of the rows. Each value is displayed as follows: length in Int32 format (-1 for NULL), then data in text form.
*/
class ODBCDriver2BlockOutputFormat final : public IOutputFormat
{
public:
2019-08-03 11:02:40 +00:00
ODBCDriver2BlockOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings_);
2019-02-19 18:41:18 +00:00
String getName() const override { return "ODBCDriver2BlockOutputFormat"; }
std::string getContentType() const override
{
return "application/octet-stream";
}
private:
2021-11-02 13:40:41 +00:00
void consume(Chunk) override;
void consumeTotals(Chunk) override;
void writePrefix() override;
2019-02-19 18:41:18 +00:00
2021-11-02 13:40:41 +00:00
const FormatSettings format_settings;
2022-05-06 16:48:48 +00:00
Serializations serializations;
2019-02-19 18:41:18 +00:00
2022-05-06 16:48:48 +00:00
void writeRow(const Columns & columns, size_t row_idx, std::string & buffer);
2019-02-19 18:41:18 +00:00
void write(Chunk chunk, PortKind port_kind);
};
}