diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-07-15 19:33:12 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 20:39:15 +0100 |
commit | 2b312c7bd23710ede145d2ec2ccd04ea4f1fc5bf (patch) | |
tree | eef9d410330eed25f6bd02152287d98217c26625 /src/server/database/Updater/DBUpdater.cpp | |
parent | 596bf2b77218e6b959c1bf7de848c6f09d5a91f0 (diff) |
Dep: Switch to boost process instead of old standalone version
(cherry picked from commit 524d16739861d0b2279e2270e319b0c77ec9b03b)
Diffstat (limited to 'src/server/database/Updater/DBUpdater.cpp')
-rw-r--r-- | src/server/database/Updater/DBUpdater.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index 3c5cca95a05..34b3fc8f8a6 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -364,46 +364,43 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos Path const& path) { std::vector<std::string> args; - args.reserve(8); - - // args[0] represents the program name - args.push_back("mysql"); + args.reserve(7); // CLI Client connection info - args.push_back("-h" + host); - args.push_back("-u" + user); + args.emplace_back("-h" + host); + args.emplace_back("-u" + user); if (!password.empty()) - args.push_back("-p" + password); + args.emplace_back("-p" + password); // Check if we want to connect through ip or socket (Unix only) #ifdef _WIN32 if (host == ".") - args.push_back("--protocol=PIPE"); + args.emplace_back("--protocol=PIPE"); else - args.push_back("-P" + port_or_socket); + args.emplace_back("-P" + port_or_socket); #else if (!std::isdigit(port_or_socket[0])) { // We can't check if host == "." here, because it is named localhost if socket option is enabled - args.push_back("-P0"); - args.push_back("--protocol=SOCKET"); - args.push_back("-S" + port_or_socket); + args.emplace_back("-P0"); + args.emplace_back("--protocol=SOCKET"); + args.emplace_back("-S" + port_or_socket); } else // generic case - args.push_back("-P" + port_or_socket); + args.emplace_back("-P" + port_or_socket); #endif // Set the default charset to utf8 - args.push_back("--default-character-set=utf8"); + args.emplace_back("--default-character-set=utf8"); // Set max allowed packet to 1 GB - args.push_back("--max-allowed-packet=1GB"); + args.emplace_back("--max-allowed-packet=1GB"); #if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80000 @@ -413,13 +410,13 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos #else if (ssl == "ssl") - args.push_back("--ssl"); + args.emplace_back("--ssl"); #endif // Database if (!database.empty()) - args.push_back(database); + args.emplace_back(database); // Invokes a mysql process which doesn't leak credentials to logs int const ret = Trinity::StartProcess(DBUpdaterUtil::GetCorrectedMySQLExecutable(), args, |