From b8e86b9b7a0983b3bc610513531944e68c01c911 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 13 Sep 2015 11:13:04 +0200 Subject: Core/DBLayer: Allowed using GetDouble for SUM results instead of requiring string conversions (cherry picked from commit 3109ab2da08d094df97724355bff681d7951e576) --- src/server/scripts/Commands/cs_misc.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index b22f56ef923..b81d6152c03 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1773,21 +1773,13 @@ public: PreparedQueryResult result6 = CharacterDatabase.Query(stmt4); if (result6) { - // Define the variables, so the compiler knows they exist - uint32 rmailint = 0; - - // Fetch the fields - readmail is a SUM(x) and given out as char! Thus... - // ... while totalmail is a COUNT(x), which is given out as INt64, which we just convert on fetch... Field* fields = result6->Fetch(); - std::string readmail = fields[0].GetString(); + uint32 readmail = uint32(fields[0].GetDouble()); uint32 totalmail = uint32(fields[1].GetUInt64()); - // ... we have to convert it from Char to int. We can use totalmail as it is - rmailint = atoul(readmail.c_str()); - // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given if (totalmail >= 1) - handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail); + handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, readmail, totalmail); } return true; -- cgit v1.2.3