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

@@ -53,8 +53,8 @@ namespace AddonMgr
{
Field* fields = result->Fetch();
std::string name = fields[0].GetString();
uint32 crc = fields[1].GetUInt32();
std::string name = fields[0].Get<std::string>();
uint32 crc = fields[1].Get<uint32>();
m_knownAddons.push_back(SavedAddon(name, crc));
@@ -76,11 +76,11 @@ namespace AddonMgr
Field* fields = result->Fetch();
BannedAddon addon{};
addon.Id = fields[0].GetUInt32() + offset;
addon.Timestamp = uint32(fields[3].GetUInt64());
addon.Id = fields[0].Get<uint32>() + offset;
addon.Timestamp = uint32(fields[3].Get<uint64>());
std::string name = fields[1].GetString();
std::string version = fields[2].GetString();
std::string name = fields[1].Get<std::string>();
std::string version = fields[2].Get<std::string>();
MD5(reinterpret_cast<uint8 const*>(name.c_str()), name.length(), addon.NameMD5);
MD5(reinterpret_cast<uint8 const*>(version.c_str()), version.length(), addon.VersionMD5);
@@ -101,8 +101,8 @@ namespace AddonMgr
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ADDON);
stmt->setString(0, name);
stmt->setUInt32(1, addon.CRC);
stmt->SetData(0, name);
stmt->SetData(1, addon.CRC);
CharacterDatabase.Execute(stmt);