mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 23:56:25 +00:00
feat(Core/Database): port TrinityCore database API (#5611)
This commit is contained in:
@@ -70,7 +70,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
||||
{
|
||||
_channelDBId = ++ChannelMgr::_channelIdMax;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
stmt->setString(1, name);
|
||||
stmt->setUInt32(2, _teamId);
|
||||
@@ -90,7 +90,7 @@ void Channel::UpdateChannelInDB() const
|
||||
{
|
||||
if (_IsSaved)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
|
||||
stmt->setBool(0, _announce);
|
||||
stmt->setString(1, _password);
|
||||
stmt->setUInt32(2, _channelDBId);
|
||||
@@ -102,14 +102,14 @@ void Channel::UpdateChannelInDB() const
|
||||
|
||||
void Channel::UpdateChannelUseageInDB() const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Channel::AddChannelBanToDB(ObjectGuid guid, uint32 time) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
stmt->setUInt32(2, time);
|
||||
@@ -118,7 +118,7 @@ void Channel::AddChannelBanToDB(ObjectGuid guid, uint32 time) const
|
||||
|
||||
void Channel::RemoveChannelBanFromDB(ObjectGuid guid) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
|
||||
stmt->setUInt32(0, _channelDBId);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -128,9 +128,9 @@ void Channel::CleanOldChannelsInDB()
|
||||
{
|
||||
if (sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) > 0)
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS);
|
||||
stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY);
|
||||
trans->Append(stmt);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ void ChannelMgr::LoadChannels()
|
||||
|
||||
for (auto pair : toDelete)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL);
|
||||
stmt->setString(0, pair.first);
|
||||
stmt->setUInt32(1, pair.second);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -41,7 +41,7 @@ std::vector<ChatCommand> const& ChatHandler::getCommandTable()
|
||||
std::vector<ChatCommand> cmds = sScriptMgr->GetChatCommands();
|
||||
commandTableCache.swap(cmds);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user