Core/Entities: Second part of required database changes for migrating guids to 128 bit - all fields storing lowguid must be extended to uint64

This commit is contained in:
Shauren
2014-10-23 21:34:03 +02:00
parent 2f36898409
commit 76f1f85d8b
26 changed files with 139 additions and 158 deletions

View File

@@ -300,28 +300,23 @@ public:
return false;
Player* target = ObjectAccessor::FindPlayerByName(args);
uint32 targetGuid = 0;
ObjectGuid targetGuid;
std::string name(args);
if (!target)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
stmt->setString(0, name);
PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
if (!resultCharacter)
targetGuid = sObjectMgr->GetPlayerGUIDByName(name);
if (targetGuid.IsEmpty())
{
handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER);
return false;
}
targetGuid = (*resultCharacter)[0].GetUInt32();
}
else
targetGuid = target->GetGUID().GetCounter();
targetGuid = target->GetGUID();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
stmt->setUInt32(0, targetGuid);
stmt->setUInt64(0, targetGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
@@ -521,7 +516,7 @@ public:
{
Field* fields = result->Fetch();
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
stmt2->setUInt32(0, fields[0].GetUInt32());
stmt2->setUInt64(0, fields[0].GetUInt64());
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
if (banResult)
handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
@@ -543,7 +538,7 @@ public:
std::string char_name = fields[1].GetString();
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
stmt2->setUInt32(0, fields[0].GetUInt32());
stmt2->setUInt64(0, fields[0].GetUInt64());
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
if (banInfo)
{

View File

@@ -368,7 +368,7 @@ public:
// Remove declined name from db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
stmt->setUInt32(0, targetGuid.GetCounter());
stmt->setUInt64(0, targetGuid.GetCounter());
CharacterDatabase.Execute(stmt);
if (target)

View File

@@ -1437,7 +1437,7 @@ public:
// Account data print variables
std::string userName = handler->GetTrinityString(LANG_ERROR);
uint32 accId = 0;
uint32 lowguid = targetGuid.GetCounter();
ObjectGuid::LowType lowguid = targetGuid.GetCounter();
std::string eMail = handler->GetTrinityString(LANG_ERROR);
std::string regMail = handler->GetTrinityString(LANG_ERROR);
uint32 security = 0;
@@ -1603,7 +1603,7 @@ public:
{
banType = handler->GetTrinityString(LANG_CHARACTER);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
stmt->setUInt32(0, lowguid);
stmt->setUInt64(0, lowguid);
result2 = CharacterDatabase.Query(stmt);
}
@@ -1615,8 +1615,6 @@ public:
banReason = fields[3].GetString();
}
// Can be used to query data from Characters database
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
stmt2->setUInt32(0, lowguid);
@@ -2436,22 +2434,16 @@ public:
if (targetName)
{
// Check for offline players
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
stmt->setString(0, name);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(name);
if (guid.IsEmpty())
{
handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
return true;
}
// If player found: delete his freeze aura
Field* fields = result->Fetch();
uint32 lowGuid = fields[0].GetUInt32();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
stmt->setUInt32(0, lowGuid);
stmt->setUInt64(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());