aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database/MySQLConnection.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-09-27 00:20:56 +0200
committerMachiavelli <none@none>2010-09-27 00:20:56 +0200
commita9e9a2c8848c22e4a3e3b7bab0caeca25d9ea408 (patch)
treea7c4960796d0a9a42cb1e0252d4a75c4436d1f01 /src/server/shared/Database/MySQLConnection.cpp
parent894b2081b3837575bd44c71ea4ebc76008b5b5e3 (diff)
Core/DBLayer:
- DB Threading model update * Get rid of ThreadBundleMask and bundled connection * Implement configurable amount of Synch threads for databasepools * Use modulus based algorithm to check for free synchronous connections instead of previous ¨get connection by thread key or bundlemask¨ feature * Locks on mysql context objects are now managed outside the mysql query methods Fixes issue #4058 Fixes issue #4059 Introduces a ton of more issues. Use at own risk. You were warned. Really. Don´t forget to update your worldserver.conf --HG-- branch : trunk
Diffstat (limited to 'src/server/shared/Database/MySQLConnection.cpp')
-rw-r--r--src/server/shared/Database/MySQLConnection.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index f3fa2f352da..83d95268e1a 100644
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -49,11 +49,20 @@ m_Mysql(NULL)
MySQLConnection::~MySQLConnection()
{
+ ASSERT (m_Mysql); /// MySQL context must be present at this point
+
+ sLog.outSQLDriver("MySQLConnection::~MySQLConnection()");
for (size_t i = 0; i < m_stmts.size(); ++i)
delete m_stmts[i];
- MySQL::Thread_End();
mysql_close(m_Mysql);
+ Unlock(); /// Unlock while we die, how ironic
+}
+
+void MySQLConnection::Close()
+{
+ /// Only close us if we're not operating
+ delete this;
}
bool MySQLConnection::Open(const std::string& infoString)
@@ -163,9 +172,6 @@ bool MySQLConnection::Execute(const char* sql)
return false;
{
- // guarded block for thread-safe mySQL request
- ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex);
-
#ifdef SQLQUERY_LOG
uint32 _s = getMSTime();
#endif
@@ -193,9 +199,6 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
uint32 index = stmt->m_index;
{
- // guarded block for thread-safe mySQL request
- ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex);
-
MySQLPreparedStatement* m_mStmt = GetPreparedStatement(index);
ASSERT(m_mStmt); // Can only be null if preparation failed, server side error or bad query
m_mStmt->m_stmt = stmt; // Cross reference them for debug output
@@ -238,9 +241,6 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, MYSQL
uint32 index = stmt->m_index;
{
- // guarded block for thread-safe mySQL request
- ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex);
-
MySQLPreparedStatement* m_mStmt = GetPreparedStatement(index);
ASSERT(m_mStmt); // Can only be null if preparation failed, server side error or bad query
m_mStmt->m_stmt = stmt; // Cross reference them for debug output
@@ -304,8 +304,6 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD *
return false;
{
- // guarded block for thread-safe mySQL request
- ACE_Guard<ACE_Thread_Mutex> query_connection_guard(m_Mutex);
#ifdef SQLQUERY_LOG
uint32 _s = getMSTime();
#endif