mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +00:00
feat(Core/DBUpdater): Apply each sql update file in a separate transa… (#12842)
cherry-pick: b79a91039b
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -441,7 +441,7 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
|
|||||||
std::string const& password, std::string const& port_or_socket, std::string const& database, std::string const& ssl, Path const& path)
|
std::string const& password, std::string const& port_or_socket, std::string const& database, std::string const& ssl, Path const& path)
|
||||||
{
|
{
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
args.reserve(7);
|
args.reserve(9);
|
||||||
|
|
||||||
// CLI Client connection info
|
// CLI Client connection info
|
||||||
args.emplace_back("-h" + host);
|
args.emplace_back("-h" + host);
|
||||||
@@ -491,13 +491,17 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Execute sql file
|
||||||
|
args.emplace_back("-e");
|
||||||
|
args.emplace_back(Acore::StringFormat("BEGIN; SOURCE %s; COMMIT;", path.generic_string().c_str()));
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
if (!database.empty())
|
if (!database.empty())
|
||||||
args.emplace_back(database);
|
args.emplace_back(database);
|
||||||
|
|
||||||
// Invokes a mysql process which doesn't leak credentials to logs
|
// Invokes a mysql process which doesn't leak credentials to logs
|
||||||
int const ret = Acore::StartProcess(DBUpdaterUtil::GetCorrectedMySQLExecutable(), args,
|
int const ret = Acore::StartProcess(DBUpdaterUtil::GetCorrectedMySQLExecutable(), args,
|
||||||
"sql.updates", path.generic_string(), true);
|
"sql.updates", "", true);
|
||||||
|
|
||||||
if (ret != EXIT_SUCCESS)
|
if (ret != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user