mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-20 06:32:08 +00:00
37 lines
845 B
C++
37 lines
845 B
C++
#pragma once
|
|
|
|
#include <Core/MySQLProtocol.h>
|
|
#include <DataStreams/IBlockOutputStream.h>
|
|
#include <Formats/FormatFactory.h>
|
|
#include <Formats/FormatSettings.h>
|
|
#include <Interpreters/Context.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Interface for writing rows in MySQL Client/Server Protocol format.
|
|
*/
|
|
class MySQLWireBlockOutputStream : public IBlockOutputStream
|
|
{
|
|
public:
|
|
MySQLWireBlockOutputStream(WriteBuffer & buf, const Block & header, Context & context);
|
|
|
|
Block getHeader() const { return header; }
|
|
|
|
void write(const Block & block);
|
|
|
|
void writePrefix();
|
|
void writeSuffix();
|
|
|
|
void flush();
|
|
private:
|
|
Block header;
|
|
Context & context;
|
|
std::shared_ptr<MySQLProtocol::PacketSender> packet_sender;
|
|
FormatSettings format_settings;
|
|
};
|
|
|
|
using MySQLWireBlockOutputStreamPtr = std::shared_ptr<MySQLWireBlockOutputStream>;
|
|
|
|
}
|