blob: 5b5de962cc64ba7fcfef51890bac14cba1baee64 (
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
45
46
47
48
|
#pragma once
#include <Core/Block.h>
#include <Common/Throttler.h>
#include <IO/ConnectionTimeouts.h>
#include <Interpreters/ClientInfo.h>
namespace DB
{
class Connection;
class ReadBuffer;
struct Settings;
/** Allow to execute INSERT query on remote server and send data for it.
*/
class RemoteInserter
{
public:
RemoteInserter(
Connection & connection_,
const ConnectionTimeouts & timeouts,
const String & query_,
const Settings & settings_,
const ClientInfo & client_info_);
void write(Block block);
void onFinish();
/// Send pre-serialized and possibly pre-compressed block of data, that will be read from 'input'.
void writePrepared(ReadBuffer & buf, size_t size = 0);
~RemoteInserter();
const Block & getHeader() const { return header; }
UInt64 getServerRevision() const { return server_revision; }
private:
Connection & connection;
String query;
Block header;
bool finished = false;
UInt64 server_revision;
};
}
|