diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-12-14 17:00:58 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-12-14 17:00:58 +0100 |
commit | 5c59e2a248c9b2132f4e863de56c981cfa83ec0b (patch) | |
tree | ecffd95dbf38f70f1343ae4d2cf0f45d900739fe /src/server/database/Database/MySQLConnection.h | |
parent | 685ead8642d543cd916c1b6ce477ce221a62f454 (diff) |
Core/Database: Refactor MySQLConnection constructors and async thread creation
Diffstat (limited to 'src/server/database/Database/MySQLConnection.h')
-rw-r--r-- | src/server/database/Database/MySQLConnection.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/database/Database/MySQLConnection.h b/src/server/database/Database/MySQLConnection.h index 93681834225..b6656d42d91 100644 --- a/src/server/database/Database/MySQLConnection.h +++ b/src/server/database/Database/MySQLConnection.h @@ -57,11 +57,10 @@ class TC_DATABASE_API MySQLConnection friend class PingOperation; public: - MySQLConnection(MySQLConnectionInfo& connInfo); //!< Constructor for synchronous connections. - MySQLConnection(ProducerConsumerQueue<SQLOperation*>* queue, MySQLConnectionInfo& connInfo); //!< Constructor for asynchronous connections. + MySQLConnection(MySQLConnectionInfo& connInfo, ConnectionFlags connectionFlags); virtual ~MySQLConnection(); - virtual uint32 Open(); + uint32 Open(); void Close(); bool PrepareStatements(); @@ -82,6 +81,8 @@ class TC_DATABASE_API MySQLConnection uint32 GetLastError(); + void StartDatabaseWorkerThread(ProducerConsumerQueue<SQLOperation*>* queue); + protected: /// Tries to acquire lock. If lock is acquired by another thread /// the calling parent will just try another connection @@ -105,7 +106,6 @@ class TC_DATABASE_API MySQLConnection private: bool _HandleMySQLErrno(uint32 errNo, uint8 attempts = 5); - ProducerConsumerQueue<SQLOperation*>* m_queue; //!< Queue shared with other asynchronous connections. std::unique_ptr<DatabaseWorker> m_worker; //!< Core worker task. MySQLHandle* m_Mysql; //!< MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //!< Connection info (used for logging) |