2016-01-13 02:20:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-21 04:24:28 +00:00
|
|
|
#include <string>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataStreams/IBlockOutputStream.h>
|
2018-06-10 19:22:49 +00:00
|
|
|
#include <Formats/FormatSettings.h>
|
2017-04-26 14:31:25 +00:00
|
|
|
#include <Core/Block.h>
|
2016-01-13 02:20:12 +00:00
|
|
|
|
2018-06-08 01:51:55 +00:00
|
|
|
|
2016-01-13 02:20:12 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-08-13 01:57:35 +00:00
|
|
|
class WriteBuffer;
|
|
|
|
|
|
|
|
|
2017-05-13 22:19:04 +00:00
|
|
|
/** 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 VarUInt format, then data in text form.
|
2016-01-13 02:20:12 +00:00
|
|
|
*/
|
|
|
|
class ODBCDriverBlockOutputStream : public IBlockOutputStream
|
|
|
|
{
|
|
|
|
public:
|
2018-06-08 01:51:55 +00:00
|
|
|
ODBCDriverBlockOutputStream(WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings);
|
2016-01-13 02:20:12 +00:00
|
|
|
|
2018-02-19 00:45:32 +00:00
|
|
|
Block getHeader() const override { return header; }
|
2017-04-01 07:20:54 +00:00
|
|
|
void write(const Block & block) override;
|
2017-04-19 13:42:58 +00:00
|
|
|
void writePrefix() override;
|
2016-01-13 02:20:12 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void flush() override;
|
|
|
|
std::string getContentType() const override { return "application/octet-stream"; }
|
2016-01-13 02:20:12 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
WriteBuffer & out;
|
2018-02-19 00:45:32 +00:00
|
|
|
const Block header;
|
2018-06-08 01:51:55 +00:00
|
|
|
const FormatSettings format_settings;
|
2016-01-13 02:20:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|