MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / writeBlockData

Method writeBlockData

src/Storages/StorageMySQL.cpp:207–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 }
206
207 void writeBlockData(const Block & block)
208 {
209 WriteBufferFromOwnString sqlbuf;
210 sqlbuf << (storage.replace_query ? "REPLACE" : "INSERT") << " INTO ";
211 if (!remote_database_name.empty())
212 sqlbuf << backQuoteMySQL(remote_database_name) << ".";
213 sqlbuf << backQuoteMySQL(remote_table_name);
214 sqlbuf << " (" << dumpNamesWithBackQuote(block) << ") VALUES ";
215
216 auto writer = FormatFactory::instance().getOutputFormat("Values", sqlbuf, metadata_snapshot->getSampleBlock(), storage.getContext());
217 writer->write(block);
218
219 if (!storage.on_duplicate_clause.empty())
220 sqlbuf << " ON DUPLICATE KEY " << storage.on_duplicate_clause;
221
222 sqlbuf << ";";
223
224 auto query = this->entry->query(sqlbuf.str());
225 query.execute();
226 }
227
228 Blocks splitBlocks(const Block & block, const size_t & max_rows) const
229 {

Callers

nothing calls this directly

Calls 9

backQuoteMySQLFunction · 0.85
emptyMethod · 0.45
getOutputFormatMethod · 0.45
getSampleBlockMethod · 0.45
getContextMethod · 0.45
writeMethod · 0.45
queryMethod · 0.45
strMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected