From 3973d1b45444c0c8fcd7aa1e033be4329dce05ae Mon Sep 17 00:00:00 2001 From: Azazel Date: Fri, 11 Mar 2011 17:18:17 +0600 Subject: CharDB Schema/Cleanup: cleanup channels table: * rename columns (remove m_ prefix and convert to lowerCamel case); * rename prepared statements to conform to standards (there is no CLEAN statement). --- src/server/game/Chat/Channels/Channel.cpp | 4 ++-- src/server/game/Chat/Commands/Level3.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/server/game/Chat') diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 24fb18349ef..afe487b2c1b 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -133,8 +133,8 @@ void Channel::CleanOldChannelsInDB() { if (sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) > 0) { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_CLEAN_CHANNEL); - stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION)*DAY); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS); + stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY); CharacterDatabase.Execute(stmt); sLog->outDebug(LOG_FILTER_CHATSYS,"Cleaned out unused custom chat channels."); diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index a50fae33b19..88e4e2912d2 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -4431,14 +4431,20 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args) { if(chn) chn->SetOwnership(true); - CharacterDatabase.PExecute("UPDATE channels SET m_ownership = 1 WHERE m_name LIKE '%s'", channel); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL_OWNERSHIP); + stmt->setUInt8 (0, 1); + stmt->setString(1, channel); + CharacterDatabase.Execute(stmt); PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channel); } else if (strcmp(argstr, "off") == 0) { if(chn) chn->SetOwnership(false); - CharacterDatabase.PExecute("UPDATE channels SET m_ownership = 0 WHERE m_name LIKE '%s'", channel); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL_OWNERSHIP); + stmt->setUInt8 (0, 0); + stmt->setString(1, channel); + CharacterDatabase.Execute(stmt); PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channel); } else -- cgit v1.2.3