当前位置: 首页>>代码示例>>C++>>正文


C++ GmTicket::LoadFromDB方法代码示例

本文整理汇总了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();
}
开发者ID:Crazzeye,项目名称:TrinityCore,代码行数:47,代码来源:TicketMgr.cpp

示例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));
}
开发者ID:Mathias-Nolam,项目名称:wtfisthis,代码行数:39,代码来源:SupportMgr.cpp


注:本文中的GmTicket::LoadFromDB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。