| 1087 | |
| 1088 | |
| 1089 | void Connection::sendData(const Block & block, const String & name, bool scalar) |
| 1090 | { |
| 1091 | if (!block_out) |
| 1092 | { |
| 1093 | if (compression == Protocol::Compression::Enable) |
| 1094 | maybe_compressed_out = std::make_unique<CompressedWriteBuffer>(*out, compression_codec); |
| 1095 | else |
| 1096 | maybe_compressed_out = out; |
| 1097 | |
| 1098 | block_out = std::make_unique<NativeWriter>(*maybe_compressed_out, server_revision, std::make_shared<const Block>(block.cloneEmpty()), format_settings); |
| 1099 | } |
| 1100 | |
| 1101 | if (scalar) |
| 1102 | writeVarUInt(Protocol::Client::Scalar, *out); |
| 1103 | else |
| 1104 | writeVarUInt(Protocol::Client::Data, *out); |
| 1105 | writeStringBinary(name, *out); |
| 1106 | |
| 1107 | size_t prev_bytes = out->count(); |
| 1108 | |
| 1109 | block_out->write(block); |
| 1110 | if (maybe_compressed_out != out) |
| 1111 | maybe_compressed_out->next(); |
| 1112 | if (block.empty()) |
| 1113 | out->finishChunk(); |
| 1114 | out->next(); |
| 1115 | |
| 1116 | if (throttler) |
| 1117 | throttler->throttle(out->count() - prev_bytes); |
| 1118 | } |
| 1119 | |
| 1120 | void Connection::sendClusterFunctionReadTaskResponse(const ClusterFunctionReadTaskResponse & response) |
| 1121 | { |
no test coverage detected