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

@@ -157,8 +157,8 @@ public:
{
///- Get the accounts with GM Level >0
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
stmt->setUInt8(0, uint8(SEC_MODERATOR));
stmt->setInt32(1, int32(realm.Id.Realm));
stmt->SetData(0, uint8(SEC_MODERATOR));
stmt->SetData(1, int32(realm.Id.Realm));
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
@@ -169,16 +169,16 @@ public:
do
{
Field* fields = result->Fetch();
char const* name = fields[0].GetCString();
uint8 security = fields[1].GetUInt8();
uint8 max = (16 - strlen(name)) / 2;
std::string name = fields[0].Get<std::string>();
uint8 security = fields[1].Get<uint8>();
uint8 max = (16 - name.length()) / 2;
uint8 max2 = max;
if ((max + max2 + strlen(name)) == 16)
if ((max + max2 + name.length()) == 16)
max2 = max - 1;
if (handler->GetSession())
handler->PSendSysMessage("| %s GMLevel %u", name, security);
handler->PSendSysMessage("| %s GMLevel %u", name.c_str(), security);
else
handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name, max2, " ", security);
handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name.c_str(), max2, " ", security);
} while (result->NextRow());
handler->SendSysMessage("========================");
}