EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DBCleaner.cpp
Go to the documentation of this file.
1 
9 #include "DBCleaner.h"
10 #include "database/EVEDBUtils.h"
11 
12 // This module exists to clean up the database from stuff which could persist in the DB due to crashes.
13 
15  sLog.Blue(" DBCleaner", "Database Cleaner Initialized.");
16 
17  // Add new cleaning jobs below
18  CleanEntity(EVEDB::invTypes::CynosuralFieldI); //Clean cynosural fields
19 
20  // Don't add anything below this line
21  sLog.Blue(" DBCleaner", "Cleaning complete.");
22 }
23 
25  DBerror err;
26  // Delete entity attributes associated with removed entities
27  sDatabase.RunQuery(err, "DELETE FROM entity_attributes WHERE itemID IN (SELECT itemID FROM entity WHERE typeID = %u);", type);
28  // Delete entities themselves
29  sDatabase.RunQuery(err, "DELETE FROM entity WHERE typeID = %u", type);
30 }
void Initialize()
Definition: DBCleaner.cpp:14
#define sDatabase
Definition: dbcore.h:199
void CleanEntity(uint32 type)
Definition: DBCleaner.cpp:24
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
unsigned __int32 uint32
Definition: eve-compat.h:50
Definition: dbcore.h:39