diff options
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.h')
-rwxr-xr-x | src/server/shared/Database/MySQLConnection.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h index 9cc57000171..6b740c1734a 100755 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -68,14 +68,18 @@ struct PreparedStatementTable ConnectionFlags type; }; +typedef std::map<uint32 /*index*/, std::pair<const char* /*query*/, ConnectionFlags /*sync/async*/>> PreparedStatementMap; + +#define PREPARE_STATEMENT(a, b, c) m_queries[a] = std::make_pair(strdup(b), c); + class MySQLConnection { template <class T> friend class DatabaseWorkerPool; friend class PingOperation; public: - MySQLConnection(MySQLConnectionInfo& connInfo); //! Constructor for synchroneous connections. - MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInfo& connInfo); //! Constructor for asynchroneous connections. + MySQLConnection(MySQLConnectionInfo& connInfo); //! Constructor for synchronous connections. + MySQLConnection(ACE_Activation_Queue* queue, MySQLConnectionInfo& connInfo); //! Constructor for asynchronous connections. ~MySQLConnection(); virtual bool Open(); @@ -118,15 +122,15 @@ class MySQLConnection void PrepareStatement(uint32 index, const char* sql, ConnectionFlags flags); protected: - std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage - PreparedStatementTable const * m_statementTable; //! Static index/query pairs - bool m_reconnecting; //! Are we reconnecting? - + std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage + PreparedStatementMap m_queries; //! Query storage + bool m_reconnecting; //! Are we reconnecting? + private: bool _HandleMySQLErrno(uint32 errNo); private: - ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections. + ACE_Activation_Queue* m_queue; //! Queue shared with other asynchronous connections. DatabaseWorker* m_worker; //! Core worker task. MYSQL * m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) |