diff options
| author | leak <none@none> | 2010-12-19 17:06:33 +0100 |
|---|---|---|
| committer | leak <none@none> | 2010-12-19 17:06:33 +0100 |
| commit | fd694cd2324a7e2d61d833a78024b68fd3605053 (patch) | |
| tree | 2fb48411eb25ff627b56786b66c96dd646a30651 /src/server/game/Tickets | |
| parent | 9c35e10444b24848e0a909c46727ac2a312ab5de (diff) | |
Streamlining loading functions for server startup
- Added a couple of timer outputs
- Improved code consistency between loading functions
- Progess bars should look and behave similar on all OS now (sLog.outString() is not needed anymore to replace the progress bar in log files)
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Tickets')
| -rwxr-xr-x | src/server/game/Tickets/TicketMgr.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index ab04b060e71..d9d54559cf1 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -41,6 +41,8 @@ uint64 TicketMgr::GenerateGMTicketId() void TicketMgr::LoadGMTickets() { + uint32 oldMSTime = getMSTime(); + if (!m_GMTicketList.empty()) for (GmTicketList::const_iterator itr = m_GMTicketList.begin(); itr != m_GMTicketList.end(); ++itr) delete *itr; @@ -49,24 +51,25 @@ void TicketMgr::LoadGMTickets() m_GMticketid = 0; m_openTickets = 0; - QueryResult result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed, assignedto, comment, completed, escalated, viewed FROM gm_tickets"); + QueryResult result = CharacterDatabase.Query("SELECT guid, playerGuid, name, message, createtime, map, posX, posY, posZ, timestamp, closed," + "assignedto, comment, completed, escalated, viewed FROM gm_tickets"); if (!result) { barGoLink bar(1); bar.step(); + sLog.outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); sLog.outString(); - sLog.outString(">> GM Tickets table is empty, no tickets were loaded."); return; } - uint16 count = 0; barGoLink bar(result->GetRowCount()); - GM_Ticket *ticket; + uint32 count = 0; + do { Field *fields = result->Fetch(); - ticket = new GM_Ticket; + GM_Ticket *ticket = new GM_Ticket; ticket->guid = fields[0].GetUInt64(); ticket->playerGuid = fields[1].GetUInt64(); ticket->name = fields[2].GetString(); @@ -100,11 +103,14 @@ void TicketMgr::LoadGMTickets() m_GMticketid = fields[0].GetUInt64(); } - sLog.outString(">> Loaded %u GM Tickets from the database.", count); + sLog.outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog.outString(); } void TicketMgr::LoadGMSurveys() { + uint32 oldMSTime = getMSTime(); + // we don't actually load anything into memory here as there's no reason to QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyid) FROM gm_surveys"); if (result) @@ -115,7 +121,8 @@ void TicketMgr::LoadGMSurveys() else m_GMSurveyID = 0; - sLog.outString(">> Loaded GM Survey count from database."); + sLog.outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + sLog.outString(); } void TicketMgr::AddOrUpdateGMTicket(GM_Ticket &ticket, bool create) |
