feat(Core/Database): move MySQL handle and HandleMySQLErrno to protected (#14673)
* feat(Core/Database): move MySQL handle and HandleMySQLErrno to protected * fix: initialization order
This commit is contained in:
@@ -51,16 +51,16 @@ MySQLConnectionInfo::MySQLConnectionInfo(std::string_view infoString)
|
|||||||
MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) :
|
MySQLConnection::MySQLConnection(MySQLConnectionInfo& connInfo) :
|
||||||
m_reconnecting(false),
|
m_reconnecting(false),
|
||||||
m_prepareError(false),
|
m_prepareError(false),
|
||||||
m_queue(nullptr),
|
|
||||||
m_Mysql(nullptr),
|
m_Mysql(nullptr),
|
||||||
|
m_queue(nullptr),
|
||||||
m_connectionInfo(connInfo),
|
m_connectionInfo(connInfo),
|
||||||
m_connectionFlags(CONNECTION_SYNCH) { }
|
m_connectionFlags(CONNECTION_SYNCH) { }
|
||||||
|
|
||||||
MySQLConnection::MySQLConnection(ProducerConsumerQueue<SQLOperation*>* queue, MySQLConnectionInfo& connInfo) :
|
MySQLConnection::MySQLConnection(ProducerConsumerQueue<SQLOperation*>* queue, MySQLConnectionInfo& connInfo) :
|
||||||
m_reconnecting(false),
|
m_reconnecting(false),
|
||||||
m_prepareError(false),
|
m_prepareError(false),
|
||||||
m_queue(queue),
|
|
||||||
m_Mysql(nullptr),
|
m_Mysql(nullptr),
|
||||||
|
m_queue(queue),
|
||||||
m_connectionInfo(connInfo),
|
m_connectionInfo(connInfo),
|
||||||
m_connectionFlags(CONNECTION_ASYNC)
|
m_connectionFlags(CONNECTION_ASYNC)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,19 +98,18 @@ protected:
|
|||||||
void PrepareStatement(uint32 index, std::string_view sql, ConnectionFlags flags);
|
void PrepareStatement(uint32 index, std::string_view sql, ConnectionFlags flags);
|
||||||
|
|
||||||
virtual void DoPrepareStatements() = 0;
|
virtual void DoPrepareStatements() = 0;
|
||||||
|
virtual bool _HandleMySQLErrno(uint32 errNo, uint8 attempts = 5);
|
||||||
|
|
||||||
typedef std::vector<std::unique_ptr<MySQLPreparedStatement>> PreparedStatementContainer;
|
typedef std::vector<std::unique_ptr<MySQLPreparedStatement>> PreparedStatementContainer;
|
||||||
|
|
||||||
PreparedStatementContainer m_stmts; //! PreparedStatements storage
|
PreparedStatementContainer m_stmts; //! PreparedStatements storage
|
||||||
bool m_reconnecting; //! Are we reconnecting?
|
bool m_reconnecting; //! Are we reconnecting?
|
||||||
bool m_prepareError; //! Was there any error while preparing statements?
|
bool m_prepareError; //! Was there any error while preparing statements?
|
||||||
|
MySQLHandle* m_Mysql; //! MySQL Handle.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _HandleMySQLErrno(uint32 errNo, uint8 attempts = 5);
|
|
||||||
|
|
||||||
ProducerConsumerQueue<SQLOperation*>* m_queue; //! Queue shared with other asynchronous connections.
|
ProducerConsumerQueue<SQLOperation*>* m_queue; //! Queue shared with other asynchronous connections.
|
||||||
std::unique_ptr<DatabaseWorker> m_worker; //! Core worker task.
|
std::unique_ptr<DatabaseWorker> m_worker; //! Core worker task.
|
||||||
MySQLHandle* m_Mysql; //! MySQL Handle.
|
|
||||||
MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging)
|
MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging)
|
||||||
ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements)
|
ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements)
|
||||||
std::mutex m_Mutex;
|
std::mutex m_Mutex;
|
||||||
|
|||||||
Reference in New Issue
Block a user