feat(Core/Database): port TrinityCore database API (#5611)

This commit is contained in:
Kargatum
2021-06-22 11:21:07 +07:00
committed by GitHub
parent 2a2e54d8c5
commit 9ac6fddcae
155 changed files with 5818 additions and 4321 deletions

View File

@@ -62,12 +62,12 @@ bool GmTicket::LoadFromDB(Field* fields)
return true;
}
void GmTicket::SaveToDB(SQLTransaction& trans) const
void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const
{
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET);
stmt->setUInt32( index, _id);
stmt->setUInt8 (++index, uint8(_type));
stmt->setUInt32(++index, _playerGuid.GetCounter());
@@ -94,7 +94,7 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const
void GmTicket::DeleteFromDB()
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GM_TICKET);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GM_TICKET);
stmt->setUInt32(0, _id);
CharacterDatabase.Execute(stmt);
}
@@ -272,7 +272,7 @@ void TicketMgr::ResetTickets()
_lastTicketId = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GM_TICKETS);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GM_TICKETS);
CharacterDatabase.Execute(stmt);
}
@@ -288,7 +288,7 @@ void TicketMgr::LoadTickets()
_lastTicketId = 0;
_openTicketCount = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_TICKETS);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_TICKETS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
@@ -341,7 +341,7 @@ void TicketMgr::AddTicket(GmTicket* ticket)
_ticketList[ticket->GetId()] = ticket;
if (!ticket->IsClosed())
++_openTicketCount;
SQLTransaction trans = SQLTransaction(nullptr);
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
ticket->SaveToDB(trans);
}
@@ -349,7 +349,7 @@ void TicketMgr::CloseTicket(uint32 ticketId, ObjectGuid source)
{
if (GmTicket* ticket = GetTicket(ticketId))
{
SQLTransaction trans = SQLTransaction(nullptr);
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
ticket->SetClosedBy(source);
if (source)
--_openTicketCount;
@@ -371,7 +371,7 @@ void TicketMgr::ResolveAndCloseTicket(uint32 ticketId, ObjectGuid source)
{
if (GmTicket* ticket = GetTicket(ticketId))
{
SQLTransaction trans = SQLTransaction(nullptr);
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
ticket->SetClosedBy(source);
ticket->SetResolvedBy(source);
if (source)