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:
Kargatum
2022-02-05 06:37:11 +07:00
committed by GitHub
parent d6ead1d1e0
commit de13bf426e
140 changed files with 5055 additions and 4882 deletions

View File

@@ -522,7 +522,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
// Set initial reputations (so everything is nifty before DB data load)
Initialize();
//QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUID().GetCounter());
//QueryResult* result = CharacterDatabase.Query("SELECT faction, standing, flags FROM character_reputation WHERE guid = '{}'", GetGUID().GetCounter());
if (result)
{
@@ -530,13 +530,13 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
{
Field* fields = result->Fetch();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].Get<uint16>());
if (factionEntry && (factionEntry->reputationListID >= 0))
{
FactionState* faction = &_factions[factionEntry->reputationListID];
// update standing to current
faction->Standing = fields[1].GetInt32();
faction->Standing = fields[1].Get<int32>();
// update counters
int32 BaseRep = GetBaseReputation(factionEntry);
@@ -544,7 +544,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
UpdateRankCounters(old_rank, new_rank);
uint32 dbFactionFlags = fields[2].GetUInt16();
uint32 dbFactionFlags = fields[2].Get<uint16>();
if (dbFactionFlags & FACTION_FLAG_VISIBLE)
SetVisible(faction); // have internal checks for forced invisibility
@@ -586,15 +586,15 @@ void ReputationMgr::SaveToDB(CharacterDatabaseTransaction trans)
if (itr->second.needSave)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUID().GetCounter());
stmt->setUInt16(1, uint16(itr->second.ID));
stmt->SetData(0, _player->GetGUID().GetCounter());
stmt->SetData(1, uint16(itr->second.ID));
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUID().GetCounter());
stmt->setUInt16(1, uint16(itr->second.ID));
stmt->setInt32(2, itr->second.Standing);
stmt->setUInt16(3, uint16(itr->second.Flags));
stmt->SetData(0, _player->GetGUID().GetCounter());
stmt->SetData(1, uint16(itr->second.ID));
stmt->SetData(2, itr->second.Standing);
stmt->SetData(3, uint16(itr->second.Flags));
trans->Append(stmt);
itr->second.needSave = false;