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
+8 -8
View File
@@ -60,7 +60,7 @@ namespace Game.SupportSystem
_lastBugId = 0;
_openBugTicketCount = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_BUGS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_BUGS);
SQLResult result = DB.Characters.Query(stmt);
if (result.IsEmpty())
{
@@ -96,7 +96,7 @@ namespace Game.SupportSystem
_lastComplaintId = 0;
_openComplaintTicketCount = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINTS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINTS);
SQLResult result = DB.Characters.Query(stmt);
if (result.IsEmpty())
{
@@ -119,7 +119,7 @@ namespace Game.SupportSystem
if (_lastComplaintId < id)
_lastComplaintId = id;
chatLogStmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINT_CHATLINES);
chatLogStmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINT_CHATLINES);
chatLogStmt.AddValue(0, id);
chatLogResult = DB.Characters.Query(stmt);
@@ -146,7 +146,7 @@ namespace Game.SupportSystem
_lastSuggestionId = 0;
_openSuggestionTicketCount = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_SUGGESTIONS);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_SUGGESTIONS);
SQLResult result = DB.Characters.Query(stmt);
if (result.IsEmpty())
{
@@ -255,7 +255,7 @@ namespace Game.SupportSystem
_lastBugId = 0;
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_BUGS);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_BUGS);
DB.Characters.Execute(stmt);
break;
case "ComplaintTicket":
@@ -264,8 +264,8 @@ namespace Game.SupportSystem
_lastComplaintId = 0;
SQLTransaction trans = new();
trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINTS));
trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINT_CHATLOGS));
trans.Append(CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINTS));
trans.Append(CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINT_CHATLOGS));
DB.Characters.CommitTransaction(trans);
break;
case "SuggestionTicket":
@@ -273,7 +273,7 @@ namespace Game.SupportSystem
_lastSuggestionId = 0;
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_SUGGESTIONS);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_SUGGESTIONS);
DB.Characters.Execute(stmt);
break;
}
+8 -8
View File
@@ -144,7 +144,7 @@ namespace Game.SupportSystem
public override void SaveToDB()
{
byte idx = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_BUG);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_BUG);
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
@@ -163,7 +163,7 @@ namespace Game.SupportSystem
public override void DeleteFromDB()
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_BUG);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_BUG);
stmt.AddValue(0, _id);
DB.Characters.Execute(stmt);
}
@@ -261,7 +261,7 @@ namespace Game.SupportSystem
var trans = new SQLTransaction();
byte idx = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_COMPLAINT);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_COMPLAINT);
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
@@ -288,7 +288,7 @@ namespace Game.SupportSystem
foreach (var c in _chatLog.Lines)
{
idx = 0;
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GM_COMPLAINT_CHATLINE);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GM_COMPLAINT_CHATLINE);
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, lineIndex);
stmt.AddValue(++idx, c.Timestamp);
@@ -303,11 +303,11 @@ namespace Game.SupportSystem
public override void DeleteFromDB()
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT);
stmt.AddValue(0, _id);
DB.Characters.Execute(stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT_CHATLOG);
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT_CHATLOG);
stmt.AddValue(0, _id);
DB.Characters.Execute(stmt);
}
@@ -398,7 +398,7 @@ namespace Game.SupportSystem
public override void SaveToDB()
{
byte idx = 0;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_SUGGESTION);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_SUGGESTION);
stmt.AddValue(idx, _id);
stmt.AddValue(++idx, _playerGuid.GetCounter());
stmt.AddValue(++idx, _note);
@@ -417,7 +417,7 @@ namespace Game.SupportSystem
public override void DeleteFromDB()
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_SUGGESTION);
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_SUGGESTION);
stmt.AddValue(0, _id);
DB.Characters.Execute(stmt);
}