aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-04-08 09:44:52 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-01 01:10:25 +0100
commit3b4a2a0a94b748478fafec155a343afa8f652fb5 (patch)
tree5ae61ebcb6bce23b57e9d1b1cbb69dfd2fc73c92 /src
parent321bc3ccfa0c21267bb726efb82a1e4f1f0fc31f (diff)
Core/DBLayer: Fix compilation with mysql 8
(cherry picked from commit 579d41acc5ca3af9900b546dc3e910a595cee066)
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/MySQLConnection.cpp13
1 files changed, 11 insertions, 2 deletions
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<MySQLHandle*>(mysql_real_connect(mysqlInit, m_connectionInfo.host.c_str(), m_connectionInfo.user.c_str(),