mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Address PR review: check transaction/delete results, fix manifest, use distinct spell IDs in test
Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>
This commit is contained in:
+22
-4
@@ -2925,15 +2925,33 @@ void ZoneDatabase::SaveBuffs(Client *client)
|
||||
v.emplace_back(e);
|
||||
}
|
||||
|
||||
database.TransactionBegin();
|
||||
const auto begin_result = database.QueryDatabase("START TRANSACTION");
|
||||
if (!begin_result.Success()) {
|
||||
LogError(
|
||||
"Failed to begin buff save transaction for character [{}] [{}]: {}",
|
||||
client->GetCleanName(),
|
||||
client->CharacterID(),
|
||||
begin_result.ErrorMessage()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterBuffsRepository::DeleteWhere(
|
||||
database,
|
||||
const auto delete_result = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"`character_id` = {}",
|
||||
"DELETE FROM `character_buffs` WHERE `character_id` = {}",
|
||||
client->CharacterID()
|
||||
)
|
||||
);
|
||||
if (!delete_result.Success()) {
|
||||
database.TransactionRollback();
|
||||
LogError(
|
||||
"Failed to delete existing buffs for character [{}] [{}]: {}",
|
||||
client->GetCleanName(),
|
||||
client->CharacterID(),
|
||||
delete_result.ErrorMessage()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!v.empty()) {
|
||||
const auto saved_count = CharacterBuffsRepository::ReplaceMany(database, v);
|
||||
|
||||
Reference in New Issue
Block a user