这篇教程C++ CreateDumpString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreateDumpString函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateDumpString函数的具体用法?C++ CreateDumpString怎么用?C++ CreateDumpString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreateDumpString函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: switch// Writing - High-level functionsvoid PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char const* tableFrom, char const* tableTo, DumpTableType type){ GUIDs const* guids = NULL; char const* fieldname = NULL; switch (type) { case DTT_ITEM: fieldname = "guid"; guids = &items; break; case DTT_ITEM_GIFT: fieldname = "item_guid"; guids = &items; break; case DTT_ITEM_LOOT: fieldname = "guid"; guids = &items; break; case DTT_PET: fieldname = "owner"; break; case DTT_PET_TABLE: fieldname = "guid"; guids = &pets; break; case DTT_PET_DECL: fieldname = "id"; break; case DTT_MAIL: fieldname = "receiver"; break; case DTT_MAIL_ITEM: fieldname = "mail_id"; guids = &mails; break; case DTT_ITEM_TEXT: fieldname = "id"; guids = &texts; break; default: fieldname = "guid"; break; } // for guid set stop if set is empty if (guids && guids->empty()) return; // nothing to do // setup for guids case start position GUIDs::const_iterator guids_itr; if (guids) guids_itr = guids->begin(); do { std::string wherestr; if (guids) // set case, get next guids string wherestr = GenerateWhereStr(fieldname, *guids, guids_itr); else // not set case, get single guid string wherestr = GenerateWhereStr(fieldname, guid); QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str()); if (!result) return; do { // collect guids switch (type) { case DTT_INVENTORY: StoreGUID(result, 3, items); break; // item guid collection case DTT_ITEM: StoreGUID(result, 0, ITEM_FIELD_ITEM_TEXT_ID, texts); break; // item text id collection case DTT_PET: StoreGUID(result, 0, pets); break; // pet petnumber collection (character_pet.id) case DTT_MAIL: StoreGUID(result, 0, mails); // mail id collection (mail.id) StoreGUID(result, 7, texts); break; // item text id collection case DTT_MAIL_ITEM: StoreGUID(result, 1, items); break; // item guid collection (mail_items.item_guid) default: break; } dump += CreateDumpString(tableTo, result); dump += "/n"; } while (result->NextRow()); delete result; } while (guids && guids_itr != guids->end()); // not set case iterate single time, set case iterate for all guids}
开发者ID:kotishe,项目名称:server-1,代码行数:71,
示例2: switch// Writing - High-level functionsbool PlayerDumpWriter::DumpTable(std::string& dump, ObjectGuid::LowType guid, char const* tableFrom, char const* tableTo, DumpTableType type){ DumpGuidSet const* guids = nullptr; char const* fieldname = nullptr; switch (type) { case DTT_CURRENCY: fieldname = "CharacterGuid"; break; case DTT_ITEM: fieldname = "guid"; guids = &items; break; case DTT_ITEM_GIFT: fieldname = "item_guid"; guids = &items; break; case DTT_PET: fieldname = "owner"; break; case DTT_PET_TABLE: fieldname = "guid"; guids = &pets; break; case DTT_MAIL: fieldname = "receiver"; break; case DTT_MAIL_ITEM: fieldname = "mail_id"; guids = &mails; break; default: fieldname = "guid"; break; } // for guid set stop if set is empty if (guids && guids->empty()) return true; // nothing to do // setup for guids case start position DumpGuidSet::const_iterator guidsItr; if (guids) guidsItr = guids->begin(); do { std::string wherestr; if (guids) // set case, get next guids string wherestr = GenerateWhereStr(fieldname, *guids, guidsItr); else // not set case, get single guid string wherestr = GenerateWhereStr(fieldname, guid); QueryResult result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str()); if (!result) return true; do { // collect guids switch (type) { case DTT_INVENTORY: StoreGUID(result, 3, items); // item guid collection (character_inventory.item) break; case DTT_PET: StoreGUID(result, 0, pets); // pet petnumber collection (character_pet.id) break; case DTT_MAIL: StoreGUID(result, 0, mails); // mail id collection (mail.id) break; case DTT_MAIL_ITEM: StoreGUID(result, 1, items); // item guid collection (mail_items.item_guid) break; case DTT_CHARACTER: { if (result->GetFieldCount() <= 64) // avoid crashes on next check { TC_LOG_FATAL("misc", "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); return false; } if (result->Fetch()[64].GetUInt32()) // characters.deleteInfos_Account - if filled error return false; break; } default: break; } dump += CreateDumpString(tableTo, result); dump += "/n"; } while (result->NextRow()); } while (guids && guidsItr != guids->end()); // not set case iterate single time, set case iterate for all guids return true;}
开发者ID:DSlayerMan,项目名称:DraenorCore,代码行数:81,
注:本文中的CreateDumpString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CreateElement函数代码示例 C++ CreateDirectoryW函数代码示例 |