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

@@ -186,14 +186,14 @@ public:
else
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
stmt->setUInt32(0, player->GetGUID().GetCounter());
stmt->SetData(0, player->GetGUID().GetCounter());
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
if (resultDB)
{
Field* fieldsDB = resultDB->Fetch();
WorldLocation loc(fieldsDB[0].GetUInt16(), fieldsDB[2].GetFloat(), fieldsDB[3].GetFloat(), fieldsDB[4].GetFloat(), 0.0f);
uint32 zoneId = fieldsDB[1].GetUInt16();
WorldLocation loc(fieldsDB[0].Get<uint16>(), fieldsDB[2].Get<float>(), fieldsDB[3].Get<float>(), fieldsDB[4].Get<float>(), 0.0f);
uint32 zoneId = fieldsDB[1].Get<uint16>();
Player::SavePositionInDB(loc, zoneId, player->GetGUID(), nullptr);
}
@@ -373,7 +373,7 @@ public:
WorldDatabase.EscapeString(normalizedName);
// May need work //PussyWizardEliteMalcrom
QueryResult result = WorldDatabase.PQuery("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id1 = ct.entry WHERE ct.name LIKE '%s'", normalizedName.c_str());
QueryResult result = WorldDatabase.Query("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id1 = ct.entry WHERE ct.name LIKE '{}'", normalizedName);
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
@@ -385,7 +385,7 @@ public:
handler->SendSysMessage(LANG_COMMAND_GOCREATMULTIPLE);
Field* fields = result->Fetch();
return DoNameTeleport(handler, player, fields[4].GetUInt16(), { fields[0].GetFloat(), fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat() }, fields[5].GetString());
return DoNameTeleport(handler, player, fields[4].Get<uint16>(), { fields[0].Get<float>(), fields[1].Get<float>(), fields[2].Get<float>(), fields[3].Get<float>() }, fields[5].Get<std::string>());
}
};