2019-07-04 18:55:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/Formats/IRowOutputFormat.h>
|
|
|
|
#include <Core/Block.h>
|
|
|
|
|
|
|
|
#include <Core/MySQLProtocol.h>
|
|
|
|
#include <Formats/FormatSettings.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IColumn;
|
|
|
|
class IDataType;
|
|
|
|
class WriteBuffer;
|
|
|
|
class Context;
|
|
|
|
|
|
|
|
/** A stream for outputting data in a binary line-by-line format.
|
|
|
|
*/
|
|
|
|
class MySQLOutputFormat: public IOutputFormat
|
|
|
|
{
|
|
|
|
public:
|
2019-08-03 11:02:40 +00:00
|
|
|
MySQLOutputFormat(WriteBuffer & out_, const Block & header_, const Context & context_, const FormatSettings & settings_);
|
2019-07-04 18:55:20 +00:00
|
|
|
|
|
|
|
String getName() const override { return "MySQLOutputFormat"; }
|
|
|
|
|
|
|
|
void consume(Chunk) override;
|
|
|
|
void finalize() override;
|
2019-08-02 12:41:21 +00:00
|
|
|
void flush() override;
|
2019-08-05 09:35:46 +00:00
|
|
|
void doWritePrefix() override { initialize(); }
|
|
|
|
|
|
|
|
void initialize();
|
|
|
|
|
2019-07-04 18:55:20 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
bool initialized = false;
|
|
|
|
|
|
|
|
const Context & context;
|
2019-08-02 12:41:21 +00:00
|
|
|
MySQLProtocol::PacketSender packet_sender;
|
2019-07-04 18:55:20 +00:00
|
|
|
FormatSettings format_settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|