Replace some misplaced DirectExecute´s with delayed Execute calls. DirectExecute at this moment should only be used for transaction control and not for dynamic content.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-06-28 23:19:54 +02:00
parent 95aadc4037
commit 87cc652a82
2 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -1173,14 +1173,14 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guid, uint32 linkedGuid)
if (!linkedGuid) // we're removing the linking if (!linkedGuid) // we're removing the linking
{ {
mCreatureLinkedRespawnMap.erase(guid); mCreatureLinkedRespawnMap.erase(guid);
WorldDatabase.DirectPExecute("DELETE FROM creature_linked_respawn WHERE guid = '%u'",guid); WorldDatabase.PExecute("DELETE FROM creature_linked_respawn WHERE guid = '%u'",guid);
return true; return true;
} }
if (CheckCreatureLinkedRespawn(guid,linkedGuid)) // we add/change linking if (CheckCreatureLinkedRespawn(guid,linkedGuid)) // we add/change linking
{ {
mCreatureLinkedRespawnMap[guid] = linkedGuid; mCreatureLinkedRespawnMap[guid] = linkedGuid;
WorldDatabase.DirectPExecute("REPLACE INTO creature_linked_respawn (guid,linkedGuid) VALUES ('%u','%u')",guid,linkedGuid); WorldDatabase.PExecute("REPLACE INTO creature_linked_respawn (guid,linkedGuid) VALUES ('%u','%u')",guid,linkedGuid);
return true; return true;
} }
return false; return false;
@@ -243,7 +243,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
db.escape_string(fieldValue); db.escape_string(fieldValue);
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'"; ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
} }
db.DirectPExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str()); db.PExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
} while (result->NextRow()); } while (result->NextRow());
} }
} }
@@ -289,7 +289,7 @@ void InstanceSaveManager::CleanupInstances()
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
if (InstanceSet.find(fields[0].GetUInt32()) == InstanceSet.end()) if (InstanceSet.find(fields[0].GetUInt32()) == InstanceSet.end())
WorldDatabase.DirectPExecute("DELETE FROM creature_respawn WHERE instance = '%u'", fields[0].GetUInt32()); WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'", fields[0].GetUInt32());
} }
while (result->NextRow()); while (result->NextRow());
} }
@@ -302,7 +302,7 @@ void InstanceSaveManager::CleanupInstances()
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
if (InstanceSet.find(fields[0].GetUInt32()) == InstanceSet.end()) if (InstanceSet.find(fields[0].GetUInt32()) == InstanceSet.end())
WorldDatabase.DirectPExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", fields[0].GetUInt32()); WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", fields[0].GetUInt32());
} }
while (result->NextRow()); while (result->NextRow());
} }
@@ -433,7 +433,7 @@ void InstanceSaveManager::LoadResetTimes()
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance); InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
if (itr != instResetTime.end() && itr->second.second != resettime) if (itr != instResetTime.end() && itr->second.second != resettime)
{ {
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance); CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
itr->second.second = resettime; itr->second.second = resettime;
} }
} }
@@ -462,14 +462,14 @@ void InstanceSaveManager::LoadResetTimes()
if (!mapDiff) if (!mapDiff)
{ {
sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); sLog.outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty); CharacterDatabase.PExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty);
continue; continue;
} }
// update the reset time if the hour in the configs changes // update the reset time if the hour in the configs changes
uint64 newresettime = (oldresettime / DAY) * DAY + diff; uint64 newresettime = (oldresettime / DAY) * DAY + diff;
if (oldresettime != newresettime) if (oldresettime != newresettime)
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty); CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
SetResetTimeFor(mapid,difficulty,newresettime); SetResetTimeFor(mapid,difficulty,newresettime);
} while (result->NextRow()); } while (result->NextRow());
@@ -500,7 +500,7 @@ void InstanceSaveManager::LoadResetTimes()
{ {
// initialize the reset time // initialize the reset time
t = today + period + diff; t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t); CharacterDatabase.PExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
} }
if (t < now) if (t < now)
@@ -509,7 +509,7 @@ void InstanceSaveManager::LoadResetTimes()
// calculate the next reset time // calculate the next reset time
t = (t / DAY) * DAY; t = (t / DAY) * DAY;
t += ((today - t) / period + 1) * period + diff; t += ((today - t) / period + 1) * period + diff;
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty); CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
} }
SetResetTimeFor(mapid,difficulty,t); SetResetTimeFor(mapid,difficulty,t);