| 396 | } |
| 397 | |
| 398 | ASTPtr DatabaseBackup::getCreateQueryFromMetadata(const String & table_name, bool throw_on_error) const |
| 399 | { |
| 400 | std::lock_guard lock{table_name_to_create_query_mutex}; |
| 401 | |
| 402 | auto it = table_name_to_create_query.find(table_name); |
| 403 | if (it == table_name_to_create_query.end()) |
| 404 | { |
| 405 | if (throw_on_error) |
| 406 | throw Exception(ErrorCodes::CANNOT_GET_CREATE_TABLE_QUERY, "Table {} does not exist", table_name); |
| 407 | |
| 408 | return {}; |
| 409 | } |
| 410 | |
| 411 | auto create_query = it->second->clone(); |
| 412 | |
| 413 | auto & create_query_typed = create_query->as<ASTCreateQuery &>(); |
| 414 | create_query_typed.attach = false; |
| 415 | create_query_typed.setDatabase(getDatabaseName()); |
| 416 | |
| 417 | return create_query; |
| 418 | } |
| 419 | |
| 420 | ASTPtr DatabaseBackup::getCreateDatabaseQueryImpl() const |
| 421 | { |
nothing calls this directly
no test coverage detected