SQL: Characters db storage type cleanup No. 3 - Note:

There is a chance that you will be getting importing errors / data truncation warnings because of ancient invalid pet names.
SELECT * FROM character_pet WHERE CHAR_LENGTH(`name`) > 21;
This commit is contained in:
leak
2011-01-19 18:51:00 +01:00
parent c306acf298
commit 471b6f138d
16 changed files with 144 additions and 69 deletions
+3 -3
View File
@@ -198,7 +198,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
SetDisplayId(fields[3].GetUInt32());
SetNativeDisplayId(fields[3].GetUInt32());
uint32 petlevel = fields[4].GetUInt32();
uint32 petlevel = fields[4].GetUInt16();
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
SetName(fields[8].GetString());
@@ -258,7 +258,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
// 0=current
// 1..MAX_PET_STABLES in stable slot
// PET_SAVE_NOT_IN_SLOT(100) = not stable slot (summoning))
if (fields[7].GetUInt32() != 0)
if (fields[7].GetUInt8() != 0)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'",
@@ -287,7 +287,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
map->Add(this->ToCreature());
m_resetTalentsCost = fields[15].GetUInt32();
m_resetTalentsTime = fields[16].GetUInt64();
m_resetTalentsTime = time_t(fields[16].GetUInt32());
InitTalentForLevel(); // set original talents points before spell loading
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32());
+8 -6
View File
@@ -1680,7 +1680,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket * p_data)
if (cInfo)
{
petDisplayId = fields[17].GetUInt32();
petLevel = fields[18].GetUInt32();
petLevel = fields[18].GetUInt16();
petFamily = cInfo->family;
}
}
@@ -17313,8 +17313,10 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
{
uint16 slot = 0;
//// 0 1 3 4 5 6 7 8 9 10 11 12
//QueryResult *result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4 FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
//// 0 1 2 3 4 5 6 7 8 9 10
//QueryResult *result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3,
// 11
// itemcount4 FROM character_queststatus WHERE guid = '%u'", GetGUIDLow());
if (result)
{
@@ -17341,7 +17343,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
questStatusData.m_explored = (fields[2].GetUInt8() > 0);
time_t quest_time = time_t(fields[3].GetUInt64());
time_t quest_time = time_t(fields[3].GetUInt32());
if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id))
{
@@ -17448,7 +17450,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
if (qQuest->IsDFQuest())
{
m_DFQuests.insert(qQuest->GetQuestId());
m_lastDailyQuestTime = (time_t)fields[1].GetUInt64();
m_lastDailyQuestTime = time_t(fields[1].GetUInt32());
continue;
}
}
@@ -17900,7 +17902,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
{
Field* fields = result->Fetch();
m_homebindMapId = fields[0].GetUInt32();
m_homebindMapId = fields[0].GetUInt16();
m_homebindAreaId = fields[1].GetUInt16();
m_homebindX = fields[2].GetFloat();
m_homebindY = fields[3].GetFloat();