From 11e1f4af6046cf3c8729cf31e24c605650b71d06 Mon Sep 17 00:00:00 2001 From: Naios Date: Sat, 28 Mar 2015 16:03:41 +0100 Subject: Core/Database Improve commit 39bdd06446dc * found a better way where no cast is needed. * ref #14430 (cherry picked from commit 54ee5267244acac16e4b56342e64c0235ee0599b) --- src/server/shared/Database/MySQLConnection.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/shared/Database/MySQLConnection.cpp') diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index bea0b934eb9..5a98757abb5 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -137,9 +137,7 @@ uint32 MySQLConnection::Open() // set connection properties to UTF8 to properly handle locales for different // server configs - core sends data in UTF8, so MySQL must expect UTF8 too mysql_set_character_set(m_Mysql, "utf8"); - - // Prepare statements only at reconnect - return m_reconnecting ? static_cast(PrepareStatements()) : 0; + return 0; } else { @@ -493,7 +491,9 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) m_reconnecting = true; uint64 oldThreadId = mysql_thread_id(GetHandle()); mysql_close(GetHandle()); - if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... + + // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... + if (this->Open() && this->PrepareStatements()) { TC_LOG_INFO("sql.sql", "Connection to the MySQL server is active."); if (oldThreadId != mysql_thread_id(GetHandle())) -- cgit v1.2.3