Core/DBLayer: Converted player login queries into prepared statements
Core/DBLayer: Added missing implementation for SQLQueryHolder::SetPreparedQuery --HG-- branch : trunk
This commit is contained in:
@@ -107,7 +107,7 @@ void Bag::SaveToDB(SQLTransaction& trans)
|
||||
Item::SaveToDB(trans);
|
||||
}
|
||||
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32 entry)
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result, uint32 entry)
|
||||
{
|
||||
if (!Item::LoadFromDB(guid, owner_guid, result, entry))
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ class Bag : public Item
|
||||
// overwrite virtual Item::SaveToDB
|
||||
void SaveToDB(SQLTransaction& trans);
|
||||
// overwrite virtual Item::LoadFromDB
|
||||
bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32 entry);
|
||||
bool LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result, uint32 entry);
|
||||
// overwrite virtual Item::DeleteFromDB
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
SetState(ITEM_UNCHANGED);
|
||||
}
|
||||
|
||||
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32 entry)
|
||||
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result, uint32 entry)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
//result = CharacterDatabase.PQuery("SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text FROM item_instance WHERE guid = '%u'", guid);
|
||||
@@ -410,13 +410,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32
|
||||
if (owner_guid != 0)
|
||||
SetOwnerGUID(owner_guid);
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
bool need_save = false; // need explicit save data at load fixes
|
||||
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetCount(fields[2].GetUInt32());
|
||||
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(result->GetUInt32(0), 0, HIGHGUID_PLAYER));
|
||||
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(result->GetUInt32(1), 0, HIGHGUID_PLAYER));
|
||||
SetCount(result->GetUInt32(2));
|
||||
|
||||
uint32 duration = fields[3].GetUInt32();
|
||||
uint32 duration = result->GetUInt32(3);
|
||||
SetUInt32Value(ITEM_FIELD_DURATION, duration);
|
||||
// update duration if need, and remove if not need
|
||||
if ((proto->Duration == 0) != (duration == 0))
|
||||
@@ -425,12 +424,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
Tokens tokens = StrSplit(fields[4].GetCppString(), " ");
|
||||
Tokens tokens = StrSplit(result->GetString(4), " ");
|
||||
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
SetSpellCharges(i, atoi(tokens[i].c_str()));
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, result->GetUInt32(5));
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||
{
|
||||
@@ -438,13 +437,13 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
_LoadIntoDataField(fields[6].GetString(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
|
||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt32());
|
||||
_LoadIntoDataField(result->GetCString(6), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
|
||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, result->GetInt32(7));
|
||||
// recalculate suffix factor
|
||||
if (GetItemRandomPropertyId() < 0)
|
||||
UpdateItemSuffixFactor();
|
||||
|
||||
uint32 durability = fields[8].GetUInt32();
|
||||
uint32 durability = result->GetUInt32(8);
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, durability);
|
||||
// update max durability (and durability) if need
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
|
||||
@@ -454,8 +453,8 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32());
|
||||
SetText(fields[10].GetCppString());
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, result->GetUInt32(9));
|
||||
SetText(result->GetString(10));
|
||||
|
||||
if (need_save) // normal item changed state set not work at loading
|
||||
{
|
||||
@@ -473,12 +472,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32
|
||||
|
||||
void Item::DeleteFromDB(SQLTransaction& trans)
|
||||
{
|
||||
trans->PAppend("DELETE FROM item_instance WHERE guid = '%u'",GetGUIDLow());
|
||||
trans->PAppend("DELETE FROM item_instance WHERE guid = '%u'", GetGUIDLow());
|
||||
}
|
||||
|
||||
void Item::DeleteFromInventoryDB(SQLTransaction& trans)
|
||||
{
|
||||
trans->PAppend("DELETE FROM character_inventory WHERE item = '%u'",GetGUIDLow());
|
||||
trans->PAppend("DELETE FROM character_inventory WHERE item = '%u'", GetGUIDLow());
|
||||
}
|
||||
|
||||
ItemPrototype const *Item::GetProto() const
|
||||
|
||||
@@ -245,7 +245,7 @@ class Item : public Object
|
||||
bool IsBindedNotWith(Player const* player) const;
|
||||
bool IsBoundByEnchant() const;
|
||||
virtual void SaveToDB(SQLTransaction& trans);
|
||||
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult result, uint32 entry);
|
||||
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result, uint32 entry);
|
||||
virtual void DeleteFromDB(SQLTransaction& trans);
|
||||
void DeleteFromInventoryDB(SQLTransaction& trans);
|
||||
void SaveRefundDataToDB();
|
||||
|
||||
@@ -150,40 +150,40 @@ enum ItemProtoFlags
|
||||
|
||||
enum ItemFieldFlags
|
||||
{
|
||||
ITEM_FLAG_SOULBOUND = 0x00000001, // Item is soulbound and cannot be traded
|
||||
ITEM_FLAG_SOULBOUND = 0x00000001, // Item is soulbound and cannot be traded <<--
|
||||
ITEM_FLAG_UNK1 = 0x00000002, // ?
|
||||
ITEM_FLAG_UNLOCKED = 0x00000004, // Item had lock but can be opened now
|
||||
ITEM_FLAG_WRAPPED = 0x00000008, // Item is wrapped and contains another item
|
||||
ITEM_FLAG_UNK3 = 0x00000010, // ?
|
||||
ITEM_FLAG_UNK4 = 0x00000020, // ?
|
||||
ITEM_FLAG_UNK5 = 0x00000040, // ?
|
||||
ITEM_FLAG_UNK6 = 0x00000080, // ?
|
||||
ITEM_FLAG_UNK7 = 0x00000100, // ?
|
||||
ITEM_FLAG_UNK2 = 0x00000010, // ?
|
||||
ITEM_FLAG_UNK3 = 0x00000020, // ?
|
||||
ITEM_FLAG_UNK4 = 0x00000040, // ?
|
||||
ITEM_FLAG_UNK5 = 0x00000080, // ?
|
||||
ITEM_FLAG_BOP_TRADEABLE = 0x00000100, // Allows trading soulbound items
|
||||
ITEM_FLAG_READABLE = 0x00000200, // Opens text page when right clicked
|
||||
ITEM_FLAG_UNK9 = 0x00000400, // ?
|
||||
ITEM_FLAG_UNK10 = 0x00000800, // ?
|
||||
ITEM_FLAG_UNK6 = 0x00000400, // ?
|
||||
ITEM_FLAG_UNK7 = 0x00000800, // ?
|
||||
ITEM_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
|
||||
ITEM_FLAG_UNK11 = 0x00002000, // ?
|
||||
ITEM_FLAG_UNK12 = 0x00004000, // ?
|
||||
ITEM_FLAG_UNK13 = 0x00008000, // ?
|
||||
ITEM_FLAG_UNK14 = 0x00010000, // ?
|
||||
ITEM_FLAG_UNK15 = 0x00020000, // ?
|
||||
ITEM_FLAG_UNK16 = 0x00040000, // ?
|
||||
ITEM_FLAG_UNK17 = 0x00080000, // ?
|
||||
ITEM_FLAG_UNK18 = 0x00100000, // ?
|
||||
ITEM_FLAG_UNK19 = 0x00200000, // ?
|
||||
ITEM_FLAG_UNK20 = 0x00400000, // ?
|
||||
ITEM_FLAG_UNK21 = 0x00800000, // ?
|
||||
ITEM_FLAG_UNK22 = 0x01000000, // ?
|
||||
ITEM_FLAG_UNK23 = 0x02000000, // ?
|
||||
ITEM_FLAG_UNK24 = 0x04000000, // ?
|
||||
ITEM_FLAG_UNK25 = 0x08000000, // ?
|
||||
ITEM_FLAG_UNK26 = 0x10000000, // ?
|
||||
ITEM_FLAG_UNK27 = 0x20000000, // ?
|
||||
ITEM_FLAG_UNK28 = 0x40000000, // ?
|
||||
ITEM_FLAG_BOP_TRADEABLE = 0x80000000, // ?
|
||||
ITEM_FLAG_UNK8 = 0x00002000, // ?
|
||||
ITEM_FLAG_UNK9 = 0x00004000, // ?
|
||||
ITEM_FLAG_UNK10 = 0x00008000, // ?
|
||||
ITEM_FLAG_UNK11 = 0x00010000, // ?
|
||||
ITEM_FLAG_UNK12 = 0x00020000, // ?
|
||||
ITEM_FLAG_UNK13 = 0x00040000, // ?
|
||||
ITEM_FLAG_UNK14 = 0x00080000, // ?
|
||||
ITEM_FLAG_UNK15 = 0x00100000, // ?
|
||||
ITEM_FLAG_UNK16 = 0x00200000, // ?
|
||||
ITEM_FLAG_UNK17 = 0x00400000, // ?
|
||||
ITEM_FLAG_UNK18 = 0x00800000, // ?
|
||||
ITEM_FLAG_UNK19 = 0x01000000, // ?
|
||||
ITEM_FLAG_UNK20 = 0x02000000, // ?
|
||||
ITEM_FLAG_UNK21 = 0x04000000, // ?
|
||||
ITEM_FLAG_UNK22 = 0x08000000, // ?
|
||||
ITEM_FLAG_UNK23 = 0x10000000, // ?
|
||||
ITEM_FLAG_UNK24 = 0x20000000, // ?
|
||||
ITEM_FLAG_UNK25 = 0x40000000, // ?
|
||||
ITEM_FLAG_UNK26 = 0x80000000, // ?
|
||||
|
||||
ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14
|
||||
ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14,
|
||||
};
|
||||
|
||||
enum ItemFlagsExtra
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1632,7 +1632,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void RemoveCategoryCooldown(uint32 cat);
|
||||
void RemoveArenaSpellCooldowns();
|
||||
void RemoveAllSpellCooldown();
|
||||
void _LoadSpellCooldowns(QueryResult result);
|
||||
void _LoadSpellCooldowns(PreparedQueryResult result);
|
||||
void _SaveSpellCooldowns(SQLTransaction& trans);
|
||||
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
|
||||
void UpdatePotionCooldown(Spell* spell = NULL);
|
||||
@@ -1657,16 +1657,16 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool isRessurectRequested() const { return m_resurrectGUID != 0; }
|
||||
void ResurectUsingRequestData();
|
||||
|
||||
int getCinematic()
|
||||
uint8 getCinematic()
|
||||
{
|
||||
return m_cinematic;
|
||||
}
|
||||
void setCinematic(int cine)
|
||||
void setCinematic(uint8 cine)
|
||||
{
|
||||
m_cinematic = cine;
|
||||
}
|
||||
|
||||
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
|
||||
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type, uint8 spec = 0);
|
||||
void removeActionButton(uint8 button);
|
||||
ActionButton const* GetActionButton(uint8 button);
|
||||
void SendInitialActionButtons() const { SendActionButtons(1); }
|
||||
@@ -2417,30 +2417,30 @@ class Player : public Unit, public GridObject<Player>
|
||||
/*** LOAD SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void _LoadActions(QueryResult result);
|
||||
void _LoadAuras(QueryResult result, uint32 timediff);
|
||||
void _LoadActions(PreparedQueryResult result);
|
||||
void _LoadAuras(PreparedQueryResult result, uint32 timediff);
|
||||
void _LoadGlyphAuras();
|
||||
void _LoadBoundInstances(QueryResult result);
|
||||
void _LoadInventory(QueryResult result, uint32 timediff);
|
||||
void _LoadMailInit(QueryResult resultUnread, QueryResult resultDelivery);
|
||||
void _LoadBoundInstances(PreparedQueryResult result);
|
||||
void _LoadInventory(PreparedQueryResult result, uint32 timediff);
|
||||
void _LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery);
|
||||
void _LoadMail();
|
||||
void _LoadMailedItems(Mail *mail);
|
||||
void _LoadQuestStatus(QueryResult result);
|
||||
void _LoadDailyQuestStatus(QueryResult result);
|
||||
void _LoadWeeklyQuestStatus(QueryResult result);
|
||||
void _LoadRandomBGStatus(QueryResult result);
|
||||
void _LoadGroup(QueryResult result);
|
||||
void _LoadSkills(QueryResult result);
|
||||
void _LoadSpells(QueryResult result);
|
||||
void _LoadFriendList(QueryResult result);
|
||||
bool _LoadHomeBind(QueryResult result);
|
||||
void _LoadDeclinedNames(QueryResult result);
|
||||
void _LoadArenaTeamInfo(QueryResult result);
|
||||
void _LoadArenaStatsInfo(QueryResult result);
|
||||
void _LoadEquipmentSets(QueryResult result);
|
||||
void _LoadBGData(QueryResult result);
|
||||
void _LoadGlyphs(QueryResult result);
|
||||
void _LoadTalents(QueryResult result);
|
||||
void _LoadQuestStatus(PreparedQueryResult result);
|
||||
void _LoadDailyQuestStatus(PreparedQueryResult result);
|
||||
void _LoadWeeklyQuestStatus(PreparedQueryResult result);
|
||||
void _LoadRandomBGStatus(PreparedQueryResult result);
|
||||
void _LoadGroup(PreparedQueryResult result);
|
||||
void _LoadSkills(PreparedQueryResult result);
|
||||
void _LoadSpells(PreparedQueryResult result);
|
||||
void _LoadFriendList(PreparedQueryResult result);
|
||||
bool _LoadHomeBind(PreparedQueryResult result);
|
||||
void _LoadDeclinedNames(PreparedQueryResult result);
|
||||
void _LoadArenaTeamInfo(PreparedQueryResult result);
|
||||
void _LoadArenaStatsInfo(PreparedQueryResult result);
|
||||
void _LoadEquipmentSets(PreparedQueryResult result);
|
||||
void _LoadBGData(PreparedQueryResult result);
|
||||
void _LoadGlyphs(PreparedQueryResult result);
|
||||
void _LoadTalents(PreparedQueryResult result);
|
||||
|
||||
/*********************************************************/
|
||||
/*** SAVE SYSTEM ***/
|
||||
@@ -2520,7 +2520,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX];
|
||||
|
||||
ActionButtonList m_actionButtons;
|
||||
ActionButtonList m_actionButtons[MAX_TALENT_SPECS];
|
||||
|
||||
float m_auraBaseMod[BASEMOD_END][MOD_END];
|
||||
int16 m_baseRatingValue[MAX_COMBAT_RATING];
|
||||
@@ -2549,7 +2549,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
typedef std::list<Channel*> JoinedChannelsList;
|
||||
JoinedChannelsList m_channels;
|
||||
|
||||
int m_cinematic;
|
||||
uint8 m_cinematic;
|
||||
|
||||
TradeData* m_trade;
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet)
|
||||
}
|
||||
}
|
||||
|
||||
PlayerSocial *SocialMgr::LoadFromDB(QueryResult result, uint32 guid)
|
||||
PlayerSocial *SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid)
|
||||
{
|
||||
PlayerSocial *social = &m_socialMap[guid];
|
||||
social->SetPlayerGUID(guid);
|
||||
@@ -303,19 +303,17 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult result, uint32 guid)
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
friend_guid = fields[0].GetUInt32();
|
||||
flags = fields[1].GetUInt32();
|
||||
note = fields[2].GetCppString();
|
||||
friend_guid = result->GetUInt32(0);
|
||||
flags = result->GetUInt32(1);
|
||||
note = result->GetString(2);
|
||||
|
||||
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
|
||||
|
||||
// client's friends list and ignore list limit
|
||||
if (social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT))
|
||||
break;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
return social;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class SocialMgr
|
||||
void SendFriendStatus(Player *player, FriendsResult result, uint32 friend_guid, bool broadcast);
|
||||
void BroadcastToFriendListers(Player *player, WorldPacket *packet);
|
||||
// Loading
|
||||
PlayerSocial *LoadFromDB(QueryResult result, uint32 guid);
|
||||
PlayerSocial *LoadFromDB(PreparedQueryResult result, uint32 guid);
|
||||
private:
|
||||
SocialMap m_socialMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user