mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +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:
@@ -34,11 +34,11 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// check flags which clean ups are necessary
|
||||
QueryResult result = CharacterDatabase.PQuery("SELECT value FROM worldstates WHERE entry = %d", WS_CLEANING_FLAGS);
|
||||
QueryResult result = CharacterDatabase.Query("SELECT value FROM worldstates WHERE entry = {}", WS_CLEANING_FLAGS);
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
uint32 flags = (*result)[0].GetUInt32();
|
||||
uint32 flags = (*result)[0].Get<uint32>();
|
||||
|
||||
// clean up
|
||||
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
|
||||
@@ -59,7 +59,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||
// NOTE: In order to have persistentFlags be set in worldstates for the next cleanup,
|
||||
// you need to define them at least once in worldstates.
|
||||
flags &= sWorld->getIntConfig(CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS);
|
||||
CharacterDatabase.DirectPExecute("UPDATE worldstates SET value = %u WHERE entry = %d", flags, WS_CLEANING_FLAGS);
|
||||
CharacterDatabase.DirectExecute("UPDATE worldstates SET value = {} WHERE entry = {}", flags, WS_CLEANING_FLAGS);
|
||||
|
||||
sWorld->SetCleaningFlags(flags);
|
||||
|
||||
@@ -69,7 +69,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||
|
||||
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
|
||||
{
|
||||
QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table);
|
||||
QueryResult result = CharacterDatabase.Query("SELECT DISTINCT {} FROM {}", column, table);
|
||||
if (!result)
|
||||
{
|
||||
LOG_INFO("sql.sql", "Table {} is empty.", table);
|
||||
@@ -82,7 +82,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 id = fields[0].Get<uint32>();
|
||||
|
||||
if (!check(id))
|
||||
{
|
||||
@@ -146,7 +146,7 @@ bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
|
||||
|
||||
void CharacterDatabaseCleaner::CleanCharacterTalent()
|
||||
{
|
||||
CharacterDatabase.DirectPExecute("DELETE FROM character_talent WHERE specMask >= %u", 1 << MAX_TALENT_SPECS);
|
||||
CharacterDatabase.DirectExecute("DELETE FROM character_talent WHERE specMask >= {}", 1 << MAX_TALENT_SPECS);
|
||||
CheckUnique("spell", "character_talent", &TalentCheck);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user