[11081] Beautify some SQL log queries and remove not needed enclose character

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-01-29 10:40:02 +01:00
parent 117991076d
commit 3251f39684
4 changed files with 21 additions and 21 deletions

View file

@ -1068,7 +1068,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
// updated in DB // updated in DB
WorldDatabase.BeginTransaction(); WorldDatabase.BeginTransaction();
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", m_DBTableGuid);
std::ostringstream ss; std::ostringstream ss;
ss << "INSERT INTO creature VALUES (" ss << "INSERT INTO creature VALUES ("
@ -1359,12 +1359,12 @@ void Creature::DeleteFromDB()
sObjectMgr.DeleteCreatureData(m_DBTableGuid); sObjectMgr.DeleteCreatureData(m_DBTableGuid);
WorldDatabase.BeginTransaction(); WorldDatabase.BeginTransaction();
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid=%u", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid=%u", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM game_event_creature_data WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM game_event_creature_data WHERE guid=%u", m_DBTableGuid);
WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid = '%u'", m_DBTableGuid); WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid=%u", m_DBTableGuid);
WorldDatabase.CommitTransaction(); WorldDatabase.CommitTransaction();
} }

View file

@ -1695,7 +1695,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(char* args)
sWaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), wait, 0); sWaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), wait, 0);
// update movement type // update movement type
WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid); WorldDatabase.PExecuteLog("UPDATE creature SET MovementType=%u WHERE guid=%u", WAYPOINT_MOTION_TYPE,lowguid);
if (pCreature) if (pCreature)
{ {
pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
@ -2965,7 +2965,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
target->SaveToDB(); target->SaveToDB();
} }
else else
WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid); WorldDatabase.PExecuteLog("UPDATE creature SET MovementType=%u WHERE guid=%u", WAYPOINT_MOTION_TYPE,lowguid);
PSendSysMessage(LANG_WAYPOINT_ADDED, point, lowguid); PSendSysMessage(LANG_WAYPOINT_ADDED, point, lowguid);
@ -3574,7 +3574,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
{ {
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid); PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid);
hasError = true; hasError = true;
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpGuid); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", wpGuid);
} }
else else
{ {
@ -3628,7 +3628,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
wpCreature->SetVisibility(VISIBILITY_OFF); wpCreature->SetVisibility(VISIBILITY_OFF);
DEBUG_LOG("DEBUG: UPDATE creature_movement SET wpguid = '%u", wpCreature->GetGUIDLow()); DEBUG_LOG("DEBUG: UPDATE creature_movement SET wpguid = '%u", wpCreature->GetGUIDLow());
// set "wpguid" column to the visual waypoint // set "wpguid" column to the visual waypoint
WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), lowguid, point); WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid=%u WHERE id=%u and point=%u", wpCreature->GetGUIDLow(), lowguid, point);
wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
@ -3754,7 +3754,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
if (show == "off") if (show == "off")
{ {
QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", VISUAL_WAYPOINT); QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id=%u", VISUAL_WAYPOINT);
if (!result) if (!result)
{ {
SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND); SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
@ -3771,7 +3771,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
{ {
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid); PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid);
hasError = true; hasError = true;
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpGuid); WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", wpGuid);
} }
else else
{ {
@ -3780,7 +3780,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
} }
}while(result->NextRow()); }while(result->NextRow());
// set "wpguid" column to "empty" - no visual waypoint spawned // set "wpguid" column to "empty" - no visual waypoint spawned
WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'"); WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid=0 WHERE wpguid <> 0");
if (hasError) if (hasError)
{ {

View file

@ -453,7 +453,7 @@ void WaypointManager::AddLastNode(uint32 id, float x, float y, float z, float o,
void WaypointManager::AddAfterNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid) void WaypointManager::AddAfterNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid)
{ {
for(uint32 i = GetLastPoint(id, 0); i > point; i--) for(uint32 i = GetLastPoint(id, 0); i > point; i--)
WorldDatabase.PExecuteLog("UPDATE creature_movement SET point=point+1 WHERE id='%u' AND point='%u'", id, i); WorldDatabase.PExecuteLog("UPDATE creature_movement SET point=point+1 WHERE id=%u AND point=%u", id, i);
_addNode(id, point + 1, x, y, z, o, delay, wpGuid); _addNode(id, point + 1, x, y, z, o, delay, wpGuid);
} }
@ -463,7 +463,7 @@ void WaypointManager::_addNode(uint32 id, uint32 point, float x, float y, float
{ {
if(point == 0) return; // counted from 1 in the DB if(point == 0) return; // counted from 1 in the DB
WorldDatabase.PExecuteLog("INSERT INTO creature_movement (id,point,position_x,position_y,position_z,orientation,wpguid,waittime) " WorldDatabase.PExecuteLog("INSERT INTO creature_movement (id,point,position_x,position_y,position_z,orientation,wpguid,waittime) "
"VALUES ('%u','%u','%f', '%f', '%f', '%f', '%u', '%u')", "VALUES (%u,%u, %f,%f,%f,%f, %u,%u)",
id, point, x, y, z, o, wpGuid, delay); id, point, x, y, z, o, wpGuid, delay);
WaypointPathMap::iterator itr = m_pathMap.find(id); WaypointPathMap::iterator itr = m_pathMap.find(id);
if(itr == m_pathMap.end()) if(itr == m_pathMap.end())
@ -489,8 +489,8 @@ uint32 WaypointManager::GetLastPoint(uint32 id, uint32 default_notfound)
void WaypointManager::DeleteNode(uint32 id, uint32 point) void WaypointManager::DeleteNode(uint32 id, uint32 point)
{ {
if(point == 0) return; // counted from 1 in the DB if(point == 0) return; // counted from 1 in the DB
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id='%u' AND point='%u'", id, point); WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u AND point=%u", id, point);
WorldDatabase.PExecuteLog("UPDATE creature_movement SET point=point-1 WHERE id='%u' AND point>'%u'", id, point); WorldDatabase.PExecuteLog("UPDATE creature_movement SET point=point-1 WHERE id=%u AND point>%u", id, point);
WaypointPathMap::iterator itr = m_pathMap.find(id); WaypointPathMap::iterator itr = m_pathMap.find(id);
if(itr != m_pathMap.end() && point <= itr->second.size()) if(itr != m_pathMap.end() && point <= itr->second.size())
itr->second.erase(itr->second.begin() + (point-1)); itr->second.erase(itr->second.begin() + (point-1));
@ -498,7 +498,7 @@ void WaypointManager::DeleteNode(uint32 id, uint32 point)
void WaypointManager::DeletePath(uint32 id) void WaypointManager::DeletePath(uint32 id)
{ {
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id='%u'", id); WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", id);
WaypointPathMap::iterator itr = m_pathMap.find(id); WaypointPathMap::iterator itr = m_pathMap.find(id);
if(itr != m_pathMap.end()) if(itr != m_pathMap.end())
_clearPath(itr->second); _clearPath(itr->second);
@ -511,7 +511,7 @@ void WaypointManager::DeletePath(uint32 id)
void WaypointManager::SetNodePosition(uint32 id, uint32 point, float x, float y, float z) void WaypointManager::SetNodePosition(uint32 id, uint32 point, float x, float y, float z)
{ {
if(point == 0) return; // counted from 1 in the DB if(point == 0) return; // counted from 1 in the DB
WorldDatabase.PExecuteLog("UPDATE creature_movement SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'", x, y, z, id, point); WorldDatabase.PExecuteLog("UPDATE creature_movement SET position_x=%f, position_y=%f, position_z=%f WHERE id=%u AND point=%u", x, y, z, id, point);
WaypointPathMap::iterator itr = m_pathMap.find(id); WaypointPathMap::iterator itr = m_pathMap.find(id);
if(itr != m_pathMap.end() && point <= itr->second.size()) if(itr != m_pathMap.end() && point <= itr->second.size())
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11080" #define REVISION_NR "11081"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__