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

Function executeCreateQuery

src/Interpreters/loadMetadata.cpp:62–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62static void executeCreateQuery(
63 const String & query,
64 ContextMutablePtr context,
65 const String & database,
66 const String & file_name,
67 bool create,
68 bool has_force_restore_data_flag)
69{
70 const Settings & settings = context->getSettingsRef();
71 ParserCreateQuery parser;
72 ASTPtr ast = parseQuery(
73 parser,
74 query.data(),
75 query.data() + query.size(),
76 "in file " + file_name,
77 0,
78 settings[Setting::max_parser_depth],
79 settings[Setting::max_parser_backtracks]);
80
81 auto & ast_create_query = ast->as<ASTCreateQuery &>();
82 ast_create_query.setDatabase(database);
83
84 InterpreterCreateQuery interpreter(ast, context);
85 interpreter.setInternal(true);
86 if (!create)
87 {
88 interpreter.setForceAttach(true);
89 interpreter.setForceRestoreData(has_force_restore_data_flag);
90 }
91 interpreter.setLoadDatabaseWithoutTables(true);
92 interpreter.execute();
93}
94
95static bool isSystemOrInformationSchema(const String & database_name)
96{

Callers 2

loadDatabaseFunction · 0.85
loadSystemDatabaseImplFunction · 0.85

Calls 9

parseQueryFunction · 0.85
setInternalMethod · 0.80
setForceAttachMethod · 0.80
setForceRestoreDataMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
setDatabaseMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected