Core/DBLayer: Support using mysql 8

This commit is contained in:
Shauren authored and Ovahlord committed 2020-04-15 10:19:24 +02:00
1 parent 26e5823913
commit 5653d4e2de
24 files changed
+510 -378

No files matched your search

@@ -24,6 +24,7 @@
#include "Implementation/CharacterDatabase.h"
#include "Implementation/HotfixDatabase.h"
#include "Log.h"
#include "MySQLPreparedStatement.h"
#include "PreparedStatement.h"
#include "ProducerConsumerQueue.h"
#include "QueryCallback.h"
@@ -31,10 +32,7 @@
#include "QueryResult.h"
#include "SQLOperation.h"
#include "Transaction.h"
#ifdef _WIN32 // hack for broken mysql.h not including the correct winsock header for SOCKET definition, fixed in 5.7
#include <winsock2.h>
#endif
#include <mysql.h>
#include "MySQLWorkaround.h"
#include <mysqld_error.h>
#define MIN_MYSQL_SERVER_VERSION 50100u
@@ -356,7 +354,7 @@ uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConne
_connections[type].clear();
return error;
}
else if (mysql_get_server_version(connection->GetHandle()) < MIN_MYSQL_SERVER_VERSION)
else if (connection->GetServerVersion() < MIN_MYSQL_SERVER_VERSION)
{
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below 5.1");
return 1;
@@ -377,8 +375,7 @@ unsigned long DatabaseWorkerPool<T>::EscapeString(char* to, char const* from, un
if (!to || !from || !length)
return 0;
return mysql_real_escape_string(
_connections[IDX_SYNCH].front()->GetHandle(), to, from, length);
return _connections[IDX_SYNCH].front()->EscapeString(to, from, length);
}
template <class T>