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

#include "BookmarkDB.h"

Inheritance diagram for BookmarkDB:
Collaboration diagram for BookmarkDB:

Public Member Functions

PyRepGetBookmarksInFolder (uint32 folderID)
 
PyRepGetBookmarks (uint32 ownerID)
 
PyRepGetFolders (uint32 ownerID)
 
bool GetBookmarkInformation (uint32 bookmarkID, uint32 &itemID, uint16 &typeID, uint32 &locationID, double &x, double &y, double &z)
 
bool UpdateBookmark (uint32 bookmarkID, uint32 ownerID, std::string memo, std::string note, uint32 folderID=0)
 
bool DeleteBookmark (uint32 ownerID, uint32 bookmarkID)
 
bool DeleteBookmarks (std::vector< int32 > *bookmarkList)
 
bool UpdateFolder (int32 folderID, std::string folderName)
 
bool DeleteFolder (int32 folderID)
 
uint32 SaveNewFolder (std::string folderName, uint32 ownerID)
 
void SaveNewBookmark (BmData &data)
 
void ChangeOwner (uint32 bookmarkID, uint32 ownerID=1)
 
void MoveBookmarkToFolder (int32 folderID, std::vector< int32 > *bookmarkList)
 
void GetBookmarkByFolderID (int32 folderID, std::vector< int32 > &bmIDs)
 
void GetVoucherData (BmData &data)
 
- Public Member Functions inherited from ServiceDB
uint32 GetStationOwner (uint32 stationID)
 

Static Public Member Functions

static PyTupleGetBookmarkDescription (uint32 bookmarkID)
 
static const char * GetBookmarkName (uint32 bookmarkID)
 
- 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

- 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 57 of file BookmarkDB.h.

Member Function Documentation

void BookmarkDB::ChangeOwner ( uint32  bookmarkID,
uint32  ownerID = 1 
)

Definition at line 301 of file BookmarkDB.cpp.

References sDatabase.

301  {
302  DBerror err;
303  sDatabase.RunQuery(err, "UPDATE bookmarks SET ownerID = %u WHERE bookmarkID = %u", ownerID, bookmarkID);
304 }
#define sDatabase
Definition: dbcore.h:199
Definition: dbcore.h:39
bool BookmarkDB::DeleteBookmark ( uint32  ownerID,
uint32  bookmarkID 
)

Definition at line 266 of file BookmarkDB.cpp.

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

267 {
268  DBerror err;
269  if (!sDatabase.RunQuery(err,
270  "DELETE FROM bookmarks"
271  " WHERE ownerID = %u AND bookmarkID = %u", ownerID, bookmarkID))
272  {
273  sLog.Error( "BookmarkDB::DeleteBookmarkFromDatabase()", "Error in query: %s", err.c_str() );
274  return false;
275  }
276 
277  return true;
278 }
#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
Definition: dbcore.h:39

Here is the call graph for this function:

bool BookmarkDB::DeleteBookmarks ( std::vector< int32 > *  bookmarkList)

Definition at line 280 of file BookmarkDB.cpp.

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

281 {
282  std::stringstream st;
283  std::string listString;
284 
285  std::size_t size = bookmarkList->size();
286  for (int8 i=0; i<size; ++i) {
287  st << bookmarkList->at(i);
288  if (i < (size-1))
289  st << ", ";
290  }
291 
292  DBerror err;
293  if (!sDatabase.RunQuery(err, "DELETE FROM bookmarks WHERE bookmarkID IN (%s)", st.str().c_str())) {
294  sLog.Error( "BookmarkDB::DeleteBookmarksFromDatabase()", "Error in query: %s", err.c_str() );
295  return false;
296  }
297 
298  return true;
299 }
#define sDatabase
Definition: dbcore.h:199
signed __int8 int8
Definition: eve-compat.h:45
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
Definition: dbcore.h:39

Here is the call graph for this function:

bool BookmarkDB::DeleteFolder ( int32  folderID)

Definition at line 356 of file BookmarkDB.cpp.

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

357 {
358  DBerror err;
359  if (!sDatabase.RunQuery(err, "DELETE FROM bookmarkFolders WHERE folderID = %u", folderID))
360  sLog.Error( "BookmarkDB::DeleteFolder(1)", "Error in query: %s", err.c_str() );
361 
362  // these bms may have copies....cannot delete yet
363  if (!sDatabase.RunQuery(err, "UPDATE bookmarks SET ownerID = 1 WHERE folderID = %u", folderID))
364  sLog.Error( "BookmarkDB::DeleteFolder(2)", "Error in query: %s", err.c_str() );
365 
366  return true;
367 }
#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
Definition: dbcore.h:39

Here is the call graph for this function:

void BookmarkDB::GetBookmarkByFolderID ( int32  folderID,
std::vector< int32 > &  bmIDs 
)

Definition at line 66 of file BookmarkDB.cpp.

References DBerror::c_str(), DBQueryResult::error, DBResultRow::GetInt(), DBQueryResult::GetRow(), sDatabase, and sLog.

67 {
68  DBQueryResult res;
69  if (!sDatabase.RunQuery(res, "SELECT bookmarkID FROM bookmarks WHERE folderID = %u", folderID)) {
70  sLog.Error( "BookmarkDB::GetBookmarkByFolderID()", "Failed to query bookmarks for folderID %u: %s.", folderID, res.error.c_str() );
71  return;
72  }
73 
74  DBResultRow row;
75  while (res.GetRow(row))
76  bmIDs.push_back(row.GetInt(0));
77 }
#define sDatabase
Definition: dbcore.h:199
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyTuple * BookmarkDB::GetBookmarkDescription ( uint32  bookmarkID)
static

Definition at line 180 of file BookmarkDB.cpp.

References DBerror::c_str(), DBQueryResult::error, DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::IsNull(), PyStatic, sDatabase, PyTuple::SetItem(), and sLog.

181 {
182  DBQueryResult res;
183  if (!sDatabase.RunQuery(res, "SELECT memo, note FROM bookmarks WHERE bookmarkID = %u", bookmarkID)) {
184  sLog.Error( "BookmarkDB::GetBookmarkName()", "Failed to query bookmarkID %u: %s.", bookmarkID, res.error.c_str() );
185  return nullptr;
186  }
187 
188  PyTuple* tuple = new PyTuple(2);
189  DBResultRow row;
190  if (res.GetRow(row)) {
191  tuple->SetItem(0, new PyString(row.GetText(0)));
192  if (row.IsNull(1)) {
193  tuple->SetItem(1, PyStatic.NewNone());
194  } else {
195  tuple->SetItem(1, new PyString(row.GetText(1)));
196  }
197  } else {
198  tuple->SetItem(0, PyStatic.NewNone());
199  tuple->SetItem(1, PyStatic.NewNone());
200  }
201 
202  return tuple;
203 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
Python string.
Definition: PyRep.h:430
Python tuple.
Definition: PyRep.h:567
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
#define PyStatic
Definition: PyRep.h:1209
bool IsNull(uint32 index) const
Definition: dbcore.h:102
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

bool BookmarkDB::GetBookmarkInformation ( uint32  bookmarkID,
uint32 itemID,
uint16 typeID,
uint32 locationID,
double &  x,
double &  y,
double &  z 
)

Definition at line 205 of file BookmarkDB.cpp.

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

Referenced by BookmarkService::LookupBookmark().

206 {
207  DBQueryResult res;
208  if (!sDatabase.RunQuery(res,
209  "SELECT"
210  " itemID,"
211  " typeID,"
212  " locationID,"
213  " x, y, z"
214  " FROM bookmarks "
215  " WHERE bookmarkID = %u ", bookmarkID))
216  {
217  sLog.Error( "BookmarkDB::GetBookmarkInformation()", "Error in query: %s", res.error.c_str() );
218  return false;
219  }
220 
221  DBResultRow row;
222  if (!res.GetRow(row))
223  return false;
224 
225  itemID = row.GetUInt(0);
226  typeID = row.GetUInt(1);
227  locationID = row.GetUInt(2);
228  x = row.GetDouble(3);
229  y = row.GetDouble(4);
230  z = row.GetDouble(5);
231 
232  return true;
233 }
#define sDatabase
Definition: dbcore.h:199
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
double GetDouble(uint32 index) const
Definition: dbcore.cpp:693
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr

Here is the call graph for this function:

Here is the caller graph for this function:

const char * BookmarkDB::GetBookmarkName ( uint32  bookmarkID)
static

Definition at line 165 of file BookmarkDB.cpp.

References DBerror::c_str(), DBQueryResult::error, DBQueryResult::GetRow(), DBResultRow::GetText(), sDatabase, and sLog.

166 {
167  DBQueryResult res;
168  if (!sDatabase.RunQuery(res, "SELECT memo FROM bookmarks WHERE bookmarkID = %u", bookmarkID)) {
169  sLog.Error( "BookmarkDB::GetBookmarkName()", "Failed to query bookmarkID %u: %s.", bookmarkID, res.error.c_str() );
170  return nullptr;
171  }
172 
173  DBResultRow row;
174  if (!res.GetRow(row))
175  return nullptr;
176 
177  return row.GetText(0);
178 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
DBerror error
Definition: dbcore.h:69

Here is the call graph for this function:

PyRep * BookmarkDB::GetBookmarks ( uint32  ownerID)

Definition at line 79 of file BookmarkDB.cpp.

References PyList::AddItem(), DBerror::c_str(), DBQueryResult::error, DBResultRow::GetFloat(), DBResultRow::GetInt(), DBResultRow::GetInt64(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::IsNull(), PyStatic, sDatabase, PyDict::SetItemString(), and sLog.

79  {
80  DBQueryResult res;
81  if (!sDatabase.RunQuery(res,
82  "SELECT"
83  " bookmarkID,"
84  " ownerID,"
85  " itemID,"
86  " typeID,"
87  " memo,"
88  " created,"
89  " x, y, z,"
90  " locationID,"
91  " note,"
92  " creatorID,"
93  " folderID"
94  " FROM bookmarks"
95  " WHERE ownerID = %u",
96  ownerID))
97  {
98  sLog.Error( "BookmarkDB::GetBookmarks()", "Failed to query bookmarks for owner %u: %s.", ownerID, res.error.c_str() );
99  return nullptr;
100  }
101 
102  //return DBResultToCRowset(res);
103  PyList* list = new PyList();
104  DBResultRow row;
105  while (res.GetRow(row)) {
106  PyDict* dict = new PyDict();
107  dict->SetItemString("bookmarkID", new PyInt(row.GetInt(0)));
108  dict->SetItemString("ownerID", new PyInt(row.GetInt(1)));
109  dict->SetItemString("itemID", new PyInt(row.GetInt(2)));
110  dict->SetItemString("typeID", new PyInt(row.GetInt(3)));
111  dict->SetItemString("memo", new PyString(row.GetText(4)));
112  dict->SetItemString("created", new PyLong(row.GetInt64(5)));
113  dict->SetItemString("x", new PyFloat(row.GetFloat(6)));
114  dict->SetItemString("y", new PyFloat(row.GetFloat(7)));
115  dict->SetItemString("z", new PyFloat(row.GetFloat(8)));
116  dict->SetItemString("locationID", new PyInt(row.GetInt(9)));
117  if (row.IsNull(10)) {
118  dict->SetItemString("note", PyStatic.NewNone());
119  } else {
120  dict->SetItemString("note", new PyInt(row.GetInt(10)));
121  }
122  dict->SetItemString("creatorID", new PyInt(row.GetInt(11)));
123  if (row.IsNull(12) or (row.GetInt(12) == 0)) {
124  dict->SetItemString("folderID", PyStatic.NewNone());
125  } else {
126  dict->SetItemString("folderID", new PyInt(row.GetInt(12)));
127  }
128  list->AddItem(new PyObject("util.KeyVal", dict));
129  }
130 
131  return list;
132 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
Python string.
Definition: PyRep.h:430
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
Python's dictionary.
Definition: PyRep.h:719
Python floating point number.
Definition: PyRep.h:292
void AddItem(PyRep *i)
Definition: PyRep.h:701
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
bool IsNull(uint32 index) const
Definition: dbcore.h:102
DBerror error
Definition: dbcore.h:69
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

PyRep * BookmarkDB::GetBookmarksInFolder ( uint32  folderID)

Definition at line 34 of file BookmarkDB.cpp.

References PyList::AddItem(), DBerror::c_str(), DBQueryResult::error, DBResultRow::GetInt(), DBQueryResult::GetRow(), DBResultRow::IsNull(), PyStatic, sDatabase, PyDict::SetItemString(), and sLog.

35 {
36  DBQueryResult res;
37  if (!sDatabase.RunQuery(res,
38  "SELECT"
39  " bookmarkID,"
40  " folderID"
41  " FROM bookmarks"
42  " WHERE folderID = %u",
43  folderID))
44  {
45  sLog.Error( "BookmarkDB::GetBMData()", "Failed to query bookmarks for folderID %u: %s.", folderID, res.error.c_str() );
46  return nullptr;
47  }
48 
49  //return DBResultToCRowset(res);
50  PyList* list = new PyList();
51  DBResultRow row;
52  while (res.GetRow(row)) {
53  PyDict* dict = new PyDict();
54  dict->SetItemString("bookmarkID", new PyInt(row.GetInt(0)));
55  if (row.IsNull(1) or (row.GetInt(1) == 0)) {
56  dict->SetItemString("folderID", PyStatic.NewNone());
57  } else {
58  dict->SetItemString("folderID", new PyInt(row.GetInt(1)));
59  }
60  list->AddItem(new PyObject("util.KeyVal", dict));
61  }
62 
63  return list;
64 }
#define sDatabase
Definition: dbcore.h:199
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
Python's dictionary.
Definition: PyRep.h:719
void AddItem(PyRep *i)
Definition: PyRep.h:701
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
bool IsNull(uint32 index) const
Definition: dbcore.h:102
DBerror error
Definition: dbcore.h:69
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812

Here is the call graph for this function:

PyRep * BookmarkDB::GetFolders ( uint32  ownerID)

Definition at line 134 of file BookmarkDB.cpp.

References PyList::AddItem(), DBerror::c_str(), DBQueryResult::error, DBResultRow::GetInt(), DBQueryResult::GetRow(), DBResultRow::GetText(), sDatabase, PyDict::SetItemString(), and sLog.

134  {
135  DBQueryResult res;
136  if (!sDatabase.RunQuery(res,
137  "SELECT"
138  " ownerID,"
139  " folderID,"
140  " folderName,"
141  " creatorID"
142  " FROM bookmarkFolders"
143  " WHERE ownerID = %u",
144  ownerID))
145  {
146  sLog.Error( "BookmarkDB::GetFolders()", "Failed to query bookmarks for owner %u: %s.", ownerID, res.error.c_str() );
147  return nullptr;
148  }
149 
150  //return DBResultToCRowset(res);
151  PyList* list = new PyList();
152  DBResultRow row;
153  while (res.GetRow(row)) {
154  PyDict* dict = new PyDict();
155  dict->SetItemString("ownerID", new PyInt(row.GetInt(0)));
156  dict->SetItemString("folderID", new PyInt(row.GetInt(1)));
157  dict->SetItemString("folderName", new PyString(row.GetText(2)));
158  dict->SetItemString("creatorID", new PyInt(row.GetInt(3)));
159  list->AddItem(new PyObject("util.KeyVal", dict));
160  }
161 
162  return list;
163 }
#define sDatabase
Definition: dbcore.h:199
const char * GetText(uint32 index) const
Definition: dbcore.h:104
Python string.
Definition: PyRep.h:430
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
Python's dictionary.
Definition: PyRep.h:719
void AddItem(PyRep *i)
Definition: PyRep.h:701
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
const char * c_str() const
Definition: dbcore.h:48
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
DBerror error
Definition: dbcore.h:69
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812

Here is the call graph for this function:

void BookmarkDB::GetVoucherData ( BmData data)

Definition at line 383 of file BookmarkDB.cpp.

References BmData::bookmarkID, DBerror::c_str(), BmData::created, BmData::creatorID, DBQueryResult::error, BmData::folderID, DBResultRow::GetFloat(), DBResultRow::GetInt64(), DBQueryResult::GetRow(), DBResultRow::GetText(), DBResultRow::GetUInt(), DBResultRow::IsNull(), BmData::itemID, BmData::locationID, BmData::memo, BmData::note, BmData::ownerID, BmData::point, sDatabase, sLog, BmData::typeID, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

383  {
384 
385  DBQueryResult res;
386  if (!sDatabase.RunQuery(res,
387  "SELECT ownerID, itemID, typeID, memo, created, x, y, z, "
388  "locationID, note, creatorID, folderID "
389  "FROM bookmarks WHERE bookmarkID = %u", data.bookmarkID))
390  {
391  sLog.Error( "BookmarkDB::GetVoucherData()", "Failed to query data for Bookmark %u: %s.", data.bookmarkID, res.error.c_str() );
392  return;
393  }
394 
395 
396  DBResultRow row;
397  if (res.GetRow(row)) {
398  data.ownerID = row.GetUInt(0);
399  data.itemID = row.GetUInt(1);
400  data.typeID = row.GetUInt(2);
401  data.memo = row.GetText(3);
402  data.created = row.GetInt64(4);
403  data.point.x = row.GetFloat(5);
404  data.point.y = row.GetFloat(6);
405  data.point.z = row.GetFloat(7);
406  data.locationID = row.GetUInt(8);
407  if (row.IsNull(9)) {
408  data.note = "";
409  } else {
410  data.note = row.GetText(9);
411  }
412  data.creatorID = row.GetUInt(10);
413  if (row.IsNull(11)){
414  data.folderID = 0;
415  } else {
416  data.folderID = row.GetUInt(11);
417  }
418  }
419 }
#define sDatabase
Definition: dbcore.h:199
int64 created
Definition: BookmarkDB.h:51
const char * GetText(uint32 index) const
Definition: dbcore.h:104
std::string memo
Definition: BookmarkDB.h:53
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
uint32 folderID
Definition: BookmarkDB.h:49
GaFloat x
Definition: GaTypes.h:207
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
uint32 creatorID
Definition: BookmarkDB.h:50
uint32 locationID
Definition: BookmarkDB.h:48
uint32 ownerID
Definition: BookmarkDB.h:46
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
GPoint point
Definition: BookmarkDB.h:52
const char * c_str() const
Definition: dbcore.h:48
bool IsNull(uint32 index) const
Definition: dbcore.h:102
GaFloat y
Definition: GaTypes.h:207
DBerror error
Definition: dbcore.h:69
uint32 bookmarkID
Definition: BookmarkDB.h:45
uint16 typeID
Definition: BookmarkDB.h:44
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670
uint32 itemID
Definition: BookmarkDB.h:47
GaFloat z
Definition: GaTypes.h:207
std::string note
Definition: BookmarkDB.h:54

Here is the call graph for this function:

void BookmarkDB::MoveBookmarkToFolder ( int32  folderID,
std::vector< int32 > *  bookmarkList 
)

Definition at line 369 of file BookmarkDB.cpp.

References DBerror::c_str(), and sDatabase.

370 {
371  std::stringstream st;
372  std::size_t size = bookmarkList->size();
373  for (int8 i=0; i<size; ++i) {
374  st << bookmarkList->at(i);
375  if (i < (size-1))
376  st << ", ";
377  }
378 
379  DBerror err;
380  sDatabase.RunQuery(err, "UPDATE bookmarks SET folderID = %i WHERE bookmarkID IN (%s)", folderID, st.str().c_str());
381 }
#define sDatabase
Definition: dbcore.h:199
signed __int8 int8
Definition: eve-compat.h:45
const char * c_str() const
Definition: dbcore.h:48
Definition: dbcore.h:39

Here is the call graph for this function:

void BookmarkDB::SaveNewBookmark ( BmData data)

Definition at line 236 of file BookmarkDB.cpp.

References BmData::bookmarkID, DBerror::c_str(), BmData::creatorID, BmData::folderID, GetFileTimeNow(), BmData::itemID, BmData::locationID, BmData::memo, BmData::note, BmData::ownerID, BmData::point, sDatabase, sLog, BmData::typeID, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

237 {
238  std::string eMemo, eNote;
239  sDatabase.DoEscapeString(eMemo, data.memo.c_str());
240  sDatabase.DoEscapeString(eNote, data.note.c_str());
241 
242  DBerror err;
243  if (data.folderID > 0) {
244  if (!sDatabase.RunQueryLID(err, data.bookmarkID,
245  "INSERT INTO bookmarks"
246  " (ownerID, itemID, typeID, memo, created, x, y, z, locationID, note, creatorID, folderID)"
247  " VALUES (%u, %u, %u, '%s', %f, %f, %f, %f, %u, '%s', %u, %u) ",
248  data.ownerID, data.itemID, data.typeID, eMemo.c_str(), GetFileTimeNow(), data.point.x, data.point.y,
249  data.point.z, data.locationID, eNote.c_str(), data.creatorID, data.folderID ))
250  {
251  sLog.Error( "BookmarkDB::SaveNewBookmarkToDatabase(1)", "Error in query, Bookmark content couldn't be saved: %s", err.c_str() );
252  }
253  } else {
254  if (!sDatabase.RunQueryLID(err, data.bookmarkID,
255  "INSERT INTO bookmarks"
256  " (ownerID, itemID, typeID, memo, created, x, y, z, locationID, note, creatorID)"
257  " VALUES (%u, %u, %u, '%s', %f, %f, %f, %f, %u, '%s', %u) ",
258  data.ownerID, data.itemID, data.typeID, eMemo.c_str(), GetFileTimeNow(), data.point.x, data.point.y,
259  data.point.z, data.locationID, eNote.c_str(), data.creatorID ))
260  {
261  sLog.Error( "BookmarkDB::SaveNewBookmarkToDatabase(2)", "Error in query, Bookmark content couldn't be saved: %s", err.c_str() );
262  }
263  }
264 }
#define sDatabase
Definition: dbcore.h:199
std::string memo
Definition: BookmarkDB.h:53
uint32 folderID
Definition: BookmarkDB.h:49
GaFloat x
Definition: GaTypes.h:207
uint32 creatorID
Definition: BookmarkDB.h:50
uint32 locationID
Definition: BookmarkDB.h:48
uint32 ownerID
Definition: BookmarkDB.h:46
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
GPoint point
Definition: BookmarkDB.h:52
const char * c_str() const
Definition: dbcore.h:48
GaFloat y
Definition: GaTypes.h:207
double GetFileTimeNow()
Definition: utils_time.cpp:84
uint32 bookmarkID
Definition: BookmarkDB.h:45
uint16 typeID
Definition: BookmarkDB.h:44
uint32 itemID
Definition: BookmarkDB.h:47
Definition: dbcore.h:39
GaFloat z
Definition: GaTypes.h:207
std::string note
Definition: BookmarkDB.h:54

Here is the call graph for this function:

uint32 BookmarkDB::SaveNewFolder ( std::string  folderName,
uint32  ownerID 
)

Definition at line 323 of file BookmarkDB.cpp.

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

324 {
325  uint32 folderID(0);
326  std::string eName = "";
327  sDatabase.DoEscapeString( eName, folderName.c_str());
328 
329  DBerror err;
330  if (!sDatabase.RunQueryLID(err, folderID, "INSERT INTO bookmarkFolders (folderName, ownerID, creatorID) VALUES ('%s', %u, %u) ",
331  eName.c_str(), ownerID, ownerID ))
332  {
333  sLog.Error( "BookmarkDB::SaveNewFolderToDatabase()", "Error in query, Folder couldn't be saved: %s", err.c_str() );
334  return 0;
335  }
336 
337  return folderID;
338 }
#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
unsigned __int32 uint32
Definition: eve-compat.h:50
Definition: dbcore.h:39

Here is the call graph for this function:

bool BookmarkDB::UpdateBookmark ( uint32  bookmarkID,
uint32  ownerID,
std::string  memo,
std::string  note,
uint32  folderID = 0 
)

Definition at line 307 of file BookmarkDB.cpp.

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

308 {
309  std::string memo_fixed = "";
310  sDatabase.DoEscapeString(memo_fixed, memo.c_str());
311 
312  DBerror err;
313  if (!sDatabase.RunQuery(err, "UPDATE bookmarks SET memo = '%s', note = '%s', folderID = %u WHERE bookmarkID = %u AND ownerID = %u",
314  memo_fixed.c_str(), note.c_str(), folderID, bookmarkID, ownerID))
315  {
316  sLog.Error( "BookmarkDB::UpdateBookmarkInDatabase()", "Error in query: %s", err.c_str() );
317  return false;
318  }
319 
320  return true;
321 }
#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
Definition: dbcore.h:39

Here is the call graph for this function:

bool BookmarkDB::UpdateFolder ( int32  folderID,
std::string  folderName 
)

Definition at line 340 of file BookmarkDB.cpp.

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

341 {
342  std::string eName = "";
343  sDatabase.DoEscapeString( eName, folderName.c_str());
344 
345  DBerror err;
346  if (!sDatabase.RunQuery(err, "UPDATE bookmarkFolders SET folderName = '%s' WHERE folderID = %u",
347  eName.c_str(), folderID))
348  {
349  sLog.Error( "BookmarkDB::UpdateFolder()", "Error in query, Folder couldn't be saved: %s", err.c_str() );
350  return false;
351  }
352 
353  return true;
354 }
#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
Definition: dbcore.h:39

Here is the call graph for this function:


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