Core/DBLayer: Refactor prepared statement defines to new format (char db)
This commit is contained in:
@@ -55,7 +55,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
// If storing custom channels in the db is enabled either load or save the channel
|
||||
if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
|
||||
{
|
||||
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_CHANNEL);
|
||||
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHANNEL);
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, m_Team);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
@@ -85,7 +85,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
}
|
||||
else // save
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, m_Team);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -108,7 +108,7 @@ void Channel::UpdateChannelInDB() const
|
||||
|
||||
std::string banListStr = banlist.str();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
|
||||
stmt->setBool(0, m_announce);
|
||||
stmt->setBool(1, m_ownership);
|
||||
stmt->setString(2, m_password);
|
||||
@@ -124,7 +124,7 @@ void Channel::UpdateChannelInDB() const
|
||||
|
||||
void Channel::UpdateChannelUseageInDB() const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL_USAGE);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
|
||||
stmt->setString(0, m_name);
|
||||
stmt->setUInt32(1, m_Team);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -2198,7 +2198,7 @@ void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32
|
||||
else
|
||||
{
|
||||
// Update level and reset XP, everything else will be updated at login
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_LEVEL);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
|
||||
stmt->setUInt8(0, uint8(newLevel));
|
||||
stmt->setUInt32(1, GUID_LOPART(playerGuid));
|
||||
@@ -2691,7 +2691,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ALL_AT_LOGIN_FLAGS);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
|
||||
|
||||
stmt->setUInt16(0, uint16(atLogin));
|
||||
|
||||
@@ -3112,7 +3112,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
|
||||
if (!target)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_GUID_BY_NAME);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
|
||||
stmt->setString(0, name);
|
||||
PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
|
||||
|
||||
@@ -3127,7 +3127,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
else
|
||||
target_guid = target->GetGUIDLow();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_BANINFO);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
stmt->setUInt32(0, target_guid);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
@@ -3222,7 +3222,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
return false;
|
||||
|
||||
std::string filter(cFilter);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_GUID_BY_NAME_FILTER);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
stmt->setString(0, filter.c_str());
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
@@ -3239,7 +3239,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_GET_BANNED_NAME);
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banresult = CharacterDatabase.Query(stmt2);
|
||||
if (banresult)
|
||||
@@ -3261,7 +3261,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
|
||||
std::string char_name = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_GET_BANINFO_LIST);
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
|
||||
if (banInfo)
|
||||
@@ -4467,7 +4467,7 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args)
|
||||
{
|
||||
if (chn)
|
||||
chn->SetOwnership(true);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL_OWNERSHIP);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
|
||||
stmt->setUInt8 (0, 1);
|
||||
stmt->setString(1, channel);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -4477,7 +4477,7 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args)
|
||||
{
|
||||
if (chn)
|
||||
chn->SetOwnership(false);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_CHANNEL_OWNERSHIP);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
|
||||
stmt->setUInt8 (0, 0);
|
||||
stmt->setString(1, channel);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
Reference in New Issue
Block a user