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

Method createTable

src/Databases/DatabaseMemory.cpp:36–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void DatabaseMemory::createTable(
37 ContextPtr /*context*/,
38 const String & table_name,
39 const StoragePtr & table,
40 const ASTPtr & query)
41{
42 std::lock_guard lock{mutex};
43 attachTableUnlocked(table_name, table);
44
45 /// Clean the query from temporary flags.
46 ASTPtr query_to_store = query;
47 if (query)
48 {
49 query_to_store = query->clone();
50 auto * create = query_to_store->as<ASTCreateQuery>();
51 if (!create)
52 throw Exception(ErrorCodes::LOGICAL_ERROR, "Query '{}' is not CREATE query", query->formatForErrorMessage());
53 cleanupObjectDefinitionFromTemporaryFlags(*create);
54 }
55
56 create_queries.emplace(table_name, query_to_store);
57}
58
59void DatabaseMemory::dropTable(
60 ContextPtr /*context*/,

Callers

nothing calls this directly

Calls 5

ExceptionClass · 0.50
cloneMethod · 0.45
formatForErrorMessageMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected