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

@@ -1617,7 +1617,7 @@ public:
}
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
stmt->setStringView(0, *ip);
stmt->SetData(0, *ip);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return LookupPlayerSearchCommand(result, *limit ? *limit : -1, handler);
@@ -1631,7 +1631,7 @@ public:
}
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
stmt->setString(0, account);
stmt->SetData(0, account);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return LookupPlayerSearchCommand(result, *limit ? *limit : -1, handler);
@@ -1640,7 +1640,7 @@ public:
static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, std::string email, Optional<int32> limit)
{
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
stmt->setString(0, email);
stmt->SetData(0, email);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return LookupPlayerSearchCommand(result, *limit ? *limit : -1, handler);
@@ -1668,11 +1668,11 @@ public:
}
Field* fields = result->Fetch();
uint32 accountId = fields[0].GetUInt32();
std::string accountName = fields[1].GetString();
uint32 accountId = fields[0].Get<uint32>();
std::string accountName = fields[1].Get<std::string>();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
stmt->setUInt32(0, accountId);
stmt->SetData(0, accountId);
PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
if (result2)
@@ -1682,8 +1682,8 @@ public:
do
{
Field* characterFields = result2->Fetch();
ObjectGuid::LowType guid = characterFields[0].GetUInt32();
std::string name = characterFields[1].GetString();
ObjectGuid::LowType guid = characterFields[0].Get<uint32>();
std::string name = characterFields[1].Get<std::string>();
uint8 plevel = 0, prace = 0, pclass = 0;
bool online = ObjectAccessor::FindPlayerByLowGUID(guid) != nullptr;