From c6bb0f6495e7cea696eac88afb331b3fe6035b9e Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:26:21 -0400 Subject: [PATCH] [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/ --- common/database/database_dump_service.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/database/database_dump_service.cpp b/common/database/database_dump_service.cpp index 5aaf0a065..049911b68 100644 --- a/common/database/database_dump_service.cpp +++ b/common/database/database_dump_service.cpp @@ -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;