本文整理汇总了C++中PreparedQueryResult::release方法的典型用法代码示例。如果您正苦于以下问题:C++ PreparedQueryResult::release方法的具体用法?C++ PreparedQueryResult::release怎么用?C++ PreparedQueryResult::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreparedQueryResult
的用法示例。
在下文中一共展示了PreparedQueryResult::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkCode
bool checkCode(Player *player, Creature *_Creature, const char* sCode)
{
// Some variables declarations.
PreparedQueryResult result;
int32 item_id = 0;
uint32 quantity = 0;
uint32 uses = 0;
uint32 account = 0;
uint64 charguid = 0;
uint8 newlevel = 0;
bool found = false;
uint32 creatureID = _Creature->GetEntry();
creatureID = creatureID == 1000104 ? 90001 : creatureID;
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_CODEBOX_ITEM);
stmt->setUInt32(0, creatureID);
stmt->setUInt32(1, player->GetSession()->GetAccountId());
result = CharacterDatabase.Query(stmt);
if(!result)
{
sLog->outError("CodeBox: Player %u request code (%s) on npc %u but no code found.", player->GetGUID(), sCode, creatureID);
_Creature->MonsterWhisper("Der Code ist falsch! Komme wieder, wenn du einen gueltigen Code hast!", player->GetGUID());
return false;
}
do {
Field *fields = result->Fetch();
item_id = fields[0].GetInt32();
quantity = fields[1].GetUInt32();
uses = fields[2].GetUInt8();
account = fields[3].GetUInt32();
charguid = fields[4].GetUInt64();
newlevel = fields[5].GetUInt8();
const char* dbcode = fields[6].GetCString();
sLog->outDebug(LOG_FILTER_TSCR, "CodeBox: Found Code (%s) in DB", dbcode);
if(!strcmp(dbcode, sCode))
{
sLog->outDebug(LOG_FILTER_TSCR, "CodeBox: DB Code %s matches player code %s", dbcode, sCode);
found = true;
break;
}
} while (result->NextRow());
result.release();
if(!found)
{
sLog->outError("CodeBox: Player %u request not existing code (%s).", player->GetGUID(), sCode);
_Creature->MonsterWhisper("Der Code ist falsch! Komme wieder, wenn du einen gueltigen Code hast!", player->GetGUID());
return false;
}
if(account != player->GetSession()->GetAccountId())
{
sLog->outError("CodeBox: Player %u request correct code (%s) but account doesn't match. Playeraccount: %u CodeAccount: %u", player->GetGUID(), sCode, player->GetSession()->GetAccountId(), account);
_Creature->MonsterWhisper("Der Code ist falsch! Komme wieder, wenn du einen gueltigen Code hast!", player->GetGUID());
return false;
}
if(charguid && player->GetGUID() != charguid)
{
sLog->outError("CodeBox: Player %u request correct code (%s) but guid doesn't match. CodeGUID: ", player->GetGUID(), charguid);
_Creature->MonsterWhisper("Leider kannst du diesen Code nicht mit diesem Charakter Einloesen!", player->GetGUID());
return false;
}
if(!uses)
{
sLog->outError("CodeBox: Player %u request correct code (%s) but available uses reached 0.", player->GetGUID(), sCode);
_Creature->MonsterWhisper("Der Code wurde bereits eingeloest! Komme wieder, wenn du einen gueltigen Code hast!", player->GetGUID());
return false;
}
if(newlevel && player->getLevel() >= newlevel)
{
sLog->outError("CodeBox: Player %u request correct code (%s) but playerlevel is to high. Playerlevel: %u Codelevel: %u", player->GetGUID(), player->getLevel(), newlevel);
_Creature->MonsterWhisper("Leider kannst du diesen Code nicht mit diesem Charakter Einloesen denn dein Level ist zu hoch!", player->GetGUID());
return false;
}
// levelcode
if(newlevel > 0)
{
player->GiveLevel(newlevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP,0);
_Creature->MonsterWhisper("Herzlichen Glueckwunsch zu deinem neuem Level!", player->GetGUID());
}
// itemcode
else if(item_id > 0)
{
//.........这里部分代码省略.........