From 5357b1ba7773801bff66c3bbffe3d2b7c73847ad Mon Sep 17 00:00:00 2001 From: Azazel Date: Mon, 11 Apr 2011 14:39:00 +0600 Subject: Core/CharDB Cleanup: alter `corpse` table making column names lowerCamel and move all queries to prepared statements. NOTICE: column can be named `guid` only if it represents character guid. All other guids will be renamed to reflect their purpose (like corpseGuid in this specific case) --- src/server/shared/Database/Implementation/CharacterDatabase.cpp | 8 ++++++++ src/server/shared/Database/Implementation/CharacterDatabase.h | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'src/server/shared/Database/Implementation') diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 0a73bed003a..37d56b2ee1f 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -304,4 +304,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_ADD_PLAYER_HOMEBIND, "INSERT INTO character_homebind (guid, mapId, zoneId, posX, posY, posZ) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_SET_PLAYER_HOMEBIND, "UPDATE character_homebind SET mapId = ?, zoneId = ?, posX = ?, posY = ?, posZ = ? WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_PLAYER_HOMEBIND, "DELETE FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC) + + // Corpse + PREPARE_STATEMENT(CHAR_LOAD_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_ADD_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_RESET_NONEXISTENT_INSTANCE_FOR_CORPSES, "UPDATE corpse SET instanceId = 0 WHERE instanceId > 0 AND instanceId NOT IN (SELECT id FROM instance)", CONNECTION_SYNCH) } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index cd68e7419ea..4e66cc7eadc 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -258,6 +258,13 @@ enum CharacterDatabaseStatements CHAR_SET_PLAYER_HOMEBIND, CHAR_DEL_PLAYER_HOMEBIND, + CHAR_LOAD_CORPSES, + CHAR_ADD_CORPSE, + CHAR_DEL_CORPSE, + CHAR_DEL_PLAYER_CORPSES, + CHAR_DEL_OLD_CORPSES, + CHAR_RESET_NONEXISTENT_INSTANCE_FOR_CORPSES, + MAX_CHARACTERDATABASE_STATEMENTS, }; -- cgit v1.2.3