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

#include "ConfigDB.h"

Inheritance diagram for ConfigDB:
Collaboration diagram for ConfigDB:

Public Member Functions

PyRep * GetMultiOwnersEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiLocationsEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiStationEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiAllianceShortNamesEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiCorpTickerNamesEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiGraphicsEx (const std::vector< int32 > &entityIDs)
 
PyRep * GetMultiInvTypesEx (const std::vector< int32 > &typeIDs)
 
PyObject * GetUnits ()
 
PyObjectEx * GetMapObjects (uint32 entityID, bool wantRegions, bool wantConstellations, bool wantSystems, bool wantStations)
 
PyObject * GetMap (uint32 solarSystemID)
 
PyObject * GetMapOffices (uint32)
 
PyObject * GetMapConnections (uint32, bool, bool, bool, uint16, uint16)
 
PyObject * ListLanguages ()
 
PyRep * GetStationSolarSystemsByOwner (uint32 ownerID)
 
PyRep * GetCelestialStatistic (uint32 celestialID)
 
PyRep * GetTextsForGroup (const std::string &langID, uint32 textgroup)
 
PyObject * GetMapLandmarks ()
 
PyRep * GetDynamicCelestials (uint32 solarSystemID)
 Retrieves dynamic, celestial objects for a given solar system. More...
 
- Public Member Functions inherited from ServiceDB
uint32 GetStationOwner (uint32 stationID)
 

Additional Inherited Members

- Static Public Member Functions inherited from ServiceDB
static bool GetAccountInformation (CryptoChallengePacket &ccp, AccountData &aData, std::string &failMsg)
 
static bool UpdateAccountHash (const char *username, std::string &hash)
 
static bool IncrementLoginCount (uint32 accountID)
 
static void UpdatePassword (uint32 accountID, const char *pass)
 
static void SaveKillOrLoss (CharKillData &data)
 
static bool GetConstant (const char *name, uint32 &into)
 
static void SetServerOnlineStatus (bool online=false)
 
static void SetCharacterOnlineStatus (uint32 char_id, bool online=false)
 
static void SetAccountOnlineStatus (uint32 accountID, bool online=false)
 
static void SetAccountBanStatus (uint32 accountID, bool banned=false)
 
static void SaveServerStats (double threads, float rss, float vm, float user, float kernel, uint32 items, uint32 bubbles)
 
static uint32 SetClientSeed ()
 
static PyRep * LookupChars (const char *match, bool exact=false)
 
static PyRep * LookupOwners (const char *match, bool exact=false)
 
static PyRep * LookupCorporations (const std::string &)
 
static PyRep * LookupFactions (const std::string &)
 
static PyRep * LookupCorporationTickers (const std::string &)
 
static PyRep * LookupStations (const std::string &)
 
static PyRep * LookupKnownLocationsByGroup (const std::string &, uint32)
 
static PyRep * PrimeOwners (std::vector< int32 > &itemIDs)
 
static bool ValidateAccountName (CryptoChallengePacket &ccp, std::string &failMsg)
 
static void GetCorpHangarNames (uint32 corpID, std::map< uint8, std::string > &hangarNames)
 
- Protected Member Functions inherited from ServiceDB
void ProcessStringChange (const char *key, const std::string &oldValue, std::string newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessRealChange (const char *key, double oldValue, double newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessIntChange (const char *key, uint32 oldValue, uint32 newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
void ProcessLongChange (const char *key, int64 oldValue, int64 newValue, PyDict *notif, std::vector< std::string > &dbQ)
 
- Static Protected Member Functions inherited from ServiceDB
static uint32 CreateNewAccount (const char *login, const char *pass, const char *passHash, int64 role)
 

Detailed Description

Definition at line 36 of file ConfigDB.h.

Member Function Documentation

PyRep * ConfigDB::GetCelestialStatistic ( uint32  celestialID)

Definition at line 415 of file ConfigDB.cpp.

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

415  {
416  // corrected db query -allan 8Dec14
417  DBQueryResult res;
418  if (!sDatabase.RunQuery(res,
419  "SELECT"
420  " celestialID,"
421  " temperature,"
422  " spectralClass,"
423  " luminosity,"
424  " age,"
425  " life,"
426  " orbitRadius,"
427  " eccentricity,"
428  " massDust,"
429  " massGas,"
430  " fragmented,"
431  " density,"
432  " surfaceGravity,"
433  " escapeVelocity,"
434  " orbitPeriod,"
435  " rotationRate,"
436  " locked,"
437  " pressure,"
438  " radius,"
439  " mass"
440  " FROM mapCelestialStatistics"
441  " WHERE celestialID = %u", celestialID))
442  {
443  codelog(DATABASE__ERROR, "Error in GetCelestialStatistic query: %s", res.error.c_str());
444  return new PyInt(0);
445  }
446 
447  return DBResultToCRowset(res);
448 }
#define sDatabase
Definition: dbcore.h:199
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
Python integer.
Definition: PyRep.h:231
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * ConfigDB::GetDynamicCelestials ( uint32  solarSystemID)

Retrieves dynamic, celestial objects for a given solar system.

Parameters
[in]solarSystemIDID of the solar system whose objects are being retrieved
Author
allan

Definition at line 450 of file ConfigDB.cpp.

References DBerror::c_str(), codelog, DBResultToCRowset(), DBQueryResult::error, maxNPCStation, sDatabase, and EVEDB::invGroups::Station.

450  {
451  // corrected query and return type per packet info
452  // this returns ONLY OUTPOSTS. -allan 8Dec14
453  /* this packet is from a crowded (73 items) system (including pos'), yet is only return from this call.
454  [PyObjectEx Type2]
455  [PyTuple 2 items]
456  [PyTuple 1 items]
457  [PyToken dbutil.CRowset]
458  [PyDict 1 kvp]
459  [PyString "header"]
460  [PyPackedRow 50 bytes]
461  ["groupID" => <15> [I2]]
462  ["typeID" => <21645> [I4]] <-- Gallente Administrative Outpost
463  ["itemID" => <61000562> [I4]]
464  ["itemName" => <5E-EZC VI - X333 GEORGIOU'S PLACE> [WStr]]
465  ["locationID" => <30004168> [I4]]
466  ["orbitID" => <40264214> [I4]]
467  ["connector" => <0> [I4]]
468  ["x" => <-435188244480> [R8]]
469  ["y" => <27742740480> [R8]]
470  ["z" => <430524948480> [R8]]
471  ["celestialIndex" => <6> [UI1]]
472  ["orbitIndex" => <0> [UI1]]
473  */
474 
475  DBQueryResult result;
476  if (!sDatabase.RunQuery(result,
477  "SELECT"
478  " groupID,"
479  " typeID,"
480  " itemID,"
481  " itemName,"
482  " solarSystemID AS locationID,"
483  " IFNULL(orbitID, 0) AS orbitID,"
484  " 0 AS connector," //this is connector field....have only seen 0 in server packets.
485  " x, y, z,"
486  " celestialIndex," // this index denotes which planet this item orbits (PLANET #....NOT moon #)
487  " orbitIndex" // this index denotes which asteroid belt this item belongs to
488  " FROM mapDenormalize"
489  " WHERE solarSystemID = %u"
490  " AND groupID = %d"
491  " AND itemID > %d", //this is min itemid for outposts (pos' do NOT go here)
492  solarSystemID, EVEDB::invGroups::Station, maxNPCStation )) {
493  codelog(DATABASE__ERROR, "Error in GetDynamicCelestials query: %s", result.error.c_str());
494  return new PyInt(0);
495  }
496 
497  return DBResultToCRowset(result);
498 }
#define sDatabase
Definition: dbcore.h:199
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
Python integer.
Definition: PyRep.h:231
#define maxNPCStation
Definition: EVE_Defines.h:126
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyObject * ConfigDB::GetMap ( uint32  solarSystemID)

Definition at line 344 of file ConfigDB.cpp.

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

344  {
345  DBQueryResult res;
346  if (!sDatabase.RunQuery(res,
347  "SELECT "
348  " s.solarSystemID AS locationID,"
349  " s.xMin, s.xMax, s.yMin,"
350  " s.yMax, s.zMin, s.zMax,"
351  " s.luminosity,"
352  " d.x, d.y, d.z,"
353  " d.itemID,"
354  " d.itemName,"
355  " d.typeID,"
356  " d.orbitID,"
357  " j.celestialID AS destinations"
358  " FROM mapSolarSystems AS s"
359  " LEFT JOIN mapDenormalize AS d USING (solarSystemID)"
360  " LEFT JOIN mapJumps AS j ON j.stargateID = d.itemID"
361  " WHERE solarSystemID=%u", solarSystemID
362  )) {
363  codelog(DATABASE__ERROR, "Error in GetMap query: %s", res.error.c_str());
364  return nullptr;
365  }
366 
367  return DBResultToRowset(res);
368 }
#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:

PyObject * ConfigDB::GetMapConnections ( uint32  id,
bool  sol,
bool  reg,
bool  con,
uint16  cel,
uint16  _c 
)
Todo:
more map data in /eve/client/script/ui/shared/maps/mapcommon.py

Definition at line 521 of file ConfigDB.cpp.

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

521  {
522  sLog.Warning ("ConfigDB::GetMapConnections", "DB query - System:%u, Sol:%u, Reg:%u, Con:%u, Cel:%u, cached:%u", id, sol, reg, con, cel, _c);
523  const char *key = "fromsol";
524  if (sol) {
525  key = "fromsol";
526  } else if (reg) {
527  key = "fromreg";
528  } else if (con) {
529  key = "fromcon";
530  } else {
531  sLog.Error ("ConfigDB::GetMapConnections()", "Bad argument (id: %u, sol: %u, reg: %u, con: %u) passed to key.", id, sol, reg, con );
532  }
533 
534  DBQueryResult res;
535  if (!sDatabase.RunQuery(res,
536  "SELECT ctype, fromreg, fromcon, fromsol, stargateID, celestialID, tosol, tocon, toreg"
537  " FROM mapConnections"
538  " WHERE %s = %u", key, id )) {
539  codelog(DATABASE__ERROR, "Error in GetMapConnections query: %s", res.error.c_str());
540  sLog.Error ("ConfigDB::GetMapConnections()", "No Data for key: %s, id: %u.", key, id);
541  return nullptr;
542  }
543  return DBResultToRowset(res);
544 }
#define sDatabase
Definition: dbcore.h:199
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
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
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr

Here is the call graph for this function:

PyObject * ConfigDB::GetMapLandmarks ( )

Definition at line 546 of file ConfigDB.cpp.

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

546  { // working 29June14
547  DBQueryResult res;
548 
549  if (!sDatabase.RunQuery(res,
550  "SELECT"
551  " landmarkID,"
552  " landmarkName,"
553  " 0 AS landmarkNameID,"
554  " x, y, z,"
555  " radius"
556  " FROM mapLandmarks" ))
557  {
558  codelog(DATABASE__ERROR, "Error in GetMapLandmarks query: %s", res.error.c_str());
559  return nullptr;
560  }
561  return DBResultToRowset(res);
562 }
#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:

PyObjectEx * ConfigDB::GetMapObjects ( uint32  entityID,
bool  wantRegions,
bool  wantConstellations,
bool  wantSystems,
bool  wantStations 
)

Definition at line 314 of file ConfigDB.cpp.

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

316 { // corrected query -allan 8Dec14
317  const char *key = "solarSystemID";
318  if (wantRegions) {
319  entityID = 3; /* a little hackish... */
320  key = "typeID";
321  } else if (wantConstellations) {
322  key = "regionID";
323  } else if (wantSystems) {
324  key = "constellationID";
325  } else if (wantStations) {
326  key = "solarSystemID";
327  }
328 
329  DBQueryResult res;
330  if (!sDatabase.RunQuery(res,
331  "SELECT "
332  " groupID, typeID, itemID, itemName,"
333  " solarSystemID AS locationID, IFNULL(orbitID, 0) AS orbitID,"
334  " x, y, z"
335  " FROM mapDenormalize"
336  " WHERE %s=%u", key, entityID )) {
337  codelog(DATABASE__ERROR, "Error in GetMapObjects query: %s", res.error.c_str());
338  return nullptr;
339  }
340 
341  return DBResultToCRowset(res);
342 }
#define sDatabase
Definition: dbcore.h:199
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
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr

Here is the call graph for this function:

PyObject * ConfigDB::GetMapOffices ( uint32  solarSystemID)

Definition at line 510 of file ConfigDB.cpp.

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

510  {
511  DBQueryResult res;
512  if (!sDatabase.RunQuery(res, "SELECT corporationID, stationID FROM staStations WHERE solarSystemID=%u", solarSystemID)) {
513  codelog(DATABASE__ERROR, "Error in GetMapOffices query: %s", res.error.c_str());
514  return nullptr;
515  }
516 
517  return DBResultToRowset(res);
518 }
#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:

PyRep * ConfigDB::GetMultiAllianceShortNamesEx ( const std::vector< int32 > &  entityIDs)

Definition at line 165 of file ConfigDB.cpp.

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

165  {
166  std::string ids;
167  ListToINString(entityIDs, ids);
168  DBQueryResult res;
169  if (!sDatabase.RunQuery(res, "SELECT allianceID, shortName FROM alnAlliance WHERE allianceID IN (%s)", ids.c_str() )) {
170  codelog(DATABASE__ERROR, "Error in GetMultiAllianceShortNamesEx query: %s", res.error.c_str());
171  return new PyInt(0);
172  }
173 
174  return DBResultToTupleSet(res);
175 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
Python integer.
Definition: PyRep.h:231
PyTuple * DBResultToTupleSet(DBQueryResult &result)
Definition: EVEDBUtils.cpp:116
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiCorpTickerNamesEx ( const std::vector< int32 > &  entityIDs)

Definition at line 262 of file ConfigDB.cpp.

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

263 {
264  std::string ids;
265  ListToINString(entityIDs, ids);
266  DBQueryResult res;
267  if (!sDatabase.RunQuery(res,
268  "SELECT "
269  " corporationID, tickerName,"
270  " shape1, shape2, shape3,"
271  " color1, color2, color3 "
272  " FROM crpCorporation"
273  " WHERE corporationID in (%s)", ids.c_str()))
274  {
275  codelog(DATABASE__ERROR, "Error in GetMultiCorpTickerNamesEx query: %s", res.error.c_str());
276  return new PyInt(0);
277  }
278 
279  return DBResultToRowList(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
Python integer.
Definition: PyRep.h:231
PyTuple * DBResultToRowList(DBQueryResult &result, const char *type)
Definition: EVEDBUtils.cpp:231
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiGraphicsEx ( const std::vector< int32 > &  entityIDs)

Definition at line 283 of file ConfigDB.cpp.

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

283  {
284 
285  std::string ids;
286  ListToINString(entityIDs, ids);
287 
288  DBQueryResult res;
289 
290  if (!sDatabase.RunQuery(res,
291  "SELECT"
292  " graphicID, url3D, urlWeb, icon, urlSound, explosionID"
293  " FROM eveGraphics "
294  " WHERE graphicID in (%s)", ids.c_str()))
295  {
296  codelog(DATABASE__ERROR, "Error in GetMultiGraphicsEx query: %s", res.error.c_str());
297  return new PyInt(0);
298  }
299 
300  return DBResultToRowList(res);
301 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
Python integer.
Definition: PyRep.h:231
PyTuple * DBResultToRowList(DBQueryResult &result, const char *type)
Definition: EVEDBUtils.cpp:231
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiInvTypesEx ( const std::vector< int32 > &  typeIDs)

Definition at line 381 of file ConfigDB.cpp.

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

381  {
382  std::string ids;
383  ListToINString(entityIDs, ids);
384  DBQueryResult res;
385  if (!sDatabase.RunQuery(res,
386  "SELECT"
387  " typeID,groupID,typeName,description,graphicID,radius,"
388  " mass,volume,capacity,portionSize,raceID,basePrice,"
389  " published,marketGroupID,chanceOfDuplicating "
390  " FROM invTypes "
391  " WHERE typeID in (%s)", ids.c_str()))
392  {
393  codelog(DATABASE__ERROR, "Error in GetMultiInvTypesEx query: %s", res.error.c_str());
394  return new PyInt(0);
395  }
396 
397  return DBResultToRowList(res);
398 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
Python integer.
Definition: PyRep.h:231
PyTuple * DBResultToRowList(DBQueryResult &result, const char *type)
Definition: EVEDBUtils.cpp:231
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiLocationsEx ( const std::vector< int32 > &  entityIDs)

Definition at line 177 of file ConfigDB.cpp.

References DBerror::c_str(), codelog, DBResultToTupleSet(), DBQueryResult::error, IsAsteroidID, IsStaticItem, ListToINString(), sDatabase, and sLog.

177  {
178  // this is locations only....region, const, system, station, ship
179  // wtf are asteroids seen in this call???
180  std::vector<int32> staticItems, dynamicItems, asteroidItems;
181  staticItems.clear();
182  dynamicItems.clear();
183  asteroidItems.clear();
184 
185  for (auto cur : entityIDs) {
186  if (IsStaticItem(cur)) {
187  staticItems.push_back(cur);
188  } else if (IsAsteroidID(cur)) {
189  asteroidItems.push_back(cur);
190  } else {
191  dynamicItems.push_back(cur);
192  }
193  }
194 
195  DBQueryResult res;
196  std::string ids = "";
197 
198  if (staticItems.size()) {
199  ListToINString(staticItems, ids);
200  if (!sDatabase.RunQuery(res,
201  "SELECT "
202  " itemID AS locationID,"
203  " itemName AS locationName,"
204  " x, y, z,"
205  " itemNameID AS locationNameID" //locationName = localization.GetByMessageID(self.locationNameID)
206  " FROM mapDenormalize"
207  " WHERE itemID in (%s)", ids.c_str()))
208  {
209  codelog(DATABASE__ERROR, "Error in GetMultiLocationsEx query: %s", res.error.c_str());
210  }
211  ids = "";
212  }
213 
214  if (dynamicItems.size()) {
215  ListToINString(dynamicItems, ids);
216  if (!sDatabase.RunQuery(res,
217  "SELECT "
218  " itemID AS locationID,"
219  " itemName AS locationName,"
220  " x, y, z,"
221  " NULL AS locationNameID"
222  " FROM entity"
223  " WHERE itemID in (%s)", ids.c_str()))
224  {
225  codelog(DATABASE__ERROR, "Error in GetMultiLocationsEx query: %s", res.error.c_str());
226  }
227  ids = "";
228  }
229 
230  if (asteroidItems.size()) {
231  ListToINString(asteroidItems, ids);
232  sLog.Warning("GetMultiLocationsEx", "Asteroid Items (%s) requested.", ids.c_str());
233  if (!sDatabase.RunQuery(res,
234  "SELECT "
235  " itemID AS locationID,"
236  " itemName AS locationName,"
237  " x, y, z,"
238  " NULL AS locationNameID"
239  " FROM sysAsteroids"
240  " WHERE itemID in (%s)", ids.c_str()))
241  {
242  codelog(DATABASE__ERROR, "Error in GetMultiLocationsEx query: %s", res.error.c_str());
243  }
244  }
245 
246  return DBResultToTupleSet(res);
247 }
#define IsStaticItem(itemID)
Definition: EVE_Defines.h:266
#define sDatabase
Definition: dbcore.h:199
#define IsAsteroidID(itemID)
Definition: EVE_Defines.h:259
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyTuple * DBResultToTupleSet(DBQueryResult &result)
Definition: EVEDBUtils.cpp:116
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiOwnersEx ( const std::vector< int32 > &  entityIDs)

Definition at line 31 of file ConfigDB.cpp.

References DBerror::c_str(), codelog, LSC::corp, DBResultToTupleSet(), DBQueryResult::error, IsAlliance, IsCharacterID, IsCorp, IsStationID, ListToINString(), Profile::npc, and sDatabase.

31  {
32  // separate list of ids into respective groups
33  std::vector<int32> player, corp, ally, owner, npc, station;
34  player.clear();
35  corp.clear();
36  ally.clear();
37  owner.clear();
38  npc.clear();
39  station.clear();
40 
41  for (auto cur : entityIDs) {
42  if (IsCorp(cur)) {
43  corp.push_back(cur);
44  } else if (IsAlliance(cur)) {
45  ally.push_back(cur);
46  } else if (IsCharacterID(cur)) {
47  player.push_back(cur);
48  } else if (cur < 33000) {
49  npc.push_back(cur);
50  } else if (IsStationID(cur)) {
51  station.push_back(cur);
52  } else {
53  owner.push_back(cur);
54  }
55 
56  // add check here for trader joe.
57  // will have to hardcode data, then run thru db query cause i dont know how to build packet for this return
58  }
59 
60  DBQueryResult res;
61  std::string ids = "";
62 
63  if (corp.size()) {
64  ListToINString(corp, ids);
65  if (!sDatabase.RunQuery(res,
66  "SELECT "
67  " corporationID AS ownerID,"
68  " corporationName AS ownerName,"
69  " 2 AS typeID," // corp typeID
70  " false AS gender,"
71  " NULL AS ownerNameID" // this is a messageID - have not taken time to find and insert
72  " FROM crpCorporation"
73  " WHERE corporationID IN (%s)", ids.c_str()))
74  {
75  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
76  }
77  ids = "";
78  }
79 
80  if (ally.size()) {
81  ListToINString(ally, ids);
82  if (!sDatabase.RunQuery(res,
83  "SELECT "
84  " allianceID AS ownerID,"
85  " allianceName AS ownerName,"
86  " 16159 AS typeID," // alliance typeID.
87  " false AS gender,"
88  " NULL AS ownerNameID"
89  " FROM alnAlliance"
90  " WHERE allianceID IN (%s)", ids.c_str()))
91  {
92  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
93  }
94  ids = "";
95  }
96 
97  if (player.size()) {
98  ListToINString(player, ids);
99  if (!sDatabase.RunQuery(res,
100  "SELECT "
101  " characterID AS ownerID,"
102  " characterName AS ownerName,"
103  " typeID,"
104  " gender,"
105  " NULL AS ownerNameID"
106  " FROM chrCharacters"
107  " WHERE characterID IN (%s)", ids.c_str()))
108  {
109  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
110  }
111  ids = "";
112  }
113 
114  if (npc.size()) {
115  ListToINString(npc, ids);
116  if (!sDatabase.RunQuery(res,
117  "SELECT "
118  " typeID AS ownerID,"
119  " typeName AS ownerName,"
120  " typeID,"
121  " 1 AS gender,"
122  " typeNameID AS ownerNameID"
123  " FROM invTypes"
124  " WHERE typeID IN (%s)", ids.c_str()))
125  {
126  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
127  }
128  ids = "";
129  }
130 
131  if (station.size()) {
132  ListToINString(station, ids);
133  if (!sDatabase.RunQuery(res,
134  "SELECT "
135  " corporationID AS ownerID,"
136  " corporationName AS ownerName,"
137  " 2 AS typeID" // corp typeID
138  " FROM crpCorporation"
139  " WHERE corporationID IN (SELECT corporationID FROM staStations WHERE stationID IN (%s))", ids.c_str()))
140  {
141  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
142  }
143  ids = "";
144  }
145 
146  if (owner.size()) {
147  ListToINString(owner, ids);
148  if (!sDatabase.RunQuery(res,
149  "SELECT "
150  " ownerID,"
151  " ownerName,"
152  " typeID,"
153  " true AS gender,"
154  " NULL AS ownerNameID"
155  " FROM eveStaticOwners"
156  " WHERE ownerID IN (%s)", ids.c_str()))
157  {
158  codelog(DATABASE__ERROR, "Error in query: %s", res.error.c_str());
159  }
160  }
161 
162  return DBResultToTupleSet(res);
163 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyTuple * DBResultToTupleSet(DBQueryResult &result)
Definition: EVEDBUtils.cpp:116
#define IsCharacterID(itemID)
Definition: EVE_Defines.h:206
#define IsCorp(itemID)
Definition: EVE_Defines.h:234
#define IsStationID(itemID)
Definition: EVE_Defines.h:294
DBerror error
Definition: dbcore.h:69
#define IsAlliance(itemID)
Definition: EVE_Defines.h:244
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetMultiStationEx ( const std::vector< int32 > &  entityIDs)

Definition at line 249 of file ConfigDB.cpp.

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

250 {
251  std::string ids;
252  ListToINString(entityIDs, ids);
253  DBQueryResult res;
254  if (!sDatabase.RunQuery(res, "SELECT stationID, stationName, stationTypeID, solarSystemID, x, y, z FROM staStations WHERE stationID in (%s)", ids.c_str())) {
255  codelog(DATABASE__ERROR, "Error in GetMultiStationEx query: %s", res.error.c_str());
256  }
257 
258  return DBResultToTupleSet(res);
259 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyTuple * DBResultToTupleSet(DBQueryResult &result)
Definition: EVEDBUtils.cpp:116
DBerror error
Definition: dbcore.h:69
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty)

Here is the call graph for this function:

PyRep * ConfigDB::GetStationSolarSystemsByOwner ( uint32  ownerID)

Definition at line 400 of file ConfigDB.cpp.

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

400  {
401  DBQueryResult res;
402  if (!sDatabase.RunQuery(res,
403  " SELECT "
404  " stationID, solarSystemID "
405  " FROM staStations "
406  " WHERE corporationID = %u ", ownerID))
407  {
408  codelog(DATABASE__ERROR, "Error in GetStationSolarSystemsByOwner query: %s", res.error.c_str());
409  return nullptr;
410  }
411 
412  return DBResultToRowset(res);
413 }
#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:

PyRep * ConfigDB::GetTextsForGroup ( const std::string &  langID,
uint32  textgroup 
)

Definition at line 500 of file ConfigDB.cpp.

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

500  {
501  DBQueryResult res;
502  if (!sDatabase.RunQuery(res, "SELECT textLabel, `text` FROM intro WHERE langID = '%s' AND textgroup = %u", langID.c_str(), textgroup)) {
503  codelog(DATABASE__ERROR, "Error in GetTextsForGroup query: %s", res.error.c_str());
504  return new PyInt(0);
505  }
506 
507  return DBResultToRowset(res);
508 }
#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
Python integer.
Definition: PyRep.h:231
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyObject * ConfigDB::GetUnits ( )

Definition at line 303 of file ConfigDB.cpp.

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

304 {
305  DBQueryResult res;
306  if (!sDatabase.RunQuery(res, "SELECT unitID, unitName, displayName FROM eveUnits")) {
307  codelog(DATABASE__ERROR, "Error in GetUnits query: %s", res.error.c_str());
308  return nullptr;
309  }
310 
311  return DBResultToIndexRowset(res, "unitID");
312 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
PyObject * DBResultToIndexRowset(DBQueryResult &result, const char *key)
Definition: EVEDBUtils.cpp:144
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyObject * ConfigDB::ListLanguages ( )

Definition at line 370 of file ConfigDB.cpp.

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

370  {
371  DBQueryResult res;
372  if (!sDatabase.RunQuery(res, "SELECT languageID,languageName,translatedLanguageName FROM languages")) {
373  codelog(DATABASE__ERROR, "Error in ListLanguages query: %s", res.error.c_str());
374  return nullptr;
375  }
376 
377  return DBResultToRowset(res);
378 }
#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:


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