Core/DBLayer: Refactor prepared statement defines to new format (char db)
This commit is contained in:
@@ -103,7 +103,7 @@ void Corpse::SaveToDB()
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
DeleteFromDB(trans);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CORPSE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
|
||||
stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
|
||||
stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
|
||||
stmt->setFloat (2, GetPositionX()); // posX
|
||||
|
||||
@@ -320,7 +320,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
case ITEM_CHANGED:
|
||||
{
|
||||
uint8 index = 0;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_ADD_ITEM_INSTANCE : CHAR_UPDATE_ITEM_INSTANCE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE);
|
||||
stmt->setUInt32( index, GetEntry());
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(++index, GUID_LOPART(GetUInt64Value(ITEM_FIELD_CREATOR)));
|
||||
@@ -354,7 +354,7 @@ void Item::SaveToDB(SQLTransaction& trans)
|
||||
|
||||
if ((uState == ITEM_CHANGED) && HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GIFT_OWNER);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetOwnerGUID()));
|
||||
stmt->setUInt32(1, guid);
|
||||
trans->Append(stmt);
|
||||
@@ -460,7 +460,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
|
||||
|
||||
if (need_save) // normal item changed state set not work at loading
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ITEM_INSTANCE_ON_LOAD);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_INSTANCE_ON_LOAD);
|
||||
stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY));
|
||||
|
||||
@@ -4823,7 +4823,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
if (has_items)
|
||||
{
|
||||
// Data needs to be at first place for Item::LoadFromDB
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_MAILITEMS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
|
||||
stmt->setUInt32(0, mail_id);
|
||||
PreparedQueryResult resultItems = CharacterDatabase.Query(stmt);
|
||||
if (resultItems)
|
||||
@@ -4942,7 +4942,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
// The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
|
||||
case CHAR_DELETE_UNLINK:
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_DELETE_INFO);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO);
|
||||
|
||||
stmt->setUInt32(0, guid);
|
||||
|
||||
@@ -7346,7 +7346,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
|
||||
if (zone > 0)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ZONE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE);
|
||||
|
||||
stmt->setUInt16(0, uint16(zone));
|
||||
stmt->setUInt32(1, guidLow);
|
||||
@@ -11931,7 +11931,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
|
||||
for (++itr; itr != allowedLooters.end(); ++itr)
|
||||
ss << ' ' << *itr;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ITEM_BOP_TRADE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_BOP_TRADE);
|
||||
stmt->setUInt32(0, pItem->GetGUIDLow());
|
||||
stmt->setString(1, ss.str());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -16434,7 +16434,7 @@ void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
|
||||
m_homebindZ = GetPositionZ();
|
||||
|
||||
// update sql homebind
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_PLAYER_HOMEBIND);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
|
||||
stmt->setUInt16(0, m_homebindMapId);
|
||||
stmt->setUInt16(1, m_homebindAreaId);
|
||||
stmt->setFloat (2, m_homebindX);
|
||||
@@ -17441,7 +17441,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_ITEM_REFUNDS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS);
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
@@ -17461,7 +17461,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
}
|
||||
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_ITEM_BOP_TRADE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
{
|
||||
@@ -17524,7 +17524,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
|
||||
void Player::_LoadMailedItems(Mail* mail)
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_MAILITEMS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
|
||||
stmt->setUInt32(0, mail->messageID);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
@@ -18303,7 +18303,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
m_homebindY = info->positionY;
|
||||
m_homebindZ = info->positionZ;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_PLAYER_HOMEBIND);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt16(1, m_homebindMapId);
|
||||
stmt->setUInt16(2, m_homebindAreaId);
|
||||
@@ -18348,7 +18348,7 @@ void Player::SaveToDB(bool create /*=false*/)
|
||||
{
|
||||
//! Insert query
|
||||
//! TO DO: Filter out more redundant fields that can take their default value at player create
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHARACTER);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER);
|
||||
stmt->setUInt32(index++, GetGUIDLow());
|
||||
stmt->setUInt32(index++, GetSession()->GetAccountId());
|
||||
stmt->setString(index++, GetName());
|
||||
@@ -18673,7 +18673,7 @@ void Player::_SaveAuras(SQLTransaction& trans)
|
||||
}
|
||||
|
||||
uint8 index = 0;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_AURA);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
|
||||
stmt->setUInt32(index++, GetGUIDLow());
|
||||
stmt->setUInt64(index++, itr->second->GetCasterGUID());
|
||||
stmt->setUInt64(index++, itr->second->GetCastItemGUID());
|
||||
@@ -20039,7 +20039,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
|
||||
void Player::LeaveAllArenaTeams(uint64 guid)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ARENA_TEAMS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ARENA_TEAMS);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
@@ -24244,7 +24244,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
|
||||
++itr;
|
||||
break; // nothing do
|
||||
case EQUIPMENT_SET_CHANGED:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_EQUIP_SET);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
|
||||
stmt->setString(j++, eqset.Name.c_str());
|
||||
stmt->setString(j++, eqset.IconName.c_str());
|
||||
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
|
||||
@@ -24257,7 +24257,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
|
||||
++itr;
|
||||
break;
|
||||
case EQUIPMENT_SET_NEW:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_EQUIP_SET);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_EQUIP_SET);
|
||||
stmt->setUInt32(j++, GetGUIDLow());
|
||||
stmt->setUInt64(j++, eqset.Guid);
|
||||
stmt->setUInt32(j++, index);
|
||||
@@ -24285,7 +24285,7 @@ void Player::_SaveBGData(SQLTransaction& trans)
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
/* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_PLAYER_BGDATA);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_BGDATA);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt32(1, m_bgData.bgInstanceID);
|
||||
stmt->setUInt16(2, m_bgData.bgTeam);
|
||||
@@ -24587,7 +24587,7 @@ void Player::ActivateSpec(uint8 spec)
|
||||
InitTalentForLevel();
|
||||
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ACTIONS_SPEC);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC);
|
||||
stmt->setUInt32(0, GetGUIDLow());
|
||||
stmt->setUInt8(1, m_activeSpec);
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
@@ -24899,7 +24899,7 @@ void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans)
|
||||
|
||||
for (InstanceTimeMap::const_iterator itr = _instanceResetTimes.begin(); itr != _instanceResetTimes.end(); ++itr)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ACCOUNT_INSTANCE_LOCK_TIMES);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES);
|
||||
stmt->setUInt32(0, GetSession()->GetAccountId());
|
||||
stmt->setUInt32(1, itr->first);
|
||||
stmt->setUInt64(2, itr->second);
|
||||
|
||||
Reference in New Issue
Block a user