diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-12-14 17:00:58 +0100 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2023-12-19 14:09:02 +0100 |
commit | 31d79bae9c6dc80818c69505999484b310fe82c3 (patch) | |
tree | 7ffee1fb39188f6242e96961fa5990d7935f44da /src/server/database/Database/MySQLConnection.h | |
parent | 1d7d2e99f12de089e82b4eed3c4ae4ed25229dd4 (diff) |
Core/Database: Refactor MySQLConnection constructors and async thread creation
(cherry picked from commit 5c59e2a248c9b2132f4e863de56c981cfa83ec0b)
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) |