MCPcopy Create free account
hub / github.com/ByConity/ByConity / getTableOutput

Function getTableOutput

src/Databases/MySQL/MaterializeMySQLSyncThread.cpp:260–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260static inline BlockOutputStreamPtr
261getTableOutput(const String & database_name, const String & table_name, ContextMutablePtr query_context, bool insert_delete_flag_column = false)
262{
263 const StoragePtr & storage = DatabaseCatalog::instance().getTable(StorageID(database_name, table_name), query_context);
264
265 WriteBufferFromOwnString insert_columns_str;
266 const StorageInMemoryMetadata & storage_metadata = storage->getInMemoryMetadata();
267 const ColumnsDescription & storage_columns = storage_metadata.getColumns();
268 const NamesAndTypesList & insert_columns_names = storage_columns.getOrdinary();
269
270
271 for (auto iterator = insert_columns_names.begin(); iterator != insert_columns_names.end(); ++iterator)
272 {
273 if (iterator != insert_columns_names.begin())
274 insert_columns_str << ", ";
275
276 insert_columns_str << backQuoteIfNeed(iterator->name);
277 }
278 if (insert_delete_flag_column)
279 {
280 insert_columns_str << ", " << backQuoteIfNeed(StorageInMemoryMetadata::DELETE_FLAG_COLUMN_NAME);
281 }
282
283 String comment = "Materialize MySQL step 1: execute dump data";
284 BlockIO res = tryToExecuteQuery("INSERT INTO " + backQuoteIfNeed(table_name) + "(" + insert_columns_str.str() + ")" + " VALUES",
285 query_context, database_name, comment);
286
287 if (!res.out)
288 throw Exception("LOGICAL ERROR: It is a bug.", ErrorCodes::LOGICAL_ERROR);
289
290 return res.out;
291}
292
293static inline UInt32 randomNumber()
294{

Callers 1

commitMethod · 0.70

Calls 11

backQuoteIfNeedFunction · 0.85
getInMemoryMetadataMethod · 0.80
getOrdinaryMethod · 0.80
tryToExecuteQueryFunction · 0.70
StorageIDClass · 0.50
ExceptionClass · 0.50
getTableMethod · 0.45
getColumnsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected