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

#include "SearchDB.h"

Inheritance diagram for SearchDB:
Collaboration diagram for SearchDB:

Public Member Functions

PyRepQuery (std::string string, std::vector< int > *searchID, uint32 charID)
 
PyRepQuickQuery (std::string string, std::vector< int > *searchID, uint32 charID, bool hideNPC=false, bool onlyAltName=false)
 
- 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 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)
 
- 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 50 of file SearchDB.h.

Member Function Documentation

PyRep * SearchDB::Query ( std::string  string,
std::vector< int > *  searchID,
uint32  charID 
)

search runs thru these types...even inventory (type 10) searchResultAgent = 1 searchResultCharacter = 2 searchResultCorporation = 3 searchResultAlliance = 4 searchResultFaction = 5 searchResultConstellation = 6 searchResultSolarSystem = 7 searchResultRegion = 8 searchResultStation = 9 searchResultInventoryType = 10 searchResultAllOwners = [1, 2, 3, 4, 5] searchResultAllLocations = [6, 7, 8, 9] searchMaxResults = 500 searchMinWildcardLength = 3

Definition at line 47 of file SearchDB.cpp.

References DBResultToIntIntDict(), DBQueryResult::GetRowCount(), sDatabase, and PyDict::SetItem().

47  {
48  std::string id = "";
49 
50  PyDict *dict = new PyDict();
51  DBQueryResult res;
52 
53  for (uint8 i = 0; i < searchID->size(); i++) {
54  switch(searchID->at(i)) {
55  case 1: //searchResultAgent = 1
56  sDatabase.RunQuery(res,
57  "SELECT"
58  " characterID AS agentID"
59  " FROM chrNPCCharacters"
60  " WHERE characterName LIKE '%s' "
61  " LIMIT 0, 10", string.c_str() );
62  id = "agentID";
63  break;
64  case 2: //searchResultCharacter = 2
65  sDatabase.RunQuery(res,
66  "SELECT"
67  " characterID AS ownerID"
68  " FROM chrCharacters"
69  " WHERE characterName LIKE '%s' ", string.c_str() );
70  id = "ownerID";
71  break;
72  case 3: //searchResultCorporation = 3
73  sDatabase.RunQuery(res,
74  "SELECT"
75  " corporationID AS ownerID"
76  " FROM crpCorporation"
77  " WHERE corporationName LIKE '%s' "
78  " LIMIT 0, 10", string.c_str() );
79  id = "ownerID";
80  break;
81  case 4: //searchResultAlliance = 4
82  sDatabase.RunQuery(res,
83  "SELECT allianceID AS ownerID"
84  " FROM alnAlliance"
85  " WHERE shortName LIKE '%s' "
86  " LIMIT 0, 10", string.c_str() );
87  id = "ownerID";
88  break;
89  case 5: //searchResultFaction = 5
90  sDatabase.RunQuery(res,
91  "SELECT factionID AS ownerID"
92  " FROM facFactions"
93  " WHERE factionName LIKE '%s' "
94  " LIMIT 0, 10", string.c_str() );
95  id = "ownerID";
96  break;
97  case 6: //searchResultConstellation = 6
98  sDatabase.RunQuery(res,
99  "SELECT"
100  " constellationID AS itemID"
101  " FROM mapConstellations"
102  " WHERE constellationName LIKE '%s' "
103  " LIMIT 0, 10", string.c_str() );
104  id = "itemID";
105  break;
106  case 7: //searchResultSolarSystem = 7
107  sDatabase.RunQuery(res,
108  "SELECT "
109  " solarSystemID AS itemID"
110  " FROM mapSolarSystems "
111  " WHERE solarSystemName LIKE '%s' "
112  " LIMIT 0, 10", string.c_str() );
113  id = "itemID";
114  break;
115  case 8: //searchResultRegion = 8
116  sDatabase.RunQuery(res,
117  "SELECT "
118  " regionID AS itemID"
119  " FROM mapRegions"
120  " WHERE regionName LIKE '%s' "
121  " LIMIT 0, 10", string.c_str() );
122  id = "itemID";
123  break;
124  case 9: //searchResultStation = 9
125  sDatabase.RunQuery(res,
126  "SELECT "
127  " stationID AS itemID"
128  " FROM staStations "
129  " WHERE stationName LIKE '%s' "
130  " LIMIT 0, 10", string.c_str() );
131  id = "itemID";
132  break;
133  case 10: //searchResultInventoryType = 10
134  sDatabase.RunQuery(res,
135  "SELECT"
136  " typeID"
137  " FROM entity"
138  " WHERE itemName LIKE '%s'"
139  " AND ownerID = %u", string.c_str(), charID );
140  id = "typeID";
141  break;
142  }
143  if (res.GetRowCount())
144  dict->SetItem(new PyInt(searchID->at(i)),DBResultToIntIntDict(res));
145  }
146 
147  return dict;
148 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define sDatabase
Definition: dbcore.h:199
Python's dictionary.
Definition: PyRep.h:719
PyDict * DBResultToIntIntDict(DBQueryResult &result)
Definition: EVEDBUtils.cpp:273
Python integer.
Definition: PyRep.h:231
size_t GetRowCount()
Definition: dbcore.h:72
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713

Here is the call graph for this function:

PyRep * SearchDB::QuickQuery ( std::string  string,
std::vector< int > *  searchID,
uint32  charID,
bool  hideNPC = false,
bool  onlyAltName = false 
)
Todo:
i dont remember what this was for, but need to finish it anyway

Definition at line 150 of file SearchDB.cpp.

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

150  {
151 
152  uint8 size = searchID->size();
153 
154  if (((size == 1) && (searchID->at(0) == 2)) || (hideNPC)) {
156  }
157 
158  PyList *result = new PyList();
159  DBQueryResult res;
160  DBResultRow row;
161 
162  for (uint8 i=0; i < searchID->size(); i++) {
163  switch(searchID->at(i)) {
164  case 1: //searchResultAgent = 1
165  sDatabase.RunQuery(res,
166  "SELECT characterID"
167  " FROM chrNPCCharacters"
168  " WHERE characterName LIKE '%s' "
169  " LIMIT 0, 10", string.c_str() );
170  break;
171  case 2: //searchResultCharacter = 2
172  sDatabase.RunQuery(res,
173  "SELECT characterID"
174  " FROM chrCharacters"
175  " WHERE characterName LIKE '%s' ", string.c_str() );
176  break;
177  case 3: //searchResultCorporation = 3
178  sDatabase.RunQuery(res,
179  "SELECT corporationID"
180  " FROM crpCorporation"
181  " WHERE corporationName LIKE '%s' "
182  " LIMIT 0, 10", string.c_str() );
183  break;
184  case 4: //searchResultAlliance = 4
185  sDatabase.RunQuery(res,
186  "SELECT allianceID"
187  " FROM alnAlliance"
188  " WHERE shortName LIKE '%s' "
189  " LIMIT 0, 10", string.c_str() );
190  break;
191  case 5: //searchResultFaction = 5
192  sDatabase.RunQuery(res,
193  "SELECT factionID"
194  " FROM facFactions"
195  " WHERE factionName LIKE '%s' "
196  " LIMIT 0, 10", string.c_str() );
197  break;
198  case 6: //searchResultConstellation = 6
199  sDatabase.RunQuery(res,
200  "SELECT constellationID"
201  " FROM mapConstellations"
202  " WHERE constellationName LIKE '%s' "
203  " LIMIT 0, 10", string.c_str() );
204  break;
205  case 7: //searchResultSolarSystem = 7
206  sDatabase.RunQuery(res,
207  "SELECT solarSystemID"
208  " FROM mapSolarSystems "
209  " WHERE solarSystemName LIKE '%s' "
210  " LIMIT 0, 10", string.c_str() );
211  break;
212  case 8: //searchResultRegion = 8
213  sDatabase.RunQuery(res,
214  "SELECT regionID"
215  " FROM mapRegions"
216  " WHERE regionName LIKE '%s' "
217  " LIMIT 0, 10", string.c_str() );
218  break;
219  case 9: //searchResultStation = 9
220  sDatabase.RunQuery(res,
221  "SELECT stationID"
222  " FROM staStations "
223  " WHERE stationName LIKE '%s' "
224  " LIMIT 0, 10", string.c_str() );
225  break;
226  case 10: //searchResultInventoryType = 10
227  sDatabase.RunQuery(res,
228  "SELECT typeID"
229  " FROM entity"
230  " WHERE itemName LIKE '%s'"
231  " AND ownerID = %u", string.c_str(), charID );
232  break;
233  }
234  while (res.GetRow(row)) {
235  result->AddItem( new PyInt(row.GetUInt(0) ));
236  }
237  }
238 
239  return result;
240 }
unsigned __int8 uint8
Definition: eve-compat.h:46
#define sDatabase
Definition: dbcore.h:199
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
void AddItem(PyRep *i)
Definition: PyRep.h:701
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
Python integer.
Definition: PyRep.h:231
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:


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