[Cleanup] Move variable definition to more relevant scope in DatabaseDumpService::Dump() (#3200)

# Notes
- This was unused except for in this one spot, move to scope of condition where it's used.
- https://pvs-studio.com/en/docs/warnings/v821/
This commit is contained in:
Alex King 2023-04-05 11:26:21 -04:00 committed by GitHub
parent d142bc552a
commit c6bb0f6495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -295,14 +295,6 @@ void DatabaseDumpService::DatabaseDump()
pipe_file = fmt::format(" > {}.sql", GetDumpFileNameWithPath());
}
std::string execute_command = fmt::format(
"{} {} {} {}",
GetBaseMySQLDumpCommand(),
options,
tables_to_dump,
pipe_file
);
if (!File::Exists(GetSetDumpPath()) && !IsDumpOutputToConsole()) {
File::Makedir(GetSetDumpPath());
}
@ -319,6 +311,14 @@ void DatabaseDumpService::DatabaseDump()
}
}
else {
const auto execute_command = fmt::format(
"{} {} {} {}",
GetBaseMySQLDumpCommand(),
options,
tables_to_dump,
pipe_file
);
std::string execution_result = Process::execute(execute_command);
if (!execution_result.empty() && IsDumpOutputToConsole()) {
std::cout << execution_result;