mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 02:38:45 +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:
@@ -828,9 +828,9 @@ inline void TestHpManaEnd()
|
||||
|
||||
inline void TestClientBuffPersistence()
|
||||
{
|
||||
constexpr uint32 test_character_id = 99999991;
|
||||
constexpr uint16 normal_spell_id = 6824;
|
||||
constexpr uint16 suppressed_spell_id = 6824;
|
||||
constexpr uint32 test_character_id = 99999991;
|
||||
constexpr uint16 normal_spell_id = 6824;
|
||||
constexpr uint16 suppressed_spell_id = 2550;
|
||||
|
||||
auto schema_check = database.QueryDatabase("SHOW COLUMNS FROM `character_buffs` LIKE 'suppressed'");
|
||||
RunTest(
|
||||
|
||||
+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