aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/MySQLOutputFormat.h
blob: 9481ef670703ded7c8d534f39461eaff7c56bc84 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <Processors/Formats/IRowOutputFormat.h>
#include <Core/Block.h>

#include <Core/MySQL/PacketEndpoint.h>
#include <Processors/Formats/IOutputFormat.h>


namespace DB
{

class IColumn;
class IDataType;
class WriteBuffer;
struct FormatSettings;

/** A stream for outputting data in a binary line-by-line format.
  */
class MySQLOutputFormat final : public IOutputFormat, WithContext
{
public:
    MySQLOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & settings_);

    String getName() const override { return "MySQLOutputFormat"; }

    void setContext(ContextPtr context_);

    void flush() override;

private:
    void consume(Chunk) override;
    void finalizeImpl() override;
    void writePrefix() override;

    uint32_t client_capabilities = 0;
    uint8_t * sequence_id = nullptr;
    uint8_t dummy_sequence_id = 0;
    MySQLProtocol::PacketEndpointPtr packet_endpoint;
    DataTypes data_types;
    Serializations serializations;
};

}