Make PreparedStatements static for each database.
This commit is contained in:
@@ -100,7 +100,7 @@ namespace Game.Entities
|
||||
PreparedStatement stmt;
|
||||
foreach (var pair in _toys)
|
||||
{
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, pair.Key);
|
||||
stmt.AddValue(2, pair.Value.HasAnyFlag(ToyFlags.Favorite));
|
||||
@@ -191,7 +191,7 @@ namespace Game.Entities
|
||||
PreparedStatement stmt;
|
||||
foreach (var heirloom in _heirlooms)
|
||||
{
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_HEIRLOOMS);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_HEIRLOOMS);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, heirloom.Key);
|
||||
stmt.AddValue(2, (uint)heirloom.Value.flags);
|
||||
@@ -356,7 +356,7 @@ namespace Game.Entities
|
||||
{
|
||||
foreach (var mount in _mounts)
|
||||
{
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_MOUNTS);
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_MOUNTS);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, mount.Key);
|
||||
stmt.AddValue(2, (byte)mount.Value);
|
||||
@@ -494,7 +494,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (blockValue != 0) // this table is only appended/bits are set (never cleared) so don't save empty blocks
|
||||
{
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, blockIndex);
|
||||
stmt.AddValue(2, blockValue);
|
||||
@@ -510,14 +510,14 @@ namespace Game.Entities
|
||||
switch (appearanceState)
|
||||
{
|
||||
case FavoriteAppearanceState.New:
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_FAVORITE_APPEARANCE);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_FAVORITE_APPEARANCE);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, key);
|
||||
trans.Append(stmt);
|
||||
appearanceState = FavoriteAppearanceState.Unchanged;
|
||||
break;
|
||||
case FavoriteAppearanceState.Removed:
|
||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BNET_ITEM_FAVORITE_APPEARANCE);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BNET_ITEM_FAVORITE_APPEARANCE);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, key);
|
||||
trans.Append(stmt);
|
||||
@@ -885,7 +885,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (blockValue != 0) // this table is only appended/bits are set (never cleared) so don't save empty blocks
|
||||
{
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS);
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS);
|
||||
stmt.AddValue(0, _owner.GetBattlenetAccountId());
|
||||
stmt.AddValue(1, blockIndex);
|
||||
stmt.AddValue(2, blockValue);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Game.Entities
|
||||
if (isLoading)
|
||||
return;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PETITION);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PETITION);
|
||||
stmt.AddValue(0, ownerGuid.GetCounter());
|
||||
stmt.AddValue(1, petitionGuid.GetCounter());
|
||||
stmt.AddValue(2, name);
|
||||
@@ -88,11 +88,11 @@ namespace Game.Entities
|
||||
// Delete From DB
|
||||
SQLTransaction trans = new();
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID);
|
||||
stmt.AddValue(0, petitionGuid.GetCounter());
|
||||
trans.Append(stmt);
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_GUID);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_GUID);
|
||||
stmt.AddValue(0, petitionGuid.GetCounter());
|
||||
trans.Append(stmt);
|
||||
|
||||
@@ -121,11 +121,11 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
SQLTransaction trans = new();
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER);
|
||||
stmt.AddValue(0, ownerGuid.GetCounter());
|
||||
trans.Append(stmt);
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_OWNER);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_OWNER);
|
||||
stmt.AddValue(0, ownerGuid.GetCounter());
|
||||
trans.Append(stmt);
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
@@ -136,7 +136,7 @@ namespace Game.Entities
|
||||
foreach (var petitionPair in _petitionStorage)
|
||||
petitionPair.Value.RemoveSignatureBySigner(signerGuid);
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_PETITION_SIGNATURES);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_PETITION_SIGNATURES);
|
||||
stmt.AddValue(0, signerGuid.GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace Game.Entities
|
||||
if (isLoading)
|
||||
return;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PETITION_SIGNATURE);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PETITION_SIGNATURE);
|
||||
stmt.AddValue(0, ownerGuid.GetCounter());
|
||||
stmt.AddValue(1, PetitionGuid.GetCounter());
|
||||
stmt.AddValue(2, playerGuid.GetCounter());
|
||||
@@ -178,7 +178,7 @@ namespace Game.Entities
|
||||
{
|
||||
PetitionName = newName;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PETITION_NAME);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PETITION_NAME);
|
||||
stmt.AddValue(0, newName);
|
||||
stmt.AddValue(1, PetitionGuid.GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1275,7 +1275,7 @@ namespace Game.Entities
|
||||
foreach (var guid in allowedLooters)
|
||||
ss.AppendFormat("{0} ", guid);
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_BOP_TRADE);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_BOP_TRADE);
|
||||
stmt.AddValue(0, item.GetGUID().GetCounter());
|
||||
stmt.AddValue(1, ss.ToString());
|
||||
DB.Characters.Execute(stmt);
|
||||
@@ -5524,7 +5524,7 @@ namespace Game.Entities
|
||||
|
||||
if (pItem.IsWrapped())
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GIFT);
|
||||
stmt.AddValue(0, pItem.GetGUID().GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ namespace Game.Entities
|
||||
m_IsBGRandomWinner = isWinner;
|
||||
if (m_IsBGRandomWinner)
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_BATTLEGROUND_RANDOM);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_BATTLEGROUND_RANDOM);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// load them asynchronously
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
stmt.AddValue(1, GetActiveTalentGroup());
|
||||
stmt.AddValue(2, traitConfigId);
|
||||
@@ -1166,7 +1166,7 @@ namespace Game.Entities
|
||||
{
|
||||
SetUpdateFieldFlagValue(traitConfig.ModifyValue(traitConfig.CombatConfigFlags), (int)TraitCombatConfigFlags.SharedActionBars);
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
stmt.AddValue(1, traitConfigId);
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace Game.Entities
|
||||
if (GetSession().m_muteTime != 0 && GetSession().m_muteTime < now)
|
||||
{
|
||||
GetSession().m_muteTime = 0;
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME);
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME);
|
||||
stmt.AddValue(0, 0); // Set the mute time to 0
|
||||
stmt.AddValue(1, "");
|
||||
stmt.AddValue(2, "");
|
||||
@@ -2886,7 +2886,7 @@ namespace Game.Entities
|
||||
homebindAreaId = areaId;
|
||||
|
||||
// update sql homebind
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PLAYER_HOMEBIND);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PLAYER_HOMEBIND);
|
||||
stmt.AddValue(0, homebind.GetMapId());
|
||||
stmt.AddValue(1, homebindAreaId);
|
||||
stmt.AddValue(2, homebind.GetPositionX());
|
||||
@@ -3971,7 +3971,7 @@ namespace Game.Entities
|
||||
public static void OfflineResurrect(ObjectGuid guid, SQLTransaction trans)
|
||||
{
|
||||
Corpse.DeleteFromDB(guid, trans);
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt.AddValue(0, (ushort)AtLoginFlags.Resurrect);
|
||||
stmt.AddValue(1, guid.GetCounter());
|
||||
DB.Characters.ExecuteOrAppend(trans, stmt);
|
||||
@@ -4797,7 +4797,7 @@ namespace Game.Entities
|
||||
atLoginFlags &= ~flags;
|
||||
if (persist)
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG);
|
||||
stmt.AddValue(0, (ushort)flags);
|
||||
stmt.AddValue(1, GetGUID().GetCounter());
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Game.Entities
|
||||
friendInfo.Flags |= flag;
|
||||
friendInfo.WowAccountGuid = accountGuid;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS);
|
||||
stmt.AddValue(0, (byte)friendInfo.Flags);
|
||||
stmt.AddValue(1, GetPlayerGUID().GetCounter());
|
||||
stmt.AddValue(2, friendGuid.GetCounter());
|
||||
@@ -179,7 +179,7 @@ namespace Game.Entities
|
||||
fi.WowAccountGuid = accountGuid;
|
||||
PlayerSocialMap[friendGuid] = fi;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_SOCIAL);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_SOCIAL);
|
||||
stmt.AddValue(0, GetPlayerGUID().GetCounter());
|
||||
stmt.AddValue(1, friendGuid.GetCounter());
|
||||
stmt.AddValue(2, (byte)flag);
|
||||
@@ -202,7 +202,7 @@ namespace Game.Entities
|
||||
|
||||
if (friendInfo.Flags == 0)
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_SOCIAL);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_SOCIAL);
|
||||
stmt.AddValue(0, GetPlayerGUID().GetCounter());
|
||||
stmt.AddValue(1, friendGuid.GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
@@ -220,7 +220,7 @@ namespace Game.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS);
|
||||
stmt.AddValue(0, (byte)friendInfo.Flags);
|
||||
stmt.AddValue(1, GetPlayerGUID().GetCounter());
|
||||
stmt.AddValue(2, friendGuid.GetCounter());
|
||||
@@ -233,7 +233,7 @@ namespace Game.Entities
|
||||
if (!PlayerSocialMap.ContainsKey(friendGuid)) // not exist
|
||||
return;
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_NOTE);
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_NOTE);
|
||||
stmt.AddValue(0, note);
|
||||
stmt.AddValue(1, GetPlayerGUID().GetCounter());
|
||||
stmt.AddValue(2, friendGuid.GetCounter());
|
||||
|
||||
Reference in New Issue
Block a user