| 60 | } |
| 61 | |
| 62 | static 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 | |
| 95 | static bool isSystemOrInformationSchema(const String & database_name) |
| 96 | { |
no test coverage detected