mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/Database: Refactor MySQLConnection constructors and async thread creation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user