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:
|
|
|
|
MySQLOutputFormat(WriteBuffer & out_, const Block & header, const Context & context, const FormatSettings & settings);
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|