本文整理汇总了C++中GmTicket::LoadFromDB方法的典型用法代码示例。如果您正苦于以下问题:C++ GmTicket::LoadFromDB方法的具体用法?C++ GmTicket::LoadFromDB怎么用?C++ GmTicket::LoadFromDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmTicket
的用法示例。
在下文中一共展示了GmTicket::LoadFromDB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadTickets
void TicketMgr::LoadTickets()
{
uint32 oldMSTime = getMSTime();
if (!_ticketList.empty())
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
if (itr->second)
delete itr->second;
_ticketList.clear();
_lastTicketId = 0;
_openTicketCount = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_GM_TICKETS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
sLog->outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
GmTicket* ticket = new GmTicket();
if (!ticket->LoadFromDB(fields))
{
delete ticket;
continue;
}
if (!ticket->IsClosed())
++_openTicketCount;
// Update max ticket id if necessary
uint32 id = ticket->GetId();
if (_lastTicketId < id)
_lastTicketId = id;
_ticketList[id] = ticket;
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
示例2: LoadGmTickets
void SupportMgr::LoadGmTickets()
{
uint32 oldMSTime = getMSTime();
for (auto const& c : _gmTicketList)
delete c.second;
_gmTicketList.clear();
_lastGmTicketId = 0;
_openGmTicketCount = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_TICKETS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 GM tickets. DB table `gm_ticket` is empty!");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
GmTicket* ticket = new GmTicket();
ticket->LoadFromDB(fields);
if (!ticket->IsClosed())
++_openGmTicketCount;
uint32 id = ticket->GetId();
if (_lastGmTicketId < id)
_lastGmTicketId = id;
_gmTicketList[id] = ticket;
++count;
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}