diff options
author | Machiavelli <none@none> | 2010-12-17 15:55:16 +0100 |
---|---|---|
committer | Machiavelli <none@none> | 2010-12-17 15:55:16 +0100 |
commit | cb08ec0d74c4c935457e4df2cc480a7b55387b18 (patch) | |
tree | 711305f2e9c8e0831a7fff8e0c28a4206a5c9651 /src/server/shared/Database/MySQLConnection.h | |
parent | 57d72fa708373b5db88d62190dac939cdfaea824 (diff) |
Core/DBLayer: Don´t prepare asynchronous statements on synchronous connections and vice versa. Prevents allocating RAM that will never be used.
--HG--
branch : trunk
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.h')
-rwxr-xr-x | src/server/shared/Database/MySQLConnection.h | 11 |
1 files changed, 9 insertions, 2 deletions
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<MySQLPreparedStatement*> 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; }; |