From 57f85ab7da3c1759a0cef3bd0497253c54bf1218 Mon Sep 17 00:00:00 2001 From: leak Date: Wed, 26 Jan 2011 00:41:55 +0100 Subject: Core/DBLayer: Replace prepared statement arrays with a map to avoid asynchronous indexes at query logging or error output - Add values to prepared statement query log messages - Killed a bit Engrish and trailing white whitespaces --- src/server/shared/Database/MySQLConnection.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/server/shared/Database/MySQLConnection.h') 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> PreparedStatementMap; + +#define PREPARE_STATEMENT(a, b, c) m_queries[a] = std::make_pair(strdup(b), c); + class MySQLConnection { template 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 m_stmts; //! PreparedStatements storage - PreparedStatementTable const * m_statementTable; //! Static index/query pairs - bool m_reconnecting; //! Are we reconnecting? - + std::vector 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) -- cgit v1.2.3