From 91c7b5d2ca6cc1a51eabdc0ee9bcbe3d22c8a76a Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 31 Mar 2012 15:48:40 +0100 Subject: Core/DBLayer: Delete a triplicated prepared statement (LoginDatabase) Thanks to Anubiss for spotting it --- src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 8 ++++---- src/server/game/Chat/Commands/Level3.cpp | 4 ++-- src/server/shared/Database/Implementation/LoginDatabase.cpp | 2 -- src/server/shared/Database/Implementation/LoginDatabase.h | 2 -- 4 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index ab451a38fa8..1c24dfc061d 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -94,10 +94,10 @@ void ArenaTeamMgr::LoadArenaTeams() // Clean out the trash before loading anything CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); // One-time query - // 0 1 2 3 4 5 6 7 8 - QueryResult result = CharacterDatabase.Query("SELECT arena_team.arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " - // 9 10 11 12 13 14 - "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arena_team.arenaTeamId ASC"); + // 0 1 2 3 4 5 6 7 8 + QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, " + // 9 10 11 12 13 14 + "rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team ORDER BY arenaTeamId ASC"); if (!result) { diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index a88bf06898c..062f04bf4dd 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -3302,7 +3302,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args) bool ChatHandler::HandleBanListAccountCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); @@ -3410,7 +3410,7 @@ bool ChatHandler::HandleBanListHelper(PreparedQueryResult result) bool ChatHandler::HandleBanListIPCommand(const char *args) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_IP_BANS); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS); LoginDatabase.Execute(stmt); char* cFilter = strtok((char*)args, " "); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index df92c6fa77c..70d874be31d 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -56,8 +56,6 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_DEL_OLD_IP_BANS, "DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 4ad9ac1a251..2b9d94cbceb 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -76,8 +76,6 @@ enum LoginDatabaseStatements LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_INS_ACCOUNT, LOGIN_INS_REALM_CHARACTERS_INIT, - LOGIN_DEL_OLD_BANS, - LOGIN_DEL_OLD_IP_BANS, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_INS_LOG, -- cgit v1.2.3