mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 17:43:47 +00:00
feat(Core/DBLayer): replace char const* to std::string_view (#10211)
* feat(Core/DBLayer): replace `char const*` to `std::string_view` * CString * 1 * chore(Core/Misc): code cleanup * cl * db fix * fmt style sql * to fmt * py * del old * 1 * 2 * 3 * 1 * 1
This commit is contained in:
@@ -51,26 +51,26 @@ bool GmTicket::LoadFromDB(Field* fields)
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||
// id, type, playerGuid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket, resolvedBy
|
||||
uint8 index = 0;
|
||||
_id = fields[ index].GetUInt32();
|
||||
_type = TicketType(fields[++index].GetUInt8());
|
||||
_playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++index].GetUInt32());
|
||||
_playerName = fields[++index].GetString();
|
||||
_message = fields[++index].GetString();
|
||||
_createTime = fields[++index].GetUInt32();
|
||||
_mapId = fields[++index].GetUInt16();
|
||||
_posX = fields[++index].GetFloat();
|
||||
_posY = fields[++index].GetFloat();
|
||||
_posZ = fields[++index].GetFloat();
|
||||
_lastModifiedTime = fields[++index].GetUInt32();
|
||||
_closedBy = ObjectGuid::Create<HighGuid::Player>(fields[++index].GetInt32());
|
||||
_assignedTo = ObjectGuid::Create<HighGuid::Player>(fields[++index].GetUInt32());
|
||||
_comment = fields[++index].GetString();
|
||||
_response = fields[++index].GetString();
|
||||
_completed = fields[++index].GetBool();
|
||||
_escalatedStatus = GMTicketEscalationStatus(fields[++index].GetUInt8());
|
||||
_viewed = fields[++index].GetBool();
|
||||
_needMoreHelp = fields[++index].GetBool();
|
||||
_resolvedBy = ObjectGuid::Create<HighGuid::Player>(fields[++index].GetInt32());
|
||||
_id = fields[ index].Get<uint32>();
|
||||
_type = TicketType(fields[++index].Get<uint8>());
|
||||
_playerGuid = ObjectGuid::Create<HighGuid::Player>(fields[++index].Get<uint32>());
|
||||
_playerName = fields[++index].Get<std::string>();
|
||||
_message = fields[++index].Get<std::string>();
|
||||
_createTime = fields[++index].Get<uint32>();
|
||||
_mapId = fields[++index].Get<uint16>();
|
||||
_posX = fields[++index].Get<float>();
|
||||
_posY = fields[++index].Get<float>();
|
||||
_posZ = fields[++index].Get<float>();
|
||||
_lastModifiedTime = fields[++index].Get<uint32>();
|
||||
_closedBy = ObjectGuid::Create<HighGuid::Player>(fields[++index].Get<int32>());
|
||||
_assignedTo = ObjectGuid::Create<HighGuid::Player>(fields[++index].Get<uint32>());
|
||||
_comment = fields[++index].Get<std::string>();
|
||||
_response = fields[++index].Get<std::string>();
|
||||
_completed = fields[++index].Get<bool>();
|
||||
_escalatedStatus = GMTicketEscalationStatus(fields[++index].Get<uint8>());
|
||||
_viewed = fields[++index].Get<bool>();
|
||||
_needMoreHelp = fields[++index].Get<bool>();
|
||||
_resolvedBy = ObjectGuid::Create<HighGuid::Player>(fields[++index].Get<int32>());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -81,26 +81,26 @@ void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const
|
||||
// id, type, playerGuid, name, description, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, needMoreHelp, resolvedBy
|
||||
uint8 index = 0;
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET);
|
||||
stmt->setUInt32( index, _id);
|
||||
stmt->setUInt8 (++index, uint8(_type));
|
||||
stmt->setUInt32(++index, _playerGuid.GetCounter());
|
||||
stmt->setString(++index, _playerName);
|
||||
stmt->setString(++index, _message);
|
||||
stmt->setUInt32(++index, uint32(_createTime));
|
||||
stmt->setUInt16(++index, _mapId);
|
||||
stmt->setFloat (++index, _posX);
|
||||
stmt->setFloat (++index, _posY);
|
||||
stmt->setFloat (++index, _posZ);
|
||||
stmt->setUInt32(++index, uint32(_lastModifiedTime));
|
||||
stmt->setInt32 (++index, int32(_closedBy.GetCounter()));
|
||||
stmt->setUInt32(++index, _assignedTo.GetCounter());
|
||||
stmt->setString(++index, _comment);
|
||||
stmt->setString(++index, _response);
|
||||
stmt->setBool (++index, _completed);
|
||||
stmt->setUInt8 (++index, uint8(_escalatedStatus));
|
||||
stmt->setBool (++index, _viewed);
|
||||
stmt->setBool (++index, _needMoreHelp);
|
||||
stmt->setInt32 (++index, int32(_resolvedBy.GetCounter()));
|
||||
stmt->SetData( index, _id);
|
||||
stmt->SetData (++index, uint8(_type));
|
||||
stmt->SetData(++index, _playerGuid.GetCounter());
|
||||
stmt->SetData(++index, _playerName);
|
||||
stmt->SetData(++index, _message);
|
||||
stmt->SetData(++index, uint32(_createTime));
|
||||
stmt->SetData(++index, _mapId);
|
||||
stmt->SetData (++index, _posX);
|
||||
stmt->SetData (++index, _posY);
|
||||
stmt->SetData (++index, _posZ);
|
||||
stmt->SetData(++index, uint32(_lastModifiedTime));
|
||||
stmt->SetData (++index, int32(_closedBy.GetCounter()));
|
||||
stmt->SetData(++index, _assignedTo.GetCounter());
|
||||
stmt->SetData(++index, _comment);
|
||||
stmt->SetData(++index, _response);
|
||||
stmt->SetData (++index, _completed);
|
||||
stmt->SetData (++index, uint8(_escalatedStatus));
|
||||
stmt->SetData (++index, _viewed);
|
||||
stmt->SetData (++index, _needMoreHelp);
|
||||
stmt->SetData (++index, int32(_resolvedBy.GetCounter()));
|
||||
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const
|
||||
void GmTicket::DeleteFromDB()
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GM_TICKET);
|
||||
stmt->setUInt32(0, _id);
|
||||
stmt->SetData(0, _id);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ void TicketMgr::LoadSurveys()
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_survey"))
|
||||
_lastSurveyId = (*result)[0].GetUInt32();
|
||||
_lastSurveyId = (*result)[0].Get<uint32>();
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded GM Survey count from database in {} ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
|
||||
Reference in New Issue
Block a user