From cb08ec0d74c4c935457e4df2cc480a7b55387b18 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Fri, 17 Dec 2010 15:55:16 +0100 Subject: Core/DBLayer: Don“t prepare asynchronous statements on synchronous connections and vice versa. Prevents allocating RAM that will never be used. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : trunk --- src/server/shared/Database/MySQLConnection.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 56a670d07c1..847e3a84633 100755 --- a/src/server/shared/Database/MySQLConnection.h +++ b/src/server/shared/Database/MySQLConnection.h @@ -27,6 +27,12 @@ class PreparedStatement; class MySQLPreparedStatement; class PingOperation; +enum ConnectionFlags +{ + CONNECTION_ASYNC = 0x1, + CONNECTION_SYNCH = 0x2, +}; + struct MySQLConnectionInfo { MySQLConnectionInfo() {} @@ -84,7 +90,7 @@ class MySQLConnection protected: MYSQL* GetHandle() { return m_Mysql; } MySQLPreparedStatement* GetPreparedStatement(uint32 index); - void PrepareStatement(uint32 index, const char* sql); + void PrepareStatement(uint32 index, const char* sql, bool async = false); std::vector m_stmts; //! PreparedStatements storage bool LockIfReady() @@ -104,7 +110,8 @@ class MySQLConnection ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections. DatabaseWorker* m_worker; //! Core worker task. MYSQL * 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) ACE_Thread_Mutex m_Mutex; }; -- cgit v1.2.3