From 3b4a2a0a94b748478fafec155a343afa8f652fb5 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 8 Apr 2020 09:44:52 +0200 Subject: Core/DBLayer: Fix compilation with mysql 8 (cherry picked from commit 579d41acc5ca3af9900b546dc3e910a595cee066) --- src/server/database/Database/MySQLConnection.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/server/database/Database/MySQLConnection.cpp') diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index acb96fa5d71..47880c329e5 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -134,12 +134,21 @@ uint32 MySQLConnection::Open() if (m_connectionInfo.ssl != "") { - my_bool opt_use_ssl = false; +#if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80000 + mysql_ssl_mode opt_use_ssl = SSL_MODE_DISABLED; if (m_connectionInfo.ssl == "ssl") { - opt_use_ssl = true; + opt_use_ssl = SSL_MODE_REQUIRED; + } + mysql_options(mysqlInit, MYSQL_OPT_SSL_MODE, (char const*)&opt_use_ssl); +#else + MySQLBool opt_use_ssl = MySQLBool(0); + if (m_connectionInfo.ssl == "ssl") + { + opt_use_ssl = MySQLBool(1); } mysql_options(mysqlInit, MYSQL_OPT_SSL_ENFORCE, (char const*)&opt_use_ssl); +#endif } m_Mysql = reinterpret_cast(mysql_real_connect(mysqlInit, m_connectionInfo.host.c_str(), m_connectionInfo.user.c_str(), -- cgit v1.2.3