diff --git a/common/database.cpp b/common/database.cpp index 69c86c575..5a3e9ff66 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1629,16 +1629,29 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id) uint32 Database::GetGroupIDByCharID(uint32 character_id) { - const auto& e = GroupIdRepository::FindOne(*this, character_id); + const auto& e = GroupIdRepository::GetWhere( + *this, + fmt::format( + "`character_id` = {}", + character_id + ) + ); - return e.character_id ? e.group_id : 0; + return e.size() == 1 ? e.front().group_id : 0; } uint32 Database::GetRaidIDByCharID(uint32 character_id) { - const auto& e = RaidMembersRepository::FindOne(*this, character_id); - return e.charid ? e.raidid : 0; + const auto& e = RaidMembersRepository::GetWhere( + *this, + fmt::format( + "`charid` = {}", + character_id + ) + ); + + return e.size() == 1 ? e.front().raidid : 0; } int64 Database::CountInvSnapshots()