aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database/MySQLConnection.h
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-12-19 15:48:55 +0100
committerMachiavelli <none@none>2010-12-19 15:48:55 +0100
commite2a8dfffbec626186f6b93894aec1353774ed99b (patch)
tree2465d2e4f67ee3d49335c2614470d161a1f6a470 /src/server/shared/Database/MySQLConnection.h
parent14a480cb13d356e70822317df94e8fa1e7d79e84 (diff)
Core/DBLayer:
- Add generic HandleMySQLErrno() method. - Add the ability to re-execute a certain statement if errorhandler resolved the situation succesfuly. - Add support for MySQL errno´s 2006, 2013, 2048, 2055 - fixes automatic reconnection behaviour. - Cleanup in affected code NOTE: You should still be smart enough to configure your worldserver and authserver´s MaxPingTime to be lower than your MySQL´s wait_time. --HG-- branch : trunk
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.h')
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index 847e3a84633..11e94c7844e 100755
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -16,6 +16,7 @@
*/
#include <ace/Activation_Queue.h>
+
#include "DatabaseWorkerPool.h"
#include "Util.h"
@@ -88,11 +89,6 @@ class MySQLConnection
void Ping() { mysql_ping(m_Mysql); }
protected:
- MYSQL* GetHandle() { return m_Mysql; }
- MySQLPreparedStatement* GetPreparedStatement(uint32 index);
- void PrepareStatement(uint32 index, const char* sql, bool async = false);
- std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage
-
bool LockIfReady()
{
/// Tries to acquire lock. If lock is acquired by another thread
@@ -106,6 +102,17 @@ class MySQLConnection
m_Mutex.release();
}
+ MYSQL* GetHandle() { return m_Mysql; }
+ MySQLPreparedStatement* GetPreparedStatement(uint32 index);
+ void PrepareStatement(uint32 index, const char* sql, bool async = false);
+
+ protected:
+ std::vector<MySQLPreparedStatement*> m_stmts; //! PreparedStatements storage
+ bool m_reconnecting; //! Are we reconnecting?
+
+ private:
+ bool _HandleMySQLErrno(uint32 errNo);
+
private:
ACE_Activation_Queue* m_queue; //! Queue shared with other asynchroneous connections.
DatabaseWorker* m_worker; //! Core worker task.