本文整理汇总了C++中DumpTable类的典型用法代码示例。如果您正苦于以下问题:C++ DumpTable类的具体用法?C++ DumpTable怎么用?C++ DumpTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DumpTable类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpTableContent
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
std::string dump;
dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n";
dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";
for(DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
DumpTableContent(dump, guid, itr->name, itr->name, itr->type);
// TODO: Add instance/group..
// TODO: Add a dump level option to skip some non-important tables
return dump;
}
示例2: DumpTableContent
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
std::string dump;
dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n";
dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";
// revision check guard
QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM character_db_version LIMIT 1");
if (result)
{
QueryFieldNames const& namesMap = result->GetFieldNames();
std::string reqName;
for (QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr)
{
if (itr->substr(0, 9) == "required_")
{
reqName = *itr;
break;
}
}
if (!reqName.empty())
{
// this will fail at wrong character DB version
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
}
else
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
delete result;
}
else
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
DumpTableContent(dump, guid, itr->name, itr->name, itr->type);
// TODO: Add instance/group..
// TODO: Add a dump level option to skip some non-important tables
return dump;
}
示例3: fopen
//.........这里部分代码省略.........
{
if (feof(fin)) break;
ROLLBACK(DUMP_FILE_BROKEN);
}
std::string line; line.assign(buf);
// skip empty strings
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
if (nw_pos == std::string::npos)
continue;
// skip NOTE
if (line.substr(nw_pos, 15) == "IMPORTANT NOTE:")
continue;
// add required_ check
if (line.substr(nw_pos, 41) == "UPDATE character_db_version SET required_")
{
if (!CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
continue;
}
// determine table name and load type
std::string tn = gettablename(line);
if (tn.empty())
{
sLog.outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
DumpTableType type = DTT_CHARACTER; // Fixed: Using uninitialized memory 'type'
DumpTable* dTable = &dumpTables[0];
for (; dTable->isValid(); ++dTable)
{
if (tn == dTable->name)
{
type = dTable->type;
break;
}
}
if (!dTable->isValid())
{
sLog.outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
bool execute_ok = true; // false, if need skip soem query
// change the data to server values
switch (type)
{
case DTT_CHAR_TABLE:
if (!changenth(line, 1, newguid)) // character_*.guid update
ROLLBACK(DUMP_FILE_BROKEN);
break;
case DTT_CHAR_NAME_TABLE:
if (nameInvalidated) // ignore declined names if name will changed in some way
{
execute_ok = false;
break;
}
示例4: COUNT
//.........这里部分代码省略.........
{
if(feof(fin)) break;
ROLLBACK(DUMP_FILE_BROKEN);
}
std::string line; line.assign(buf);
// skip empty strings
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
if(nw_pos==std::string::npos)
continue;
// skip NOTE
if(line.substr(nw_pos,15)=="IMPORTANT NOTE:")
continue;
// add required_ check
if(line.substr(nw_pos,41)=="UPDATE character_db_version SET required_")
{
if(!CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
continue;
}
// determine table name and load type
std::string tn = gettablename(line);
if(tn.empty())
{
sLog.outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
DumpTableType type;
DumpTable* dTable = &dumpTables[0];
for(; dTable->isValid(); ++dTable)
{
if (tn == dTable->name)
{
type = dTable->type;
break;
}
}
if (!dTable->isValid())
{
sLog.outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
// change the data to server values
switch(type)
{
case DTT_CHAR_TABLE:
if(!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
case DTT_CHARACTER: // character t.
{
if(!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
// guid, data field:guid, items
if(!changenth(line, 2, chraccount))
ROLLBACK(DUMP_FILE_BROKEN);