Make PreparedStatements static for each database.

This commit is contained in:
hondacrx
2023-02-04 20:55:14 -05:00
parent e0e20b6b1c
commit 149fadccab
90 changed files with 922 additions and 923 deletions
+10 -10
View File
@@ -21,7 +21,7 @@ namespace Game.Loots
_lootItemStorage.Clear();
uint count = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS);
SQLResult result = DB.Characters.Query(stmt);
if (!result.IsEmpty())
{
@@ -60,7 +60,7 @@ namespace Game.Loots
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 stored item loots");
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_MONEY);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_MONEY);
result = DB.Characters.Query(stmt);
if (!result.IsEmpty())
{
@@ -146,11 +146,11 @@ namespace Game.Loots
_lootItemStorage.TryRemove(containerId, out _);
SQLTransaction trans = new();
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
stmt.AddValue(0, containerId);
trans.Append(stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
stmt.AddValue(0, containerId);
trans.Append(stmt);
@@ -183,7 +183,7 @@ namespace Game.Loots
if (loot.gold != 0)
container.AddMoney(loot.gold, trans);
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS);
stmt.AddValue(0, containerId);
trans.Append(stmt);
@@ -226,7 +226,7 @@ namespace Game.Loots
if (trans == null)
return;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_ITEMS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_ITEMS);
// container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
stmt.AddValue(0, _containerId);
@@ -256,11 +256,11 @@ namespace Game.Loots
if (trans == null)
return;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
stmt.AddValue(0, _containerId);
trans.Append(stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_MONEY);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_MONEY);
stmt.AddValue(0, _containerId);
stmt.AddValue(1, _money);
trans.Append(stmt);
@@ -270,7 +270,7 @@ namespace Game.Loots
{
_money = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY);
stmt.AddValue(0, _containerId);
DB.Characters.Execute(stmt);
}
@@ -288,7 +288,7 @@ namespace Game.Loots
}
// Deletes a single item associated with an openable item from the DB
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEM);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEM);
stmt.AddValue(0, _containerId);
stmt.AddValue(1, itemId);
stmt.AddValue(2, count);