diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-11-01 16:21:14 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-11-01 16:21:14 +0100 |
commit | c3a9d56b56b665133707f587ecb1bd1c272f6911 (patch) | |
tree | 02dfce1fa605569e3212fbe8804125d55957d7bf /src/server/database/Database/MySQLConnection.h | |
parent | 2072258ef44e89e30256d529686ae2b8dc2b5f0d (diff) |
Core/DBLayer: Support using mysql 8
Diffstat (limited to 'src/server/database/Database/MySQLConnection.h')
-rw-r--r-- | src/server/database/Database/MySQLConnection.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/server/database/Database/MySQLConnection.h b/src/server/database/Database/MySQLConnection.h index ea9ce7eb46f..0340d7e62c4 100644 --- a/src/server/database/Database/MySQLConnection.h +++ b/src/server/database/Database/MySQLConnection.h @@ -66,19 +66,18 @@ class TC_DATABASE_API MySQLConnection bool PrepareStatements(); - public: bool Execute(const char* sql); bool Execute(PreparedStatementBase* stmt); ResultSet* Query(const char* sql); PreparedResultSet* Query(PreparedStatementBase* stmt); - bool _Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD **pFields, uint64* pRowCount, uint32* pFieldCount); - bool _Query(PreparedStatementBase* stmt, MYSQL_RES **pResult, uint64* pRowCount, uint32* pFieldCount); + bool _Query(const char* sql, MySQLResult** pResult, MySQLField** pFields, uint64* pRowCount, uint32* pFieldCount); + bool _Query(PreparedStatementBase* stmt, MySQLResult** pResult, uint64* pRowCount, uint32* pFieldCount); void BeginTransaction(); void RollbackTransaction(); void CommitTransaction(); int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction); - + size_t EscapeString(char* to, const char* from, size_t length); void Ping(); uint32 GetLastError(); @@ -91,13 +90,12 @@ class TC_DATABASE_API MySQLConnection /// Called by parent databasepool. Will let other threads access this connection void Unlock(); - MYSQL* GetHandle() { return m_Mysql; } + uint32 GetServerVersion() const; MySQLPreparedStatement* GetPreparedStatement(uint32 index); void PrepareStatement(uint32 index, std::string const& sql, ConnectionFlags flags); virtual void DoPrepareStatements() = 0; - protected: typedef std::vector<std::unique_ptr<MySQLPreparedStatement>> PreparedStatementContainer; PreparedStatementContainer m_stmts; //! PreparedStatements storage @@ -107,10 +105,9 @@ class TC_DATABASE_API MySQLConnection private: bool _HandleMySQLErrno(uint32 errNo, uint8 attempts = 5); - private: ProducerConsumerQueue<SQLOperation*>* m_queue; //! Queue shared with other asynchronous connections. std::unique_ptr<DatabaseWorker> m_worker; //! Core worker task. - MYSQL* m_Mysql; //! MySQL Handle. + MySQLHandle* m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements) std::mutex m_Mutex; |