Core/DBLayer: Remnant cleanups

This commit is contained in:
leak
2012-03-19 18:09:14 +01:00
parent 178c658363
commit 4665d5bfc4
3 changed files with 12 additions and 10 deletions
+6 -8
View File
@@ -294,7 +294,7 @@ int Master::Run()
rar_thread.wait();
///- Clean database before leaving
clearOnlineAccounts();
ClearOnlineAccounts();
_StopDB();
@@ -454,7 +454,7 @@ bool Master::_StartDB()
sLog->SetRealmID(realmID);
///- Clean the database before starting
clearOnlineAccounts();
ClearOnlineAccounts();
///- Insert version info into DB
WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _HASH); // One-time query
@@ -475,14 +475,12 @@ void Master::_StopDB()
}
/// Clear 'online' status for all accounts with characters in this realm
void Master::clearOnlineAccounts()
void Master::ClearOnlineAccounts()
{
// Cleanup online status for characters hosted at current realm
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
LoginDatabase.DirectPExecute(
"UPDATE account SET online = 0 WHERE online > 0 "
"AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')", realmID);
// Reset online status for all accounts with characters on the current realm
LoginDatabase.DirectPExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = %d)", realmID);
// Reset online status for all characters
CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0");
// Battleground instance ids reset at server restart
+1 -1
View File
@@ -37,7 +37,7 @@ class Master
bool _StartDB();
void _StopDB();
void clearOnlineAccounts();
void ClearOnlineAccounts();
};
#define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance()