EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ManagerDB Class Reference

#include "ManagerDB.h"

ManagerDB.cpp

cosmic manager database methods : Allan

Date
: 17 April 2016
static void GetStatisticData (DBQueryResult &res, int64 starttime)
 
static void SaveStatisticData (StatisticData &data)
 
static void UpdateStatisticHistory (StatisticData &data)
 
static void GetTypeData (DBQueryResult &res)
 
static void GetGroupData (DBQueryResult &res)
 
static void GetCategoryData (DBQueryResult &res)
 
static void GetOreBySSC (DBQueryResult &res)
 
static void GetSkillList (DBQueryResult &res)
 
static void GetSystemData (DBQueryResult &res)
 
static void GetStaticData (DBQueryResult &res)
 
static void GetMoonResouces (DBQueryResult &res)
 
static void GetAgentLocation (DBQueryResult &res)
 
static void GetSalvageGroups (DBQueryResult &res)
 
static void GetTypeAttributes (DBQueryResult &res)
 
static void LoadNPCCorpFactionData (DBQueryResult &res)
 
static void LoadCorpFactions (std::map< uint32, uint32 > &into)
 
static void LoadFactionStationCounts (std::map< uint32, uint32 > &into)
 
static void LoadFactionSystemCounts (std::map< uint32, uint32 > &into)
 
static void LoadFactionRegions (std::map< int32, PyRep * > &into)
 
static void LoadFactionConstellations (std::map< int32, PyRep * > &into)
 
static void LoadFactionSolarSystems (std::map< int32, PyRep * > &into)
 
static void LoadFactionRaces (std::map< int32, PyRep * > &into)
 
static PyDictLoadNPCCorpInfo ()
 
static PyObjectGetEntryTypes ()
 
static PyObjectGetKeyMap ()
 
static PyObjectGetNPCDivisions ()
 
static PyObjectGetBillTypes ()
 
static PyObjectExGetAgents ()
 
static PyObjectExGetOperands ()
 
static void GetRegionFaction (DBQueryResult &res)
 
static bool GetAsteroidData (uint32 asteroidID, AsteroidData &dbData)
 
static void CreateRoidItemID (ItemData &idata, AsteroidData &adata)
 
static void DeleteSpawnedRats ()
 
static void GetSpawnClasses (DBQueryResult &res)
 
static void GetFactionGroups (DBQueryResult &res)
 
static void GetRegionRatFaction (DBQueryResult &res)
 
static void GetGroupTypeIDs (uint8 shipClass, uint16 groupID, uint32 factionID, DBQueryResult &res)
 
static void GetDunRoomData (DBQueryResult &res)
 
static void GetDunRoomInfo (DBQueryResult &res)
 
static void GetDunEntryData (DBQueryResult &res)
 
static void GetDunTemplates (DBQueryResult &res)
 
static void GetDunGroupData (DBQueryResult &res)
 
static void GetDunSpawnInfo (DBQueryResult &res)
 
static void SaveActiveDungeon (Dungeon::ActiveData &dun)
 
static void ClearDungeons ()
 
static void ClearDungeons (uint32 systemID)
 
static bool GetSavedDungeons (uint32 systemID, std::vector< Dungeon::ActiveData > &into)
 
static GPoint GetAnomalyPos (std::string &string)
 
static void GetWHSystemClass (DBQueryResult &res)
 
void ClearAsteroids ()
 
void SaveRoid (AsteroidData &data)
 
void SaveSystemRoids (uint32 systemID, std::vector< AsteroidData > &roids)
 
void RemoveAsteroid (uint32 asteroidID)
 
bool LoadSystemRoids (uint32 systemID, uint32 &beltID, std::vector< AsteroidData > &into)
 
void SaveAnomaly (CosmicSignature &sig)
 
void GetAnomalyList (DBQueryResult &res)
 
void GetSystemAnomalies (uint32 systemID, DBQueryResult &res)
 
void GetSystemAnomalies (uint32 systemID, std::vector< CosmicSignature > &sigs)
 

Detailed Description

Definition at line 22 of file ManagerDB.h.

Member Function Documentation

void ManagerDB::ClearAsteroids ( )

Definition at line 545 of file ManagerDB.cpp.

References sDatabase.

546 {
547  DBerror err;
548  sDatabase.RunQuery(err, "DELETE FROM sysAsteroids WHERE 1");
549  sDatabase.RunQuery(err, "ALTER TABLE `sysAsteroids` auto_increment = 450000000");
550 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39
void ManagerDB::ClearDungeons ( )
static

Definition at line 690 of file ManagerDB.cpp.

References sDatabase.

Referenced by DungeonDataMgr::Initialize(), and SystemManager::UnloadSystem().

691 {
692  DBerror err;
693  sDatabase.RunQuery(err, "DELETE FROM dunActive WHERE 1");
694  sDatabase.RunQuery(err, "DELETE FROM sysSignatures WHERE 1");
695  // anomaly items are all temp, except roids, so we may not need this...
696  sDatabase.RunQuery(err, "DELETE FROM entity_attributes WHERE itemID IN (SELECT itemID FROM entity WHERE customInfo LIKE 'Dungeon%%')");
697  sDatabase.RunQuery(err, "DELETE FROM entity WHERE customInfo LIKE 'Dungeon%%'");
698 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void ManagerDB::ClearDungeons ( uint32  systemID)
static

Definition at line 700 of file ManagerDB.cpp.

References sDatabase.

701 {
702  DBerror err;
703  sDatabase.RunQuery(err, "DELETE FROM dunActive WHERE systemID = %u", systemID);
704  sDatabase.RunQuery(err, "DELETE FROM sysSignatures WHERE systemID = %u", systemID);
705  // anomaly items are all temp, except roids, so we may not need this...
706  sDatabase.RunQuery(err, "DELETE FROM entity_attributes WHERE itemID IN (SELECT itemID FROM entity WHERE locationID = %u AND customInfo LIKE 'Dungeon%%')", systemID);
707  sDatabase.RunQuery(err, "DELETE FROM entity WHERE locationID = %u AND customInfo LIKE 'Dungeon%%'", systemID);
708 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39
void ManagerDB::CreateRoidItemID ( ItemData idata,
AsteroidData adata 
)
static

Definition at line 468 of file ManagerDB.cpp.

References AsteroidData::beltID, AsteroidData::itemID, AsteroidData::itemName, AsteroidData::position, AsteroidData::quantity, AsteroidData::radius, sDatabase, AsteroidData::systemID, AsteroidData::typeID, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

Referenced by AsteroidItem::Spawn().

469 {
470  DBerror err;
471  sDatabase.RunQueryLID(err, adata.itemID,
472  "INSERT INTO sysAsteroids (itemName,typeID,systemID,beltID,quantity,radius,x, y, z)"
473  " VALUES ('%s', %u, %u, %u, %f, %f, %f, %f, %f)",
474  adata.itemName.c_str(), adata.typeID, adata.systemID, adata.beltID, adata.quantity, adata.radius,
475  adata.position.x, adata.position.y, adata.position.z );
476 }
#define sDatabase
Definition: dbcore.h:199
GaFloat x
Definition: GaTypes.h:207
GaFloat y
Definition: GaTypes.h:207
std::string itemName
Definition: dbcore.h:39
GaFloat z
Definition: GaTypes.h:207

Here is the caller graph for this function:

void ManagerDB::DeleteSpawnedRats ( )
static

Definition at line 462 of file ManagerDB.cpp.

References sDatabase.

Referenced by ItemFactory::Initialize().

463 {
464  DBerror err;
465  sDatabase.RunQuery(err, "DELETE FROM entity WHERE customInfo LIKE '%beltrat%'");
466 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void ManagerDB::GetAgentLocation ( DBQueryResult res)
static

Definition at line 313 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

314 {
315  if (!sDatabase.RunQuery(res, "SELECT agentID, locationID FROM agtAgents"))
316  codelog(DATABASE__ERROR, "Error in GetAgentLocation query: %s", res.error.c_str());
317 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObjectEx * ManagerDB::GetAgents ( )
static

Definition at line 130 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBResultToCRowset(), DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

130  {
131  // NOTE: havent found data for agents in space yet....still looking.
132  DBQueryResult res;
133  if(!sDatabase.RunQuery(res,
134  "SELECT"
135  " agt.agentID,"
136  " agt.agentTypeID,"
137  " agt.divisionID,"
138  " agt.level,"
139  " agt.quality,"
140  " agt.corporationID,"
141  " chr.stationID,"
142  " chr.gender,"
143  " bl.bloodlineID"
144  " FROM agtAgents AS agt"
145  " LEFT JOIN chrNPCCharacters AS chr ON chr.characterID = agt.agentID"
146  " LEFT JOIN bloodlineTypes AS bl ON bl.typeID = chr.typeID"
147  ))
148  {
149  codelog(DATABASE__ERROR, "Error in GetAgents query: %s", res.error.c_str());
150  return nullptr;
151  }
152 
153  _log(DATABASE__RESULTS, "GetAgents returned %u items", res.GetRowCount());
154  return DBResultToCRowset(res);
155 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
PyObjectEx * DBResultToCRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:402
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetAnomalyList ( DBQueryResult res)

Definition at line 338 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

339 {// sysSignatures (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
340  if(!sDatabase.RunQuery(res,
341  "SELECT sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z"
342  " FROM sysSignatures"
343  " ORDER BY systemid")) {
344  _log(DATABASE__ERROR, "Error in GetAnomalyList query: %s", res.error.c_str());
345  }
346 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

GPoint ManagerDB::GetAnomalyPos ( std::string &  string)
static

Definition at line 348 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, DBQueryResult::GetRow(), NULL_ORIGIN(), and sDatabase.

349 {
350  DBQueryResult res;
351  if (!sDatabase.RunQuery(res, "SELECT x,y,z FROM sysSignatures WHERE sigID = '%s'", string.c_str()))
352  _log(DATABASE__ERROR, "Error in GetAnomalyPos query: %s", res.error.c_str());
353 
354  DBResultRow row;
355  if (!res.GetRow(row)) {
356  _log(DATABASE__MESSAGE, "GetAnomalyPos query returned no items");
357  return NULL_ORIGIN;
358  }
359 
360  GPoint pos(row.GetDouble(0), row.GetDouble(1), row.GetDouble(2));
361  return pos;
362 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
static const GPoint NULL_ORIGIN(0, 0, 0)
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

bool ManagerDB::GetAsteroidData ( uint32  asteroidID,
AsteroidData dbData 
)
static

Definition at line 478 of file ManagerDB.cpp.

References _log, AsteroidData::beltID, DBerror::c_str(), DBQueryResult::error, DBResultRow::GetDouble(), DBResultRow::GetInt(), DBQueryResult::GetRow(), DBResultRow::GetText(), AsteroidData::itemID, AsteroidData::itemName, AsteroidData::position, AsteroidData::quantity, AsteroidData::radius, sDatabase, AsteroidData::systemID, and AsteroidData::typeID.

Referenced by AsteroidItem::_LoadItem().

479 {
480  DBQueryResult res;
481  if(!sDatabase.RunQuery(res,
482  "SELECT itemName, typeID, systemID, beltID, quantity, radius, x, y, z"
483  " FROM sysAsteroids"
484  " WHERE itemID = %u", asteroidID)) {
485  _log(DATABASE__ERROR, "Error in GetAsteroidData query: %s", res.error.c_str());
486  return false;
487  }
488 
489  DBResultRow row;
490  if (res.GetRow(row)) {
491  dbData.itemID = asteroidID;
492  dbData.itemName = row.GetText(0);
493  dbData.typeID = row.GetInt(1);
494  dbData.systemID = row.GetInt(2);
495  dbData.beltID = row.GetInt(3);
496  dbData.quantity = row.GetDouble(4);
497  dbData.radius = row.GetDouble(5);
498  GPoint pos(row.GetDouble(6), row.GetDouble(7), row.GetDouble(8));
499  dbData.position = pos;
500  return true;
501  } else {
502  dbData = AsteroidData();
503  }
504 
505  return false;
506 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
#define _log(type, fmt,...)
Definition: logsys.h:124
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69
std::string itemName

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * ManagerDB::GetBillTypes ( )
static

Definition at line 118 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

118  {
119  DBQueryResult res;
120  if (!sDatabase.RunQuery(res, "SELECT billTypeID, billTypeName, description FROM billTypes")) {
121  codelog(DATABASE__ERROR, "Failed to query bill types: %s.", res.error.c_str());
122  return nullptr;
123  }
124 
125  _log(DATABASE__RESULTS, "GetBillTypes returned %u items", res.GetRowCount());
126 
127  return DBResultToRowset(res);
128 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetCategoryData ( DBQueryResult res)
static

Definition at line 16 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

16  {
17  if (!sDatabase.RunQuery(res, "SELECT categoryID, categoryName, description, published FROM invCategories"))
18  codelog(DATABASE__ERROR, "Error in GetCategoryData query: %s.", res.error.c_str());
19 
20  _log(DATABASE__RESULTS, "GetCategoryData returned %u items", res.GetRowCount());
21 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetDunEntryData ( DBQueryResult res)
static

Definition at line 604 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by DungeonDataMgr::Populate().

605 {
606  if (!sDatabase.RunQuery(res, "SELECT dunEntryID, dunEntryName, xpos, ypos, zpos FROM dunEntryData"))
607  _log(DATABASE__ERROR, "Error in GetDunRoomData query: %s", res.error.c_str());
608 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetDunGroupData ( DBQueryResult res)
static

Definition at line 610 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by DungeonDataMgr::Populate().

611 {
612  if (!sDatabase.RunQuery(res, "SELECT d.dunGroupID, d.itemTypeID, d.itemGroupID, t.typeName, t.groupID, g.categoryID, t.radius, d.xpos, d.ypos, d.zpos"
613  " FROM dunGroupData AS d"
614  " LEFT JOIN invTypes AS t ON d.itemTypeID = t.typeID"
615  " LEFT JOIN invGroups AS g ON g.groupID = t.groupID" ))
616  {
617  _log(DATABASE__ERROR, "Error in GetDunGroupData query: %s", res.error.c_str());
618  }
619 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetDunRoomData ( DBQueryResult res)
static

Definition at line 621 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by DungeonDataMgr::Populate().

622 {
623  if (!sDatabase.RunQuery(res, "SELECT dunRoomID, dunGroupID, xpos, ypos, zpos FROM dunRoomData"))
624  _log(DATABASE__ERROR, "Error in GetDunRoomData query: %s", res.error.c_str());
625 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetDunRoomInfo ( DBQueryResult res)
static

Definition at line 627 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

628 {
629  if (!sDatabase.RunQuery(res, "SELECT dunRoomID, dunRoomType, dunRoomCategory, dunRoomSpawnID, dunRoomSpawnType FROM dunRoomInfo"))
630  _log(DATABASE__ERROR, "Error in GetDunRoomInfo query: %s", res.error.c_str());
631 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

void ManagerDB::GetDunSpawnInfo ( DBQueryResult res)
static

Definition at line 633 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

634 {
635  if (!sDatabase.RunQuery(res, "SELECT dunRoomSpawnID, dunRoomSpawnType, xpos, ypos, zpos FROM dunRoomSpawnInfo"))
636  _log(DATABASE__ERROR, "Error in GetDunSpawnInfo query: %s", res.error.c_str());
637 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

void ManagerDB::GetDunTemplates ( DBQueryResult res)
static

Definition at line 639 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by DungeonDataMgr::Populate().

640 {
641  if (!sDatabase.RunQuery(res, "SELECT dunTemplateID, dunTemplateName, dunEntryID, dunSpawnID, dunRoomID FROM dunTemplates"))
642  _log(DATABASE__ERROR, "Error in GetDunTemplates query: %s", res.error.c_str());
643 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * ManagerDB::GetEntryTypes ( )
static

Definition at line 94 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

94  {
95  DBQueryResult res;
96  if (!sDatabase.RunQuery(res, "SELECT entryTypeID, entryTypeName, entryTypeNameID FROM jnlEntryTypeIDs")) {
97  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
98  return nullptr;
99  }
100 
101  _log(DATABASE__RESULTS, "GetEntryTypes returned %u items", res.GetRowCount());
102 
103  return DBResultToRowset(res);
104 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetFactionGroups ( DBQueryResult res)
static

Definition at line 390 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

390  {
391  if (!sDatabase.RunQuery(res, "SELECT shipClass, groupID, factionID FROM npcClassGroup"))
392  _log(DATABASE__ERROR, "Error in GetFactionGroups query: %s", res.error.c_str());
393 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetGroupData ( DBQueryResult res)
static

Definition at line 23 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

24 {
25  if (!sDatabase.RunQuery(res,
26  "SELECT"
27  " groupID,"
28  " categoryID,"
29  " groupName,"
30  " description,"
31  " useBasePrice,"
32  " allowManufacture,"
33  " allowRecycler,"
34  " anchored,"
35  " anchorable,"
36  " fittableNonSingleton,"
37  " published "
38  " FROM invGroups "))
39  codelog(DATABASE__ERROR, "Error in GetGroupData query: %s.", res.error.c_str());
40 
41  _log(DATABASE__RESULTS, "GetGroupData returned %u items", res.GetRowCount());
42 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetGroupTypeIDs ( uint8  shipClass,
uint16  groupID,
uint32  factionID,
DBQueryResult res 
)
static

Definition at line 401 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, factionAngel, factionBloodRaider, factionGuristas, factionRogueDrones, factionSanshas, factionSerpentis, and sDatabase.

Referenced by StaticDataMgr::Populate().

401  {
402  // this now gets advanced frigates and cruisers based on faction (best i could think of)
403  std::string name = "";
404 
405  // there are unused types in the data for these...just sayin
406  switch (factionID) {
407  case factionAngel: { // Cyber
408  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) { // 2 = adv frig, 5 = adv cruiser, 16 = adv frig, 19 = adv cruiser
409  name = "AND typeName LIKE '%Arch%'";
410  name = "AND typeName NOT LIKE '%Cyber%'";
411  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) { // 1 = frig, 4 = cruiser, 15 = frig, 18 = cruiser
412  name = "AND typeName NOT LIKE '%Arch%'";
413  name = "AND typeName NOT LIKE '%Cyber%'";
414  }
415  } break;
416  case factionBloodRaider: {
417  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) {
418  name = "AND typeName LIKE '%Elder%'";
419  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) {
420  name = "AND typeName NOT LIKE '%Elder%'";
421  }
422  } break;
423  case factionGuristas: { //Outlaw
424  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) {
425  name = "AND typeName LIKE '%Dire%'";
426  name = "AND typeName NOT LIKE '%Outlaw%'";
427  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) {
428  name = "AND typeName NOT LIKE '%Dire%'";
429  name = "AND typeName NOT LIKE '%Outlaw%'";
430  }
431  } break;
432  case factionSanshas: {
433  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) {
434  name = "AND typeName LIKE '%Loyal%'";
435  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) {
436  name = "AND typeName NOT LIKE '%Loyal%'";
437  }
438  } break;
439  case factionSerpentis: { //Crook
440  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) {
441  name = "AND typeName LIKE '%Guardian%'";
442  name = "AND typeName NOT LIKE '%Crook%'";
443  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) {
444  name = "AND typeName NOT LIKE '%Guardian%'";
445  name = "AND typeName NOT LIKE '%Crook%'";
446  }
447  } break;
448  case factionRogueDrones: {
449  if ((shipClass == 2) or (shipClass == 5) or (shipClass == 16) or (shipClass == 19)) {
450  name = "AND typeName LIKE '%Strain%'";
451  } else if ((shipClass == 1) or (shipClass == 4) or (shipClass == 15) or (shipClass == 18)) {
452  name = "AND typeName NOT LIKE '%Strain%'";
453  }
454  } break;
455  }
456 
457  if (!sDatabase.RunQuery(res, "SELECT typeID FROM invTypes WHERE groupID = %u %s ORDER BY typeID", groupID, name.c_str()))
458  _log(DATABASE__ERROR, "Error in GetGroupTypeIDs query: %s", res.error.c_str());
459 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * ManagerDB::GetKeyMap ( )
static

Definition at line 106 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

106  {
107  DBQueryResult res;
108  if (!sDatabase.RunQuery(res, "SELECT keyID, keyType, keyName, keyNameID FROM actKeyTypes")) {
109  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
110  return nullptr;
111  }
112 
113  _log(DATABASE__RESULTS, "GetKeyMap returned %u items", res.GetRowCount());
114 
115  return DBResultToRowset(res);
116 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetMoonResouces ( DBQueryResult res)
static

Definition at line 319 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, EVEDB::invGroups::Moon_Materials, and sDatabase.

Referenced by StaticDataMgr::Populate().

320 {
321  if (!sDatabase.RunQuery(res, "SELECT typeID,volume FROM invTypes WHERE groupID = %u", EVEDB::invGroups::Moon_Materials))
322  codelog(DATABASE__ERROR, "Error in GetMoonResouces query: %s", res.error.c_str());
323 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * ManagerDB::GetNPCDivisions ( )
static

Definition at line 269 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToRowset(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

269  {
270  DBQueryResult res;
271  if (!sDatabase.RunQuery(res,
272  "SELECT "
273  " divisionID, divisionName, description, leaderType, divisionNameID, leaderTypeID"
274  " FROM crpNPCDivisions" )) {
275  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
276  return nullptr;
277  }
278 
279  return DBResultToRowset(res);
280 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

PyObjectEx * ManagerDB::GetOperands ( )
static

Definition at line 157 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBResultToCIndexedRowset(), DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

157  {
158  DBQueryResult res;
159  if (!sDatabase.RunQuery(res,
160  "SELECT operandID, operandKey, description, format, arg1categoryID, arg2categoryID, resultCategoryID, pythonFormat FROM dgmOperands" )) {
161  codelog(DATABASE__ERROR, "Error in GetOperands query: %s.", res.error.c_str());
162  return nullptr;
163  }
164 
165  _log(DATABASE__RESULTS, "GetOperands returned %u items", res.GetRowCount());
166 
167  return DBResultToCIndexedRowset(res, "operandID");
168 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
PyObjectEx * DBResultToCIndexedRowset(DBQueryResult &result, const char *key)
Definition: EVEDBUtils.cpp:419
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetOreBySSC ( DBQueryResult res)
static

Definition at line 290 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

291 {
292  if (!sDatabase.RunQuery(res, "SELECT systemSec, roidID, percent FROM roidDistribution"))
293  codelog(DATABASE__ERROR, "Error in GetRoidDist query: %s", res.error.c_str());
294 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetRegionFaction ( DBQueryResult res)
static

Definition at line 380 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

380  {
381  if (!sDatabase.RunQuery(res, "SELECT regionID, factionID FROM mapRegions WHERE factionID != 0"))
382  _log(DATABASE__ERROR, "Error in GetRegionFactionInfo query: %s", res.error.c_str());
383 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetRegionRatFaction ( DBQueryResult res)
static

Definition at line 385 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

385  {
386  if (!sDatabase.RunQuery(res, "SELECT regionID, ratFactionID FROM mapRegions WHERE ratFactionID != 0"))
387  _log(DATABASE__ERROR, "Error in GetRegionFactionInfo query: %s", res.error.c_str());
388 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetSalvageGroups ( DBQueryResult res)
static

Definition at line 282 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

282  {
283  //facSalvage (factionID,itemID,itemName)
284  if (!sDatabase.RunQuery(res, "SELECT factionID, itemID FROM facSalvage")) {
285  codelog(DATABASE__ERROR, "Error in GetSalvageGroups query: %s", res.error.c_str());
286  return;
287  }
288 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

bool ManagerDB::GetSavedDungeons ( uint32  systemID,
std::vector< Dungeon::ActiveData > &  into 
)
static

Definition at line 645 of file ManagerDB.cpp.

References _log, DBerror::c_str(), Dungeon::ActiveData::dunExpiryTime, Dungeon::ActiveData::dunItemID, Dungeon::ActiveData::dunTemplateID, DBQueryResult::error, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), sDatabase, Dungeon::ActiveData::state, Dungeon::ActiveData::systemID, Dungeon::ActiveData::x, Dungeon::ActiveData::y, and Dungeon::ActiveData::z.

Referenced by DungeonMgr::Load().

646 {
647  DBQueryResult res;
648 
649  if (!sDatabase.RunQuery(res,
650  "SELECT systemID, state, dunTemplateID, dunExpiryTime, xpos, ypos, zpos"
651  " FROM dunActive" //Active Dungeons
652  " WHERE systemID = %u", systemID))
653  {
654  _log(DATABASE__ERROR, "Error in GetSavedDungeons query: %s", res.error.c_str());
655  return false;
656  }
657 
658  _log(DATABASE__RESULTS, "GetSavedDungeons returned %u items", res.GetRowCount());
659  DBResultRow row;
660  while(res.GetRow(row)) {
662  entry.systemID = row.GetInt(0);
663  entry.state = row.GetInt(1);
664  entry.dunItemID = 0;
665  entry.dunTemplateID = row.GetInt(2);
666  entry.dunExpiryTime = row.GetInt64(3);
667  entry.x = row.GetInt(4);
668  entry.y = row.GetInt(5);
669  entry.z = row.GetInt(6);
670  into.push_back(entry);
671  }
672 
673  return !into.empty();
674 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetSkillList ( DBQueryResult res)
static

Definition at line 70 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

71 {
72  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (SELECT groupID FROM invGroups WHERE categoryID = 16)"))
73  codelog(DATABASE__ERROR, "Error in GetSkillList query: %s", res.error.c_str());
74 
75  _log(DATABASE__RESULTS, "GetSkillList returned %u items", res.GetRowCount());
76 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetSpawnClasses ( DBQueryResult res)
static

Definition at line 395 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

395  {
396  if (!sDatabase.RunQuery(res, "SELECT type, sub, f, af, d, c, ac, bc, bs, h, o, cf, cd, cc, cbc, cbs FROM npcSpawnClass"))
397  _log(DATABASE__ERROR, "Error in GetSpawnClasses query: %s", res.error.c_str());
398 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetStaticData ( DBQueryResult res)
static

Definition at line 306 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

307 {
308  if (!sDatabase.RunQuery(res,
309  "SELECT itemID, regionID, constellationID, solarSystemID, typeID, radius, x, y, z FROM mapDenormalize WHERE solarSystemID IS NOT NULL"))
310  codelog(DATABASE__ERROR, "Error in GetStaticInfo query: %s", res.error.c_str());
311 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetStatisticData ( DBQueryResult res,
int64  starttime 
)
static

Definition at line 714 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StatisticMgr::CompileData().

715 {
716  if (!sDatabase.RunQuery(res,
717  "SELECT pcShots, pcMissiles, ramJobs, shipsSalvaged, pcBounties, npcBounties, oreMined, iskMarket, probesLaunched, sitesScanned"
718  " FROM srvStatisticData"
719  " WHERE timeStamp > %li", starttime))
720  codelog(DATABASE__ERROR, "Error in GetStatisticData query: %s", res.error.c_str());
721 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetSystemAnomalies ( uint32  systemID,
DBQueryResult res 
)

Definition at line 365 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

366 {// sysSignatures (sigTypeID,scanGroupID,sigGroupID,scanAttributeID,sigName,sigID,x,y,z)
367  if(!sDatabase.RunQuery(res,
368  "SELECT sigTypeID, scanGroupID, sigGroupID, scanAttributeID, sigName, sigID, x, y, z"
369  " FROM sysSignatures"
370  " WHERE systemID = %u", systemID)) {
371  _log(DATABASE__ERROR, "Error in GetSystemAnomalies query: %s", res.error.c_str());
372  }
373 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

void ManagerDB::GetSystemAnomalies ( uint32  systemID,
std::vector< CosmicSignature > &  sigs 
)

Definition at line 375 of file ManagerDB.cpp.

376 {// sysSignatures (sigID,sigItemID,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
377 
378 }
void ManagerDB::GetSystemData ( DBQueryResult res)
static

Definition at line 296 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

297 {
298  if (!sDatabase.RunQuery(res,
299  "SELECT mss.solarSystemID, mss.solarSystemName, mss.constellationID, mss.regionID, mss.securityClass, md.security, mss.factionID"
300  " FROM mapSolarSystems AS mss"
301  " LEFT JOIN mapDenormalize AS md ON (md.itemID = mss.solarSystemID)"
302  ))
303  codelog(DATABASE__ERROR, "Error in GetSystemData query: %s", res.error.c_str());
304 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetTypeAttributes ( DBQueryResult res)
static

Definition at line 78 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

79 {
80  if (!sDatabase.RunQuery(res, "SELECT typeID, attributeID, valueInt, valueFloat FROM dgmTypeAttributes"))
81  codelog(DATABASE__ERROR, "Error in GetTypeAttributes query: %s", res.error.c_str());
82 
83  _log(DATABASE__RESULTS, "GetTypeAttributes returned %u items", res.GetRowCount());
84 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetTypeData ( DBQueryResult res)
static

Definition at line 44 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

45 {
46  if (!sDatabase.RunQuery(res,
47  "SELECT"
48  " t.typeID,"
49  " t.groupID,"
50  " t.typeName,"
51  " t.description,"
52  " t.radius,"
53  " t.mass,"
54  " t.volume,"
55  " t.capacity,"
56  " t.portionSize,"
57  " t.raceID,"
58  " t.basePrice,"
59  " t.published,"
60  " t.marketGroupID,"
61  " t.chanceOfDuplicating,"
62  " m.metaGroupID"
63  " FROM invTypes AS t"
64  " LEFT JOIN invMetaTypes AS m USING (typeID)"))
65  codelog(DATABASE__ERROR, "Error in GetTypeData query: %s.", res.error.c_str());
66 
67  _log(DATABASE__RESULTS, "GetTypeData returned %u items", res.GetRowCount());
68 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::GetWHSystemClass ( DBQueryResult res)
static

Definition at line 598 of file ManagerDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

599 {
600  if (!sDatabase.RunQuery(res, "SELECT locationID, wormholeClassID FROM mapLocationWormholeClasses"))
601  _log(DATABASE__ERROR, "Error in GetWHSystemClass query: %s", res.error.c_str());
602 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadCorpFactions ( std::map< uint32, uint32 > &  into)
static

Definition at line 170 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToUIntUIntDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

170  {
171  DBQueryResult res;
172  if (!sDatabase.RunQuery(res, "SELECT corporationID,factionID FROM crpNPCCorporations" )) {
173  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
174  return;
175  }
176 
177  DBResultToUIntUIntDict(res, into);
178 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
void DBResultToUIntUIntDict(DBQueryResult &result, std::map< uint32, uint32 > &into)
Definition: EVEDBUtils.cpp:479

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionConstellations ( std::map< int32, PyRep * > &  into)
static

Definition at line 216 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToIntIntlistDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

216  {
217  DBQueryResult res;
218  //this is not quite right, but its good enough.
219  if (!sDatabase.RunQuery(res, "SELECT factionID,constellationID FROM mapConstellations WHERE factionID IS NOT NULL" ))
220  {
221  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
222  return;
223  }
224  DBResultToIntIntlistDict(res, into);
225 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
void DBResultToIntIntlistDict(DBQueryResult &result, std::map< int32, PyRep * > &into)
Definition: EVEDBUtils.cpp:495
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionRaces ( std::map< int32, PyRep * > &  into)
static

Definition at line 238 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToIntIntlistDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

238  {
239  DBQueryResult res;
240  //this is not quite right, but its good enough.
241  if (!sDatabase.RunQuery(res, "SELECT factionID,raceID FROM facRaces WHERE factionID IS NOT NULL"))
242  {
243  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
244  return;
245  }
246  DBResultToIntIntlistDict(res, into);
247 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
void DBResultToIntIntlistDict(DBQueryResult &result, std::map< int32, PyRep * > &into)
Definition: EVEDBUtils.cpp:495
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionRegions ( std::map< int32, PyRep * > &  into)
static

Definition at line 205 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToIntIntlistDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

205  {
206  DBQueryResult res;
207  //this is not quite right, but its good enough.
208  if (!sDatabase.RunQuery(res, "SELECT factionID,regionID FROM mapRegions WHERE factionID IS NOT NULL"))
209  {
210  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
211  return;
212  }
213  DBResultToIntIntlistDict(res, into);
214 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
void DBResultToIntIntlistDict(DBQueryResult &result, std::map< int32, PyRep * > &into)
Definition: EVEDBUtils.cpp:495
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionSolarSystems ( std::map< int32, PyRep * > &  into)
static

Definition at line 227 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToIntIntlistDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

227  {
228  DBQueryResult res;
229  //this is not quite right, but its good enough.
230  if (!sDatabase.RunQuery(res, "SELECT factionID,solarSystemID FROM mapSolarSystems WHERE factionID IS NOT NULL"))
231  {
232  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
233  return;
234  }
235  DBResultToIntIntlistDict(res, into);
236 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
void DBResultToIntIntlistDict(DBQueryResult &result, std::map< int32, PyRep * > &into)
Definition: EVEDBUtils.cpp:495
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionStationCounts ( std::map< uint32, uint32 > &  into)
static

Definition at line 180 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToUIntUIntDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

180  {
181  DBQueryResult res;
182  if (!sDatabase.RunQuery(res, "SELECT factionID, COUNT(DISTINCT staStations.stationID) FROM crpNPCCorporations"
183  " LEFT JOIN staStations USING (corporationID)"
184  " GROUP BY factionID"))
185  {
186  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
187  return;
188  }
189 
190  DBResultToUIntUIntDict(res, into);
191 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
void DBResultToUIntUIntDict(DBQueryResult &result, std::map< uint32, uint32 > &into)
Definition: EVEDBUtils.cpp:479

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadFactionSystemCounts ( std::map< uint32, uint32 > &  into)
static

Definition at line 193 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToUIntUIntDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

193  {
194  DBQueryResult res;
195  //this is not quite right, but its good enough.
196  if (!sDatabase.RunQuery(res, "SELECT factionID, COUNT(solarSystemID) FROM mapSolarSystems GROUP BY factionID"))
197  {
198  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
199  return;
200  }
201 
202  DBResultToUIntUIntDict(res, into);
203 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
void DBResultToUIntUIntDict(DBQueryResult &result, std::map< uint32, uint32 > &into)
Definition: EVEDBUtils.cpp:479

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::LoadNPCCorpFactionData ( DBQueryResult res)
static

Definition at line 86 of file ManagerDB.cpp.

References _log, DBerror::c_str(), codelog, DBQueryResult::error, DBQueryResult::GetRowCount(), and sDatabase.

Referenced by StaticDataMgr::Populate().

87 {
88  if (!sDatabase.RunQuery(res, "SELECT corporationID, factionID FROM crpNPCCorporations" ))
89  codelog(DATABASE__ERROR, "Error in LoadCorpFactionData query: %s", res.error.c_str());
90 
91  _log(DATABASE__RESULTS, "LoadCorpFactionData returned %u items", res.GetRowCount());
92 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72

Here is the call graph for this function:

Here is the caller graph for this function:

PyDict * ManagerDB::LoadNPCCorpInfo ( )
static

Definition at line 249 of file ManagerDB.cpp.

References DBerror::c_str(), codelog, DBResultToIntRowDict(), DBQueryResult::error, and sDatabase.

Referenced by StaticDataMgr::Populate().

249  {
250  DBQueryResult res;
251  if (!sDatabase.RunQuery(res,
252  "SELECT"
253  " crp.corporationName,"
254  " ncrp.corporationID,"
255  " ncrp.size, ncrp.extent, ncrp.solarSystemID,"
256  " ncrp.factionID, ncrp.sizeFactor, ncrp.stationCount, ncrp.stationSystemCount,"
257  " crp.stationID, crp.ceoID, chr.characterName AS ceoName"
258  " FROM crpNPCCorporations AS ncrp"
259  " LEFT JOIN crpCorporation AS crp ON ncrp.corporationID = crp.corporationID"
260  " LEFT JOIN chrNPCCharacters AS chr ON ceoID=chr.characterID"))
261  {
262  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
263  return nullptr;
264  }
265 
266  return DBResultToIntRowDict(res, 1);
267 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
PyDict * DBResultToIntRowDict(DBQueryResult &result, uint32 key_index, const char *type)
Definition: EVEDBUtils.cpp:257
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

Here is the caller graph for this function:

bool ManagerDB::LoadSystemRoids ( uint32  systemID,
uint32 beltID,
std::vector< AsteroidData > &  into 
)

Definition at line 508 of file ManagerDB.cpp.

References _log, AsteroidData::beltID, DBerror::c_str(), DBQueryResult::error, DBQueryResult::GetRow(), DBQueryResult::GetRowCount(), AsteroidData::itemID, AsteroidData::itemName, AsteroidData::position, AsteroidData::quantity, AsteroidData::radius, sDatabase, AsteroidData::systemID, and AsteroidData::typeID.

Referenced by BeltMgr::Load().

509 {
510  DBQueryResult res;
511  if(!sDatabase.RunQuery(res,
512  "SELECT itemID, itemName, typeID, systemID, beltID, quantity, radius, x, y, z"
513  " FROM sysAsteroids"
514  " WHERE systemID = %u"
515  " AND beltID = %u", systemID, beltID)) {
516  _log(DATABASE__ERROR, "Error in LoadSystemRoids query: %s", res.error.c_str());
517  return false;
518  }
519 
520  _log(DATABASE__RESULTS, "LoadSystemRoids returned %u items", res.GetRowCount());
521  DBResultRow row;
522  while(res.GetRow(row)) {
523  AsteroidData entry = AsteroidData();
524  entry.itemID = row.GetInt(0);
525  entry.itemName = row.GetText(1);
526  entry.typeID = row.GetInt(2);
527  entry.systemID = row.GetInt(3);
528  entry.beltID = row.GetInt(4);
529  entry.quantity = row.GetDouble(5);
530  entry.radius = row.GetDouble(6);
531  GPoint pos(row.GetDouble(7), row.GetDouble(8), row.GetDouble(9));
532  entry.position = pos;
533  into.push_back(entry);
534  }
535 
536  return !into.empty();
537 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Definition: gpoint.h:33
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69
size_t GetRowCount()
Definition: dbcore.h:72
std::string itemName

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::RemoveAsteroid ( uint32  asteroidID)

Definition at line 539 of file ManagerDB.cpp.

References sDatabase.

Referenced by BeltMgr::RemoveAsteroid().

540 {
541  DBerror err;
542  sDatabase.RunQuery(err, "DELETE FROM sysAsteroids WHERE itemID = %u", asteroidID);
543 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

Here is the caller graph for this function:

void ManagerDB::SaveActiveDungeon ( Dungeon::ActiveData dun)
static

Definition at line 676 of file ManagerDB.cpp.

References _log, DBerror::c_str(), Dungeon::ActiveData::dunExpiryTime, Dungeon::ActiveData::dunItemID, Dungeon::ActiveData::dunTemplateID, sDatabase, Dungeon::ActiveData::state, Dungeon::ActiveData::systemID, Dungeon::ActiveData::x, Dungeon::ActiveData::y, and Dungeon::ActiveData::z.

677 {
678  DBerror err;
679  if (!sDatabase.RunQuery(err,
680  "INSERT INTO dunActive" //Active Dungeons
681  " (systemID, dungeonID, state, dunTemplateID, dunExpiryTime, xpos, ypos, zpos)"
682  " VALUES "
683  "(%u, %u, %u, %u, %li, %f, %f, %f)",
684  dun.systemID, dun.dunItemID, dun.state, dun.dunTemplateID, dun.dunExpiryTime, dun.x, dun.y, dun.z ))
685  {
686  _log(DATABASE__ERROR, "SaveActiveDungeon - unable to save dungeon: %s", err.c_str());
687  }
688 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
Definition: dbcore.h:39

Here is the call graph for this function:

void ManagerDB::SaveAnomaly ( CosmicSignature sig)

Definition at line 325 of file ManagerDB.cpp.

References _log, CosmicSignature::dungeonType, CosmicSignature::position, CosmicSignature::scanAttributeID, sDatabase, CosmicSignature::sigGroupID, CosmicSignature::sigID, CosmicSignature::sigItemID, CosmicSignature::sigName, CosmicSignature::sigTypeID, CosmicSignature::systemID, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

Referenced by AnomalyMgr::SaveAnomaly().

326 {// sysSignatures (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)
327  DBerror err;
328  if (!sDatabase.RunQuery(err,
329  "INSERT INTO sysSignatures"
330  " (sigID,sigItemID,dungeonType,sigName,systemID,sigTypeID,sigGroupID,scanGroupID,scanAttributeID,x,y,z)"
331  " VALUES ('%s', %u, %u, '%s', %u, %u, %u, %u, %u, %f, %f, %f)", \
332  sig.sigID.c_str(), sig.sigItemID, sig.dungeonType, sig.sigName.c_str(), sig.systemID, sig.sigTypeID, sig.sigGroupID, \
333  sig.scanGroupID, sig.scanAttributeID, sig.position.x, sig.position.y, sig.position.z )) {
334  _log(DATABASE__ERROR, "SaveActiveDungeon - unable to save dungeon");
335  }
336 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
std::string sigID
std::string sigName
GaFloat x
Definition: GaTypes.h:207
GaFloat y
Definition: GaTypes.h:207
Definition: dbcore.h:39
GaFloat z
Definition: GaTypes.h:207

Here is the caller graph for this function:

void ManagerDB::SaveRoid ( AsteroidData data)

Definition at line 552 of file ManagerDB.cpp.

References _log, DBerror::c_str(), AsteroidData::itemID, AsteroidData::quantity, AsteroidData::radius, and sDatabase.

553 {
554  DBerror err;
555  if (!sDatabase.RunQuery(err,
556  "UPDATE sysAsteroids"
557  " SET quantity = %f,"
558  " radius = %f"
559  " WHERE itemID = %u",
560  data.quantity, data.radius, data.itemID))
561  {
562  _log(DATABASE__ERROR, "SaveSystemRoids - unable to save roids - %s", err.c_str());
563  }
564 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
Definition: dbcore.h:39

Here is the call graph for this function:

void ManagerDB::SaveStatisticData ( StatisticData data)
static

Definition at line 723 of file ManagerDB.cpp.

References _log, DBerror::c_str(), GetFileTimeNow(), StatisticData::iskMarket, StatisticData::npcBounties, StatisticData::oreMined, StatisticData::pcBounties, StatisticData::pcMissiles, StatisticData::pcShots, StatisticData::probesLaunched, StatisticData::ramJobs, sDatabase, StatisticData::shipsSalvaged, StatisticData::sitesScanned, and StatisticData::span.

Referenced by StatisticMgr::SaveData().

724 {
725  DBerror err;
726  if (!sDatabase.RunQuery(err,
727  "INSERT INTO srvStatisticData"
728  " (timeStamp, timeSpan, pcShots, pcMissiles, ramJobs, shipsSalvaged, pcBounties, npcBounties, oreMined, iskMarket, probesLaunched, sitesScanned)"
729  " VALUES "
730  "(%f, %u, %u, %u, %u, %u, %f, %f, %f, %f, %u, %u)", GetFileTimeNow(),
731  data.span, data.pcShots, data.pcMissiles, data.ramJobs, data.shipsSalvaged, data.pcBounties, data.npcBounties, data.oreMined, data.iskMarket, data.probesLaunched, data.sitesScanned ))
732  {
733  _log(DATABASE__ERROR, "SaveStatisticData - unable to save data: %s", err.c_str());
734  }
735 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 shipsSalvaged
const char * c_str() const
Definition: dbcore.h:48
uint16 probesLaunched
double GetFileTimeNow()
Definition: utils_time.cpp:84
Definition: dbcore.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::SaveSystemRoids ( uint32  systemID,
std::vector< AsteroidData > &  roids 
)

Definition at line 566 of file ManagerDB.cpp.

References _log, DBerror::c_str(), and sDatabase.

Referenced by BeltMgr::Save().

567 {
568  std::ostringstream Inserts;
569  // start the insert into command.
570  Inserts << "INSERT INTO sysAsteroids";
571  Inserts << " (itemID,itemName,typeID,systemID,beltID,quantity,radius,x, y, z)";
572  bool first = true;
573  for (auto cur : roids) {
574  if (first) {
575  Inserts << " VALUES ";
576  first = false;
577  } else {
578  Inserts << ", ";
579  }
580  // itemID and attributeID keys.
581  Inserts << "(" << cur.itemID << ", '" << cur.itemName << "', " << cur.typeID << ", " << systemID << ", " << cur.beltID << ", ";
582  Inserts << cur.quantity << ", " << cur.radius << ", " << std::to_string(cur.position.x) << ", " << std::to_string(cur.position.y);
583  Inserts << ", " << std::to_string(cur.position.z) << ")";
584  }
585  // did we get at least 1 insert?
586  if (!first) {
587  // finish creating the command.
588  Inserts << "ON DUPLICATE KEY UPDATE ";
589  Inserts << "quantity=VALUES(quantity), ";
590  Inserts << "radius=VALUES(radius)";
591  // execute the command.
592  DBerror err;
593  if (!sDatabase.RunQuery(err, Inserts.str().c_str()))
594  _log(DATABASE__ERROR, "SaveSystemRoids - unable to save roids - %s", err.c_str());
595  }
596 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
Definition: dbcore.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

void ManagerDB::UpdateStatisticHistory ( StatisticData data)
static

Definition at line 737 of file ManagerDB.cpp.

References _log, DBerror::c_str(), StatisticData::iskMarket, StatisticData::npcBounties, StatisticData::oreMined, StatisticData::pcBounties, StatisticData::pcMissiles, StatisticData::pcShots, StatisticData::probesLaunched, StatisticData::ramJobs, sDatabase, StatisticData::shipsSalvaged, and StatisticData::sitesScanned.

Referenced by StatisticMgr::CompileData(), and StatisticMgr::Initialize().

738 {
739  DBerror err;
740  if (!sDatabase.RunQuery(err,
741  "UPDATE srvStatisticHistory"
742  " SET pcShots=%u, pcMissiles=%u, ramJobs=%u, shipsSalvaged=%u, pcBounties=%f, npcBounties=%f, oreMined=%f, iskMarket=%f, probesLaunched=%u, sitesScanned=%u"
743  " WHERE idx = 1",
744  data.pcShots, data.pcMissiles, data.ramJobs, data.shipsSalvaged, data.pcBounties, data.npcBounties,
745  data.oreMined, data.iskMarket, data.probesLaunched, data.sitesScanned ))
746  {
747  _log(DATABASE__ERROR, "srvStatisticHistory - unable to save data: %s", err.c_str());
748  }
749 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 shipsSalvaged
const char * c_str() const
Definition: dbcore.h:48
uint16 probesLaunched
Definition: dbcore.h:39

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: