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
This commit is contained in:
leak committed 2011-01-26 00:41:55 +01:00
1 parent 180b739483
commit 57f85ab7da
13 files changed
+371 -332

No files matched your search

+11 -7
View File
@@ -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)