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

#include "FactoryDB.h"

Inheritance diagram for FactoryDB:
Collaboration diagram for FactoryDB:

Static Public Member Functions

FactoryDB.cpp

db query methods for R.A.M. activities

: Allan

Date
: 9Jan18 UD 5Nov20
static PyRepGetJobs2 (const int32 ownerID, const bool completed)
 
static PyRepAssemblyLinesSelectPublic (const uint32 regionID)
 
static PyRepAssemblyLinesSelectPersonal (const uint32 charID)
 
static PyRepAssemblyLinesSelectPrivate (const uint32 charID)
 
static PyRepAssemblyLinesSelectCorporation (const uint32 corporationID)
 
static PyRepAssemblyLinesSelectAlliance (const int32 allianceID)
 
static PyRepAssemblyLinesGet (const uint32 containerID)
 
static PyRepGetMaterialCompositionOfItemType (const uint32 typeID)
 
static bool IsRefinable (const uint16 typeID)
 
static bool IsRecyclable (const uint16 typeID)
 
static void GetSalvage (DBQueryResult &res)
 
static void GetMinerals (DBQueryResult &res)
 
static void GetCompounds (DBQueryResult &res)
 
static void GetResources (DBQueryResult &res)
 
static void GetComponents (DBQueryResult &res)
 
static void GetCommodities (DBQueryResult &res)
 
static void GetMiscCommodities (DBQueryResult &res)
 
static void GetRAMMaterials (DBQueryResult &res)
 
static void GetBlueprintType (DBQueryResult &res)
 
static void GetRAMRequirements (DBQueryResult &res)
 
static bool GetAssemblyLineProperties (const uint32 assemblyLineID, Character *pChar, Rsp_InstallJob &into, bool isCorpJob=false)
 
static bool GetAssemblyLineRestrictions (const int32 assemblyLineID, EvERam::LineRestrictions &data)
 
static uint32 InstallJob (const uint32 ownerID, const uint32 installerID, Call_InstallJob &args, const int64 beginTime, const int64 endTime, const uint32 systemID)
 
static bool GetJobProperties (const uint32 jobID, EvERam::JobProperties &data)
 
static bool CompleteJob (const uint32 jobID, const int8 completedStatus)
 
static bool DeleteBlueprint (uint32 blueprintID)
 
static bool GetBlueprint (uint32 blueprintID, EvERam::bpData &into)
 
static bool SaveBlueprintData (uint32 blueprintID, EvERam::bpData &data)
 
static bool IsProducableBy (const uint32 assemblyLineID, const ItemType *pType)
 
static bool GetMultipliers (const uint32 assemblyLineID, const ItemType *pType, Rsp_InstallJob &into)
 
static uint32 CountManufacturingJobs (const uint32 installerID)
 
static uint32 CountResearchJobs (const uint32 installerID)
 
static uint32 GetTech2Blueprint (const uint32 blueprintTypeID)
 
static int64 GetNextFreeTime (const uint32 assemblyLineID)
 
static void SetJobEventID (const uint32 jobID, const uint32 eventID)
 
- 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 PyRepLookupChars (const char *match, bool exact=false)
 
static PyRepLookupOwners (const char *match, bool exact=false)
 
static PyRepLookupCorporations (const std::string &)
 
static PyRepLookupFactions (const std::string &)
 
static PyRepLookupCorporationTickers (const std::string &)
 
static PyRepLookupStations (const std::string &)
 
static PyRepLookupKnownLocationsByGroup (const std::string &, uint32)
 
static PyRepPrimeOwners (std::vector< int32 > &itemIDs)
 
static bool ValidateAccountName (CryptoChallengePacket &ccp, std::string &failMsg)
 
static void GetCorpHangarNames (uint32 corpID, std::map< uint8, std::string > &hangarNames)
 

Additional Inherited Members

- Public Member Functions inherited from ServiceDB
uint32 GetStationOwner (uint32 stationID)
 
- 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 21 of file FactoryDB.h.

Member Function Documentation

PyRep * FactoryDB::AssemblyLinesGet ( const uint32  containerID)
static
Todo:
need to add check/query for POS assembly modules here

Definition at line 370 of file FactoryDB.cpp.

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

370  {
371  DBQueryResult res;
372 
373  if (!sDatabase.RunQuery(res,
374  "SELECT"
375  " assemblyLineID,"
376  " assemblyLineTypeID,"
377  " containerID,"
378  " nextFreeTime,"
379  " costInstall,"
380  " costPerHour,"
381  " restrictionMask,"
382  " discountPerGoodStandingPoint,"
383  " surchargePerBadStandingPoint,"
384  " minimumStanding,"
385  " minimumCharSecurity,"
386  " minimumCorpSecurity,"
387  " maximumCharSecurity,"
388  " maximumCorpSecurity"
389  " FROM ramAssemblyLines"
390  " WHERE containerID = %u",
391  containerID)) {
392  _log(DATABASE__ERROR, "Failed to query assembly lines for container %u: %s.", containerID, res.error.c_str());
393  return nullptr;
394  }
395 
396  return DBResultToCRowset(res);
397 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::AssemblyLinesSelectAlliance ( const int32  allianceID)
static
Todo:
need to add check/query for POS assembly modules here

Definition at line 344 of file FactoryDB.cpp.

References _log, EvERam::RestrictionMask::ByAlliance, DBerror::c_str(), DBResultToCRowset(), DBQueryResult::error, and sDatabase.

344  {
345  DBQueryResult res;
346 
347  if (!sDatabase.RunQuery(res,
348  "SELECT"
349  " station.stationID AS containerID,"
350  " station.stationTypeID AS containerTypeID,"
351  " station.solarSystemID AS containerLocationID,"
352  " station.assemblyLineTypeID,"
353  " station.quantity,"
354  " station.ownerID"
355  " FROM ramAssemblyLineStations AS station"
356  " LEFT JOIN crpCorporation AS crp ON station.ownerID = crp.corporationID"
357  " LEFT JOIN ramAssemblyLines AS line ON station.stationID = line.containerID AND station.assemblyLineTypeID = line.assemblyLineTypeID AND station.ownerID = line.ownerID"
358  " WHERE crp.allianceID = %u"
359  " AND (line.restrictionMask & %u) = %u",
361  {
362  _log(DATABASE__ERROR, "Failed to query alliance assembly lines for alliance %u: %s.", allianceID, res.error.c_str());
363  return nullptr;
364  }
365 
366  return DBResultToCRowset(res);
367 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::AssemblyLinesSelectCorporation ( const uint32  corpID)
static
Todo:
need to add check/query for POS assembly modules here

Definition at line 319 of file FactoryDB.cpp.

References _log, EvERam::RestrictionMask::ByCorp, DBerror::c_str(), DBResultToCRowset(), DBQueryResult::error, and sDatabase.

319  {
320  DBQueryResult res;
321 
322  if (!sDatabase.RunQuery(res,
323  "SELECT"
324  " station.stationID AS containerID,"
325  " station.stationTypeID AS containerTypeID,"
326  " station.solarSystemID AS containerLocationID,"
327  " station.assemblyLineTypeID,"
328  " station.quantity,"
329  " station.ownerID"
330  " FROM ramAssemblyLineStations AS station"
331  " LEFT JOIN ramAssemblyLines AS line ON station.stationID = line.containerID AND station.assemblyLineTypeID = line.assemblyLineTypeID AND station.ownerID = line.ownerID"
332  " WHERE station.ownerID = %u"
333  " AND (line.restrictionMask & %u) = %u",
335  {
336  _log(DATABASE__ERROR, "Failed to query corporation assembly lines for corp %u: %s.", corpID, res.error.c_str());
337  return nullptr;
338  }
339 
340  return DBResultToCRowset(res);
341 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::AssemblyLinesSelectPersonal ( const uint32  charID)
static

Definition at line 271 of file FactoryDB.cpp.

References _log, EvERam::RestrictionMask::ByAlliance, EvERam::RestrictionMask::ByCorp, DBerror::c_str(), DBResultToCRowset(), DBQueryResult::error, and sDatabase.

271  {
272  DBQueryResult res;
273 
274  if (!sDatabase.RunQuery(res,
275  "SELECT"
276  " station.stationID AS containerID,"
277  " station.stationTypeID AS containerTypeID,"
278  " station.solarSystemID AS containerLocationID,"
279  " station.assemblyLineTypeID,"
280  " station.quantity,"
281  " station.ownerID"
282  " FROM ramAssemblyLineStations AS station"
283  " LEFT JOIN ramAssemblyLines AS line ON station.stationID = line.containerID AND station.assemblyLineTypeID = line.assemblyLineTypeID AND station.ownerID = line.ownerID"
284  " WHERE station.ownerID = %u"
285  " AND (line.restrictionMask & %u) = %u",
287  {
288  _log(DATABASE__ERROR, "Failed to query personal assembly lines for char %u: %s.", charID, res.error.c_str());
289  return nullptr;
290  }
291 
292  return DBResultToCRowset(res);
293 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::AssemblyLinesSelectPrivate ( const uint32  charID)
static

Definition at line 295 of file FactoryDB.cpp.

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

295  {
296  DBQueryResult res;
297 
298  if (!sDatabase.RunQuery(res,
299  "SELECT"
300  " station.stationID AS containerID,"
301  " station.stationTypeID AS containerTypeID,"
302  " station.solarSystemID AS containerLocationID,"
303  " station.assemblyLineTypeID,"
304  " station.quantity,"
305  " station.ownerID"
306  " FROM ramAssemblyLineStations AS station"
307  " LEFT JOIN ramAssemblyLines AS line ON station.stationID = line.containerID AND station.assemblyLineTypeID = line.assemblyLineTypeID AND station.ownerID = line.ownerID"
308  " WHERE station.ownerID = %u",
309  charID))
310  {
311  _log(DATABASE__ERROR, "Failed to query private assembly lines for char %u: %s.", charID, res.error.c_str());
312  return nullptr;
313  }
314 
315  return DBResultToCRowset(res);
316 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::AssemblyLinesSelectPublic ( const uint32  regionID)
static

Definition at line 245 of file FactoryDB.cpp.

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

245  {
246  DBQueryResult res;
247 
248  if (!sDatabase.RunQuery(res,
249  "SELECT"
250  " station.stationID AS containerID,"
251  " station.stationTypeID AS containerTypeID,"
252  " station.solarSystemID AS containerLocationID,"
253  " station.assemblyLineTypeID,"
254  " station.quantity,"
255  " station.ownerID,"
256  " types.activityID"
257  " FROM ramAssemblyLineStations AS station"
258  " LEFT JOIN crpNPCCorporations AS corp ON station.ownerID = corp.corporationID"
259  " LEFT JOIN ramAssemblyLineTypes as types ON station.assemblyLineTypeID = types.assemblyLineTypeID"
260  " WHERE station.ownerID = corp.corporationID"
261  " AND station.regionID = %u",
262  regionID))
263  {
264  _log(DATABASE__ERROR, "Failed to query public assembly lines for region %u: %s.", regionID, res.error.c_str());
265  return nullptr;
266  }
267 
268  return DBResultToCRowset(res);
269 }
#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
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

bool FactoryDB::CompleteJob ( const uint32  jobID,
const int8  completedStatus 
)
static

Definition at line 636 of file FactoryDB.cpp.

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

636  {
637  DBerror err;
638 
639  if (!sDatabase.RunQuery(err, "UPDATE ramJobs SET completedStatusID = %i WHERE jobID = %u", completedStatus, jobID)) {
640  _log(DATABASE__ERROR, "Failed to complete job %u (status = %i): %s.", jobID, completedStatus, err.c_str());
641  return false;
642  }
643 
644  return true;
645 }
#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:

uint32 FactoryDB::CountManufacturingJobs ( const uint32  installerID)
static

Definition at line 554 of file FactoryDB.cpp.

References _log, DBQueryResult::GetRow(), DBResultRow::GetUInt(), and sDatabase.

Referenced by RamMethods::JobsCheck().

554  {
555  DBQueryResult res;
556 
557  if (!sDatabase.RunQuery(res,
558  "SELECT"
559  " COUNT(job.jobID)"
560  " FROM ramJobs AS job"
561  " LEFT JOIN ramAssemblyLines AS line USING (assemblyLineID)"
562  " WHERE job.installerID = %u"
563  " AND job.completedStatusID = 0"
564  " AND line.activityID = 1",
565  installerID))
566  {
567  _log(DATABASE__ERROR, "Failed to count manufacturing jobs for installer %u.", installerID);
568  return 0;
569  }
570 
571  DBResultRow row;
572  if (!res.GetRow(row)) {
573  _log(DATABASE__ERROR, "No rows returned while counting manufacturing jobs for installer %u.", installerID);
574  return 0;
575  }
576 
577  return row.GetUInt(0);
578 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 FactoryDB::CountResearchJobs ( const uint32  installerID)
static

Definition at line 579 of file FactoryDB.cpp.

References _log, DBQueryResult::GetRow(), DBResultRow::GetUInt(), and sDatabase.

Referenced by RamMethods::JobsCheck().

579  {
580  DBQueryResult res;
581 
582  if (!sDatabase.RunQuery(res,
583  "SELECT"
584  " COUNT(job.jobID)"
585  " FROM ramJobs AS job"
586  " LEFT JOIN ramAssemblyLines AS line USING (assemblyLineID)"
587  " WHERE job.installerID = %u"
588  " AND job.completedStatusID = 0"
589  " AND line.activityID != 1", // is this accurate?
590  installerID))
591  {
592  _log(DATABASE__ERROR, "Failed to count research jobs for installer %u.", installerID);
593  return 0;
594  }
595 
596  DBResultRow row;
597  if (!res.GetRow(row))
598  return 0;
599 
600  return row.GetUInt(0);
601 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552

Here is the call graph for this function:

Here is the caller graph for this function:

bool FactoryDB::DeleteBlueprint ( uint32  blueprintID)
static

Definition at line 94 of file FactoryDB.cpp.

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

Referenced by Blueprint::Delete().

94  {
95  DBerror err;
96  if(!sDatabase.RunQuery(err, "DELETE FROM invBlueprints WHERE itemID=%u", blueprintID)) {
97  _log(DATABASE__ERROR, "Failed to delete blueprint %u: %s.", blueprintID, err.c_str());
98  return false;
99  }
100  return true;
101 }
#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:

bool FactoryDB::GetAssemblyLineProperties ( const uint32  assemblyLineID,
Character pChar,
Rsp_InstallJob &  into,
bool  isCorpJob = false 
)
static
Todo:
need to add check/query for POS assembly modules here
Todo:
this shit will have to be verified for negative standings

Definition at line 400 of file FactoryDB.cpp.

References _log, DBerror::c_str(), Character::corporationID(), DBQueryResult::error, DBResultRow::GetFloat(), DBResultRow::GetInt(), DBQueryResult::GetRow(), StandingDB::GetStanding(), InventoryItem::itemID(), sDatabase, and sDataMgr.

Referenced by RamMethods::Calculate().

400  {
401  DBQueryResult res;
402  if (!sDatabase.RunQuery(res,
403  "SELECT"
404  " alt.baseMaterialMultiplier,"
405  " alt.baseTimeMultiplier,"
406  " al.costInstall,"
407  " alt.minCostPerHour,"
408  " al.costPerHour,"
409  " al.ownerID," //5
410  " al.discountPerGoodStandingPoint,"
411  " al.surchargePerBadStandingPoint"
412  " FROM ramAssemblyLines AS al"
413  " LEFT JOIN ramAssemblyLineTypes AS alt USING (assemblyLineTypeID)"
414  " WHERE al.assemblyLineID = %u",
415  assemblyLineID))
416  {
417  _log(DATABASE__ERROR, "Failed to query properties for assembly line %u: %s.", assemblyLineID, res.error.c_str());
418  return false;
419  }
420 
421  DBResultRow row;
422  if (!res.GetRow(row)) {
423  _log(DATABASE__ERROR, "No properties found for assembly line %u.", assemblyLineID);
424  return false;
425  }
426 
427  into.materialMultiplier = row.GetFloat(0);
428  into.timeMultiplier = row.GetFloat(1);
429  into.installCost = row.GetFloat(2);
430  if (row.GetFloat(3) > row.GetFloat(4)) { //min of base cost/hr vs minimum cost/hr
431  into.usageCost = row.GetFloat(3);
432  } else {
433  into.usageCost = row.GetFloat(4);
434  }
435 
436  // verify line standings modifiers (some have no modifiers)
437  if ((row.GetFloat(6) == 0) and (row.GetFloat(7) == 0))
438  return true;
439 
440  float standing(1), costModifier(1);
441  uint32 factionID(sDataMgr.GetCorpFaction(row.GetInt(5)));
442  if (isCorpJob) {
443  // this is only for PC corps. take higher of (npc faction to pc corp)/2 or npc corp to pc corp
444  float cStanding(StandingDB::GetStanding(row.GetInt(5), pChar->corporationID()));
445  float fStanding(StandingDB::GetStanding(factionID, pChar->corporationID()));
446  fStanding /= 2;
447  // this works for negative standings also
448  if (cStanding > fStanding) {
449  standing = cStanding;
450  } else {
451  standing = fStanding;
452  }
453 
455  // modify end result by 25% for char standings with station owner
456  standing *= (1 - (0.025f * StandingDB::GetStanding(row.GetInt(5), pChar->itemID())));
457  } else {
458  // else take personal standings with station corp only
459  standing = StandingDB::GetStanding(row.GetInt(5), pChar->itemID());
460  }
461 
462  if (standing < 0) {
463  costModifier += row.GetFloat(7) * -standing;
464  } else {
465  costModifier -= row.GetFloat(6) * standing;
466  }
467 
468  // make sure costModifier isnt 0 (some lines have 0 as modifier)
469  if (costModifier == 0)
470  costModifier = 1;
471 
472  _log(MANUF__MESSAGE, "FactoryDB::GetALProps() - Cost Modifier %.2f, standing %.2f", costModifier, standing);
473 
474  // modify setup cost based on standings
475  into.installCost *= costModifier;
476 
477  return true;
478 }
static float GetStanding(uint32 fromID, uint32 toID)
Definition: StandingDB.cpp:142
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
const char * c_str() const
Definition: dbcore.h:48
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 corporationID() const
Definition: Character.h:300
DBerror error
Definition: dbcore.h:69
uint32 itemID() const
Definition: InventoryItem.h:98
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

bool FactoryDB::GetAssemblyLineRestrictions ( const int32  assemblyLineID,
EvERam::LineRestrictions data 
)
static
Todo:
need to add check/query for POS assembly modules here

Definition at line 481 of file FactoryDB.cpp.

References _log, EvERam::LineRestrictions::activityID, DBerror::c_str(), DBQueryResult::error, DBResultRow::GetFloat(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), EvERam::LineRestrictions::maxCharSec, EvERam::LineRestrictions::maxCorpSec, EvERam::LineRestrictions::minCharSec, EvERam::LineRestrictions::minCorpSec, EvERam::LineRestrictions::minStanding, EvERam::LineRestrictions::ownerID, EvERam::LineRestrictions::rMask, and sDatabase.

Referenced by RamMethods::LinePermissionCheck().

481  {
482  DBQueryResult res;
483 
484  if (!sDatabase.RunQuery(res,
485  "SELECT"
486  " ownerID,"
487  " minimumStanding,"
488  " minimumCharSecurity,"
489  " maximumCharSecurity,"
490  " minimumCorpSecurity,"
491  " maximumCorpSecurity,"
492  " restrictionMask,"
493  " activityID"
494  " FROM ramAssemblyLines"
495  " WHERE assemblyLineID = %i",
496  assemblyLineID))
497  {
498  _log(DATABASE__ERROR, "Failed to query verify properties for assembly line %u: %s.", assemblyLineID, res.error.c_str());
499  return false;
500  }
501 
502  DBResultRow row;
503  if (!res.GetRow(row)) {
504  _log(DATABASE__ERROR, "No verify properties found for assembly line %u.", assemblyLineID);
505  return false;
506  }
507 
508  data.ownerID = row.GetUInt(0);
509  data.minStanding = row.GetFloat(1);
510  data.minCharSec = row.GetFloat(2);
511  data.maxCharSec = row.GetFloat(3);
512  data.minCorpSec = row.GetFloat(4);
513  data.maxCorpSec = row.GetFloat(5);
514  data.rMask = row.GetUInt(6);
515  data.activityID = row.GetUInt(7);
516 
517  return true;
518 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
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:

bool FactoryDB::GetBlueprint ( uint32  blueprintID,
EvERam::bpData into 
)
static

Definition at line 140 of file FactoryDB.cpp.

References _log, DBerror::c_str(), codelog, EvERam::bpData::copy, DBQueryResult::error, DBResultRow::GetBool(), DBResultRow::GetInt(), DBQueryResult::GetRow(), EvERam::bpData::mLevel, EvERam::bpData::pLevel, EvERam::bpData::runs, and sDatabase.

Referenced by Blueprint::_LoadItem().

140  {
141  DBQueryResult res;
142  if(!sDatabase.RunQuery(res,
143  "SELECT"
144  " copy,"
145  " mLevel,"
146  " pLevel,"
147  " runs"
148  " FROM invBlueprints"
149  " WHERE itemID=%u",
150  blueprintID))
151  {
152  codelog(DATABASE__ERROR, "Error in GetBlueprint query: %s.", res.error.c_str());
153  return false;
154  }
155 
156  DBResultRow row;
157  if (!res.GetRow(row)) {
158  _log(DATABASE__MESSAGE, "Blueprint %u not found.", blueprintID);
159  return false;
160  }
161 
162  into.copy = row.GetBool(0);
163  into.mLevel = row.GetInt(1);
164  into.pLevel = row.GetInt(2);
165  into.runs = row.GetInt(3);
166 
167  return true;
168 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
bool GetBool(uint32 index) const
Definition: dbcore.cpp:647
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
DBerror error
Definition: dbcore.h:69
int16 runs
Definition: EVE_RAM.h:110

Here is the call graph for this function:

Here is the caller graph for this function:

void FactoryDB::GetBlueprintType ( DBQueryResult res)
static

Definition at line 170 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

170  {
171  if (!sDatabase.RunQuery(res,
172  "SELECT"
173  " blueprintTypeID,"
174  " parentBlueprintTypeID,"
175  " productTypeID,"
176  " productionTime,"
177  " techLevel,"
178  " researchProductivityTime,"
179  " researchMaterialTime,"
180  " researchCopyTime,"
181  " researchTechTime,"
182  " productivityModifier,"
183  " materialModifier,"
184  " wasteFactor,"
185  " maxProductionLimit, "
186  " chanceOfRE,"
187  " g.categoryID"
188  " FROM invBlueprintTypes AS bt"
189  " LEFT JOIN invTypes AS t ON t.typeID = bt.blueprintTypeID"
190  " LEFT JOIN invGroups AS g USING (groupID)"))
191  //" WHERE t.published = 1" ))
192  {
193  codelog(DATABASE__ERROR, "Error in GetBlueprintType query: %s.", res.error.c_str());
194  }
195 }
#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 FactoryDB::GetCommodities ( DBQueryResult res)
static

Definition at line 58 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

59 {
60  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (1042, 1034, 1040, 1041)")) // PI Commodities
61  codelog(DATABASE__ERROR, "Error in GetCommodities query: %s", res.error.c_str());
62 }
#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 FactoryDB::GetComponents ( DBQueryResult res)
static

Definition at line 52 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

53 {
54  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (280, 283, 313, 334, 428, 429, 526, 536, 873, 886, 913, 964)")) // components
55  codelog(DATABASE__ERROR, "Error in GetComponents query: %s", res.error.c_str());
56 }
#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 FactoryDB::GetCompounds ( DBQueryResult res)
static

Definition at line 40 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

41 {
42  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (282, 333, 423, 427, 530, 711, 712)"))
43  codelog(DATABASE__ERROR, "Error in GetCompounds query: %s", res.error.c_str());
44 }
#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 FactoryDB::GetJobProperties ( const uint32  jobID,
EvERam::JobProperties data 
)
static

Definition at line 603 of file FactoryDB.cpp.

References _log, EvERam::JobProperties::activity, DBerror::c_str(), EvERam::JobProperties::endTime, DBQueryResult::error, EvERam::JobProperties::eventID, DBResultRow::GetInt(), DBResultRow::GetInt64(), DBQueryResult::GetRow(), DBResultRow::GetUInt(), EvERam::JobProperties::itemID, EvERam::JobProperties::jobRuns, EvERam::JobProperties::licensedRuns, EvERam::JobProperties::outputFlag, EvERam::JobProperties::ownerID, sDatabase, and EvERam::JobProperties::status.

603  {
604  DBQueryResult res;
605  if (!sDatabase.RunQuery(res,
606  "SELECT job.installedItemID, job.ownerID, job.outputFlag, job.runs, job.licensedProductionRuns,"
607  " job.endProductionTime, job.completedStatusID, line.activityID, job.eventID"
608  " FROM ramJobs AS job"
609  " LEFT JOIN ramAssemblyLines AS line USING (assemblyLineID)"
610  " WHERE job.jobID = %u",
611  jobID))
612  {
613  _log(DATABASE__ERROR, "Failed to query properties of job %u: %s.", jobID, res.error.c_str());
614  return false;
615  }
616 
617  DBResultRow row;
618  if (!res.GetRow(row)) {
619  _log(DATABASE__ERROR, "No properties found for job %u.", jobID);
620  return false;
621  }
622 
623  data.itemID = row.GetUInt(0);
624  data.ownerID = row.GetUInt(1);
625  data.outputFlag = (EVEItemFlags)row.GetUInt(2);
626  data.jobRuns = row.GetInt(3);
627  data.licensedRuns = row.GetInt(4);
628  data.endTime = row.GetInt64(5);
629  data.status = row.GetInt(6);
630  data.activity = row.GetUInt(7);
631  data.eventID = row.GetUInt(8);
632 
633  return true;
634 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
EVEItemFlags
Definition: EVE_Flags.h:13
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
const char * c_str() const
Definition: dbcore.h:48
EVEItemFlags outputFlag
Definition: EVE_RAM.h:102
DBerror error
Definition: dbcore.h:69
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670

Here is the call graph for this function:

PyRep * FactoryDB::GetJobs2 ( const int32  ownerID,
const bool  completed 
)
static

Definition at line 197 of file FactoryDB.cpp.

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

198 {
199  DBQueryResult res;
200 
201  if (!sDatabase.RunQuery(res,
202  "SELECT"
203  " job.jobID,"
204  " job.assemblyLineID,"
205  " assemblyLine.containerID,"
206  " job.installedItemID,"
207  " installedItem.typeID AS installedItemTypeID,"
208  " installedItem.ownerID AS installedItemOwnerID,"
209  " blueprint.pLevel AS installedItemProductivityLevel,"
210  " blueprint.mLevel AS installedItemMaterialLevel,"
211  // quite ugly, but lets us use DBResultToRowset
212  " IF(assemblyLine.activityID = 1, blueprintType.productTypeID, installedItem.typeID) AS outputTypeID,"
213  " job.outputFlag,"
214  " job.installerID,"
215  " assemblyLine.activityID,"
216  " job.runs,"
217  " job.installTime,"
218  " job.beginProductionTime,"
219  " job.pauseProductionTime,"
220  " job.endProductionTime,"
221  " job.completedStatusID != 0 AS completed,"
222  " job.licensedProductionRuns,"
223  " station.solarSystemID AS installedInSolarSystemID,"
224  " job.completedStatusID AS completedStatus,"
225  " station.stationTypeID AS containerTypeID,"
226  " station.solarSystemID AS containerLocationID"
227  " FROM ramJobs AS job"
228  " LEFT JOIN entity AS installedItem ON job.installedItemID = installedItem.itemID"
229  " LEFT JOIN ramAssemblyLines AS assemblyLine ON job.assemblyLineID = assemblyLine.assemblyLineID"
230  " LEFT JOIN invBlueprints AS blueprint ON installedItem.itemID = blueprint.itemID"
231  " LEFT JOIN invBlueprintTypes AS blueprintType ON installedItem.typeID = blueprintType.blueprintTypeID"
232  " LEFT JOIN ramAssemblyLineStations AS station ON assemblyLine.containerID = station.stationID"
233  " WHERE job.ownerID = %u"
234  " AND job.completedStatusID %s 0"
235  " GROUP BY job.jobID",
236  ownerID, (completed ? "!=" : "=") ))
237  {
238  _log(DATABASE__ERROR, "Failed to query jobs for owner %u: %s", ownerID, res.error.c_str());
239  return nullptr;
240  }
241 
242  return DBResultToRowset(res);
243 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * FactoryDB::GetMaterialCompositionOfItemType ( const uint32  typeID)
static

Definition at line 103 of file FactoryDB.cpp.

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

103  {
104  DBQueryResult res;
105 
106  if(!sDatabase.RunQuery(res,
107  "SELECT requiredTypeID AS typeID, quantity"
108  " FROM ramTypeRequirements"
109  " WHERE typeID = (SELECT blueprintTypeID FROM invBlueprintTypes WHERE productTypeID = %u)"
110  " AND activityID = 1 AND damagePerJob = 1",
111  typeID))
112  {
113  _log(DATABASE__ERROR, "Could not retrieve material composition for type %u : %s", typeID, res.error.c_str());
114  return nullptr;
115  }
116 
117  return DBResultToRowset(res);
118 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
const char * c_str() const
Definition: dbcore.h:48
PyObject * DBResultToRowset(DBQueryResult &result)
Definition: EVEDBUtils.cpp:81
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

void FactoryDB::GetMinerals ( DBQueryResult res)
static

Definition at line 46 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

47 {
48  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID = 18 AND published = 1")) // minerals
49  codelog(DATABASE__ERROR, "Error in GetMinerals query: %s", res.error.c_str());
50 }
#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 FactoryDB::GetMiscCommodities ( DBQueryResult res)
static

Definition at line 64 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

65 {
66  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID = 314"))
67  codelog(DATABASE__ERROR, "Error in GetMinerals query: %s", res.error.c_str());
68 }
#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 FactoryDB::GetMultipliers ( const uint32  assemblyLineID,
const ItemType pType,
Rsp_InstallJob &  into 
)
static

Definition at line 678 of file FactoryDB.cpp.

References _log, DBerror::c_str(), ItemType::categoryID(), DBQueryResult::error, DBResultRow::GetDouble(), DBQueryResult::GetRow(), ItemType::groupID(), and sDatabase.

Referenced by RamMethods::Calculate(), and IsProducableBy().

678  {
679  DBQueryResult res;
680  // check Category first
681  if (!sDatabase.RunQuery(res,
682  "SELECT alc.materialMultiplier, alc.timeMultiplier"
683  " FROM ramAssemblyLineTypeDetailPerCategory AS alc"
684  " LEFT JOIN ramAssemblyLines AS al USING (assemblyLineTypeID)"
685  " WHERE al.assemblyLineID = %u AND alc.categoryID = %u",
686  assemblyLineID, pType->categoryID()))
687  {
688  _log(DATABASE__ERROR, "Failed to check producability of cat %u by line %u: %s", pType->categoryID(), assemblyLineID, res.error.c_str());
689  return false;
690  }
691 
692  DBResultRow row;
693  if (res.GetRow(row)) {
694  into.materialMultiplier *= row.GetDouble(0);
695  into.timeMultiplier *= row.GetDouble(1);
696  }
697 
698  // then Group (all materialMultiplier = 1)
699  if (!sDatabase.RunQuery(res,
700  "SELECT alg.materialMultiplier, alg.timeMultiplier"
701  " FROM ramAssemblyLineTypeDetailPerGroup AS alg"
702  " LEFT JOIN ramAssemblyLines AS al USING (assemblyLineTypeID)"
703  " WHERE al.assemblyLineID = %u"
704  " AND alg.groupID = %u",
705  assemblyLineID, pType->groupID()))
706  {
707  _log(DATABASE__ERROR, "Failed to check producability of group %u by line %u: %s", pType->groupID(), assemblyLineID, res.error.c_str());
708  return false;
709  }
710 
711  if (res.GetRow(row)) {
712  into.materialMultiplier *= row.GetDouble(0);
713  into.timeMultiplier *= row.GetDouble(1);
714  }
715 
716  return true;
717 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 groupID() const
Definition: ItemType.h:64
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
uint8 categoryID() const
Definition: ItemType.h:66
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
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:

int64 FactoryDB::GetNextFreeTime ( const uint32  assemblyLineID)
static

Definition at line 662 of file FactoryDB.cpp.

References _log, DBerror::c_str(), DBQueryResult::error, DBResultRow::GetInt64(), DBQueryResult::GetRow(), DBResultRow::IsNull(), and sDatabase.

Referenced by RamMethods::Calculate().

662  {
663  DBQueryResult res;
664  if (!sDatabase.RunQuery(res, "SELECT nextFreeTime FROM ramAssemblyLines WHERE assemblyLineID = %u", assemblyLineID)) {
665  _log(DATABASE__ERROR, "Failed to query next free time for assembly line %u: %s.", assemblyLineID, res.error.c_str());
666  return 0;
667  }
668 
669  DBResultRow row;
670  if (!res.GetRow(row)) {
671  _log(DATABASE__ERROR, "Assembly line %u not found.", assemblyLineID);
672  return 0;
673  }
674 
675  return (row.IsNull(0) ? 0 : row.GetInt64(0));
676 }
#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
bool IsNull(uint32 index) const
Definition: dbcore.h:102
DBerror error
Definition: dbcore.h:69
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670

Here is the call graph for this function:

Here is the caller graph for this function:

void FactoryDB::GetRAMMaterials ( DBQueryResult res)
static

Definition at line 76 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

77 {
78  if (!sDatabase.RunQuery(res, "SELECT typeID, materialTypeID, quantity FROM invTypeMaterials"))
79  codelog(DATABASE__ERROR, "Error in GetRAMMaterials query: %s", res.error.c_str());
80 }
#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 FactoryDB::GetRAMRequirements ( DBQueryResult res)
static

Definition at line 82 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

83 {
84  if (!sDatabase.RunQuery(res, "SELECT typeID, activityID, requiredTypeID, quantity, damagePerJob, extra FROM ramTypeRequirements"))
85  codelog(DATABASE__ERROR, "Error in GetRAMRequirements query: %s", res.error.c_str());
86 }
#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 FactoryDB::GetResources ( DBQueryResult res)
static

Definition at line 70 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

71 {
72  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (1031, 1032, 1033, 1035)")) // PI Resources
73  codelog(DATABASE__ERROR, "Error in GetResources query: %s", res.error.c_str());
74 }
#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 FactoryDB::GetSalvage ( DBQueryResult res)
static

Definition at line 34 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

35 {
36  if (!sDatabase.RunQuery(res, "SELECT typeID, typeName FROM invTypes WHERE groupID IN (754, 966)"))
37  codelog(DATABASE__ERROR, "Error in GetSalvage query: %s", res.error.c_str());
38 }
#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:

uint32 FactoryDB::GetTech2Blueprint ( const uint32  blueprintTypeID)
static

Definition at line 647 of file FactoryDB.cpp.

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

Referenced by RamMethods::ActivityCheck().

647  {
648  DBQueryResult res;
649 
650  if (!sDatabase.RunQuery(res, "SELECT blueprintTypeID FROM invBlueprintTypes WHERE parentBlueprintTypeID = %u", blueprintTypeID)) {
651  _log(DATABASE__ERROR, "Unable to get T2 type for type ID %u: %s", blueprintTypeID, res.error.c_str());
652  return 0;
653  }
654 
655  DBResultRow row;
656  if (!res.GetRow(row))
657  return 0;
658 
659  return row.GetUInt(0);
660 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
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:

uint32 FactoryDB::InstallJob ( const uint32  ownerID,
const uint32  installerID,
Call_InstallJob &  args,
const int64  beginTime,
const int64  endTime,
const uint32  systemID 
)
static

Definition at line 520 of file FactoryDB.cpp.

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

522 {
523  DBerror err;
524  uint32 jobID(0);
525  // insert job
526  if (!sDatabase.RunQueryLID(err, jobID,
527  "INSERT INTO ramJobs"
528  " (ownerID, installerID, assemblyLineID, installedItemID, installTime, beginProductionTime, endProductionTime,"
529  " runs, outputFlag, licensedProductionRuns, completedStatusID, installedInSolarSystemID)"
530  " VALUES"
531  " (%u, %u, %i, %i, %.0f, %li, %li,"
532  " %i, %i, %i, 0, %i)",
533  ownerID, installerID, args.AssemblyLineID, args.bpItemID, GetFileTimeNow(), beginTime, endTime,
534  args.runs, args.outputFlag, args.copyRuns, systemID))
535  {
536  _log(DATABASE__ERROR, "Failed to insert new job to database: %s.", err.c_str());
537  return 0;
538  }
539 
540  // update nextFreeTime
541  if (!sDatabase.RunQuery(err,
542  "UPDATE ramAssemblyLines"
543  " SET nextFreeTime = %li"
544  " WHERE assemblyLineID = %i",
545  endTime, args.AssemblyLineID))
546  {
547  _log(DATABASE__ERROR, "Failed to update next free time for assembly line %u: %s.", args.AssemblyLineID, err.c_str());
548  return 0;
549  }
550 
551  return jobID;
552 }
#define sDatabase
Definition: dbcore.h:199
#define _log(type, fmt,...)
Definition: logsys.h:124
* args
const char * c_str() const
Definition: dbcore.h:48
unsigned __int32 uint32
Definition: eve-compat.h:50
double GetFileTimeNow()
Definition: utils_time.cpp:84
Definition: dbcore.h:39

Here is the call graph for this function:

bool FactoryDB::IsProducableBy ( const uint32  assemblyLineID,
const ItemType pType 
)
static
Todo:
is there is a better way to do this??

Definition at line 29 of file FactoryDB.cpp.

References GetMultipliers().

Referenced by RamMethods::ActivityCheck().

29  {
30  Rsp_InstallJob into;
31  return FactoryDB::GetMultipliers(assemblyLineID, pType, into);
32 }
static bool GetMultipliers(const uint32 assemblyLineID, const ItemType *pType, Rsp_InstallJob &into)
Definition: FactoryDB.cpp:678

Here is the call graph for this function:

Here is the caller graph for this function:

bool FactoryDB::IsRecyclable ( const uint16  typeID)
static

Definition at line 737 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

737  {
738  DBQueryResult res;
739  if (!sDatabase.RunQuery(res,
740  "SELECT NULL FROM ramTypeRequirements"
741  " LEFT JOIN invBlueprintTypes ON typeID = blueprintTypeID"
742  " WHERE damagePerJob = 1 AND activityID = 6 AND typeID = %u"
743  " AND extra = 1"
744  " LIMIT 1",
745  typeID))
746  {
747  _log(DATABASE__ERROR, "Failed to check item type ID: %s.", res.error.c_str());
748  return false;
749  }
750 
751  DBResultRow row;
752  if (res.GetRow(row))
753  return true;
754 
755  if (!sDatabase.RunQuery(res,
756  "SELECT NULL FROM ramTypeRequirements"
757  " LEFT JOIN invBlueprintTypes ON typeID = blueprintTypeID"
758  " WHERE damagePerJob = 1 AND activityID = 1 AND productTypeID = %u"
759  " AND extra = 1"
760  " LIMIT 1",
761  typeID))
762  {
763  _log(DATABASE__ERROR, "Failed to check item type ID: %s.", res.error.c_str());
764  return false;
765  }
766 
767  return (res.GetRow(row));
768 }
#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

Here is the call graph for this function:

Here is the caller graph for this function:

bool FactoryDB::IsRefinable ( const uint16  typeID)
static

Definition at line 719 of file FactoryDB.cpp.

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

Referenced by StaticDataMgr::Populate().

719  {
720  DBQueryResult res;
721  if (!sDatabase.RunQuery(res,
722  "SELECT NULL"
723  " FROM ramTypeRequirements"
724  " WHERE typeID=%u"
725  " AND extra = 0"
726  " LIMIT 1",
727  typeID))
728  {
729  _log(DATABASE__ERROR, "Failed to check ore type ID: %s.", res.error.c_str());
730  return false;
731  }
732 
733  DBResultRow row;
734  return (res.GetRow(row));
735 }
#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

Here is the call graph for this function:

Here is the caller graph for this function:

bool FactoryDB::SaveBlueprintData ( uint32  blueprintID,
EvERam::bpData data 
)
static

Definition at line 120 of file FactoryDB.cpp.

References DBerror::c_str(), codelog, EvERam::bpData::copy, EvERam::bpData::mLevel, EvERam::bpData::pLevel, EvERam::bpData::runs, and sDatabase.

Referenced by Blueprint::CreateItemID(), and Blueprint::SaveBlueprint().

120  {
121  DBerror err;
122  if(!sDatabase.RunQuery(err,
123  "INSERT INTO invBlueprints"
124  " (itemID, copy, mLevel, pLevel, runs)"
125  " VALUES"
126  " (%u, %u, %i, %i, %i)"
127  "ON DUPLICATE KEY UPDATE "
128  "mLevel=VALUES(mLevel), "
129  "pLevel=VALUES(pLevel), "
130  "runs=VALUES(runs) ",
131  blueprintID, data.copy, data.mLevel, data.pLevel, data.runs))
132  {
133  codelog(DATABASE__ERROR, "Error in SaveBlueprint query: %s.", err.c_str());
134  return false;
135  }
136 
137  return true;
138 }
#define sDatabase
Definition: dbcore.h:199
const char * c_str() const
Definition: dbcore.h:48
#define codelog(type, fmt,...)
Definition: logsys.h:128
int16 runs
Definition: EVE_RAM.h:110
Definition: dbcore.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

void FactoryDB::SetJobEventID ( const uint32  jobID,
const uint32  eventID 
)
static

Definition at line 88 of file FactoryDB.cpp.

References sDatabase.

89 {
90  DBerror err;
91  sDatabase.RunQuery(err, "UPDATE ramJobs SET eventID=%u WHERE jobID=%u", eventID, jobID);
92 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39

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