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

@@ -84,10 +84,10 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
_channelDBId = ++ChannelMgr::_channelIdMax;
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
stmt->setUInt32(0, _channelDBId);
stmt->setString(1, name);
stmt->setUInt32(2, _teamId);
stmt->setUInt8(3, _announce);
stmt->SetData(0, _channelDBId);
stmt->SetData(1, name);
stmt->SetData(2, _teamId);
stmt->SetData(3, _announce);
CharacterDatabase.Execute(stmt);
}
}
@@ -104,9 +104,9 @@ void Channel::UpdateChannelInDB() const
if (_IsSaved)
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
stmt->setBool(0, _announce);
stmt->setString(1, _password);
stmt->setUInt32(2, _channelDBId);
stmt->SetData(0, _announce);
stmt->SetData(1, _password);
stmt->SetData(2, _channelDBId);
CharacterDatabase.Execute(stmt);
LOG_DEBUG("chat.system", "Channel({}) updated in database", _name);
@@ -116,24 +116,24 @@ void Channel::UpdateChannelInDB() const
void Channel::UpdateChannelUseageInDB() const
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
stmt->setUInt32(0, _channelDBId);
stmt->SetData(0, _channelDBId);
CharacterDatabase.Execute(stmt);
}
void Channel::AddChannelBanToDB(ObjectGuid guid, uint32 time) const
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid.GetCounter());
stmt->setUInt32(2, time);
stmt->SetData(0, _channelDBId);
stmt->SetData(1, guid.GetCounter());
stmt->SetData(2, time);
CharacterDatabase.Execute(stmt);
}
void Channel::RemoveChannelBanFromDB(ObjectGuid guid) const
{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid.GetCounter());
stmt->SetData(0, _channelDBId);
stmt->SetData(1, guid.GetCounter());
CharacterDatabase.Execute(stmt);
}
@@ -144,7 +144,7 @@ void Channel::CleanOldChannelsInDB()
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS);
stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY);
stmt->SetData(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS);