SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GameDBSyncContext.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 #include <memory>
10 class QSqlDatabase;
11 class QSqlQuery;
12 
13 struct CharacterUpdateData;
14 struct CostumeUpdateData;
25 
30 {
31  static constexpr int required_db_version = 6;
32  std::unique_ptr<QSqlDatabase> m_db;
33  std::unique_ptr<QSqlQuery> m_prepared_char_update;
34  std::unique_ptr<QSqlQuery> m_prepared_costume_update;
35  std::unique_ptr<QSqlQuery> m_prepared_account_select;
36  std::unique_ptr<QSqlQuery> m_prepared_account_insert;
37  std::unique_ptr<QSqlQuery> m_prepared_entity_select;
38  std::unique_ptr<QSqlQuery> m_prepared_get_char_slots;
39  std::unique_ptr<QSqlQuery> m_prepared_char_insert;
40  std::unique_ptr<QSqlQuery> m_prepared_char_exists;
41  std::unique_ptr<QSqlQuery> m_prepared_char_delete;
42  std::unique_ptr<QSqlQuery> m_prepared_char_select;
43  std::unique_ptr<QSqlQuery> m_prepared_options_update;
44  std::unique_ptr<QSqlQuery> m_prepared_fill;
45  std::unique_ptr<QSqlQuery> m_prepared_costume_insert;
46 
47  bool m_setup_complete = false;
48 public:
51  bool loadAndConfigure();
52  bool performUpdate(const CharacterUpdateData &data);
53  bool performUpdate(const CostumeUpdateData &data);
58  bool getEntity(const GetEntityRequestData&data, GetEntityResponseData &result);
59  bool updateClientOptions(const SetClientOptionsData &data);
60 private:
61  int64_t getDbVersion(QSqlDatabase &);
62 };
Definition: GameDBSyncEvents.h:242
bool updateClientOptions(const SetClientOptionsData &data)
Definition: GameDBSyncContext.cpp:378
Definition: GameDBSyncEvents.h:90
bool createNewChar(const CreateNewCharacterRequestData &data, CreateNewCharacterResponseData &result)
Definition: GameDBSyncContext.cpp:301
bool getAccount(const GameAccountRequestData &data, GameAccountResponseData &result)
Definition: GameDBSyncContext.cpp:200
Definition: GameDBSyncEvents.h:225
The DbSyncContext class is used as thread local storage for database related objects.
Definition: GameDBSyncContext.h:29
Definition: GameDBSyncEvents.h:218
Definition: GameDBSyncEvents.h:99
Definition: GameDBSyncEvents.h:230
Definition: GameDBSyncEvents.h:172
Definition: GameDBSyncEvents.h:111
bool performUpdate(const CharacterUpdateData &data)
Definition: GameDBSyncContext.cpp:177
bool loadAndConfigure()
Definition: GameDBSyncContext.cpp:70
bool getEntity(const GetEntityRequestData &data, GetEntityResponseData &result)
Definition: GameDBSyncContext.cpp:365
Definition: GameDBSyncEvents.h:213
bool checkNameClash(const WouldNameDuplicateRequestData &data, WouldNameDuplicateResponseData &result)
Definition: GameDBSyncContext.cpp:289
Definition: GameDBSyncEvents.h:74
Definition: GameDBSyncEvents.h:197
bool removeCharacter(const RemoveCharacterRequestData &data)
Definition: GameDBSyncContext.cpp:280
Definition: GameDBSyncEvents.h:206