Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Core/DBLayer: Remnant cleanups

  • Loading branch information...
commit 4665d5bfc456a49b10b0817db5473c3ee5c86603 1 parent 178c658
@leak leak authored
View
6 src/server/shared/Database/DatabaseWorkerPool.h
@@ -133,6 +133,7 @@ class DatabaseWorkerPool
*/
//! Enqueues a one-way SQL operation in string format that will be executed asynchronously.
+ //! This method should only be used for queries that are only executed once, e.g during startup.
void Execute(const char* sql)
{
if (!sql)
@@ -143,6 +144,7 @@ class DatabaseWorkerPool
}
//! Enqueues a one-way SQL operation in string format -with variable args- that will be executed asynchronously.
+ //! This method should only be used for queries that are only executed once, e.g during startup.
void PExecute(const char* sql, ...)
{
if (!sql)
@@ -166,10 +168,11 @@ class DatabaseWorkerPool
}
/**
- Direct syncrhonous one-way statement methods.
+ Direct synchronous one-way statement methods.
*/
//! Directly executes a one-way SQL operation in string format, that will block the calling thread until finished.
+ //! This method should only be used for queries that are only executed once, e.g during startup.
void DirectExecute(const char* sql)
{
if (!sql)
@@ -181,6 +184,7 @@ class DatabaseWorkerPool
}
//! Directly executes a one-way SQL operation in string format -with variable args-, that will block the calling thread until finished.
+ //! This method should only be used for queries that are only executed once, e.g during startup.
void DirectPExecute(const char* sql, ...)
{
if (!sql)
View
14 src/server/worldserver/Master.cpp
@@ -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
View
2  src/server/worldserver/Master.h
@@ -37,7 +37,7 @@ class Master
bool _StartDB();
void _StopDB();
- void clearOnlineAccounts();
+ void ClearOnlineAccounts();
};
#define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance()
Please sign in to comment.
Something went wrong with that request. Please try again.