mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Core/DBLayer: Prevent using prepared statements on wrong database
This commit is contained in:
@@ -3570,7 +3570,7 @@ void InstanceMap::CreateInstanceData(bool load)
|
||||
if (load)
|
||||
{
|
||||
/// @todo make a global storage for this
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_INSTANCE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_INSTANCE);
|
||||
stmt->setUInt16(0, uint16(GetId()));
|
||||
stmt->setUInt32(1, i_InstanceId);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
@@ -3819,7 +3819,7 @@ bool Map::GetEntrancePos(int32 &mapid, float &x, float &y)
|
||||
|
||||
bool InstanceMap::HasPermBoundPlayers() const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE);
|
||||
stmt->setUInt16(0,GetInstanceId());
|
||||
return !!CharacterDatabase.Query(stmt);
|
||||
}
|
||||
@@ -3981,7 +3981,7 @@ void Map::SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime
|
||||
|
||||
_creatureRespawnTimes[dbGuid] = respawnTime;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
|
||||
stmt->setUInt64(0, dbGuid);
|
||||
stmt->setUInt32(1, uint32(respawnTime));
|
||||
stmt->setUInt16(2, GetId());
|
||||
@@ -3993,7 +3993,7 @@ void Map::RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid)
|
||||
{
|
||||
_creatureRespawnTimes.erase(dbGuid);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN);
|
||||
stmt->setUInt64(0, dbGuid);
|
||||
stmt->setUInt16(1, GetId());
|
||||
stmt->setUInt32(2, GetInstanceId());
|
||||
@@ -4011,7 +4011,7 @@ void Map::SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime)
|
||||
|
||||
_goRespawnTimes[dbGuid] = respawnTime;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
|
||||
stmt->setUInt64(0, dbGuid);
|
||||
stmt->setUInt32(1, uint32(respawnTime));
|
||||
stmt->setUInt16(2, GetId());
|
||||
@@ -4023,7 +4023,7 @@ void Map::RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
|
||||
{
|
||||
_goRespawnTimes.erase(dbGuid);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GO_RESPAWN);
|
||||
stmt->setUInt64(0, dbGuid);
|
||||
stmt->setUInt16(1, GetId());
|
||||
stmt->setUInt32(2, GetInstanceId());
|
||||
@@ -4032,7 +4032,7 @@ void Map::RemoveGORespawnTime(ObjectGuid::LowType dbGuid)
|
||||
|
||||
void Map::LoadRespawnTimes()
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CREATURE_RESPAWNS);
|
||||
stmt->setUInt16(0, GetId());
|
||||
stmt->setUInt32(1, GetInstanceId());
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
@@ -4073,7 +4073,7 @@ void Map::DeleteRespawnTimes()
|
||||
|
||||
void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE);
|
||||
stmt->setUInt16(0, mapId);
|
||||
stmt->setUInt32(1, instanceId);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -4104,7 +4104,7 @@ void Map::LoadCorpseData()
|
||||
{
|
||||
std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, GetInstanceId());
|
||||
|
||||
@@ -4163,7 +4163,7 @@ void Map::LoadCorpseData()
|
||||
void Map::DeleteCorpseData()
|
||||
{
|
||||
// DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSES_FROM_MAP);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSES_FROM_MAP);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, GetInstanceId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
Reference in New Issue
Block a user