fix(db): MariaDB 10.6+ server and connector compatibility
- Parse real MariaDB version after MySQL 5.5.5 compatibility prefix for DatabaseIncompatibleVersion checks. - Relax client checks when building against MariaDB C connector (MARIADB_VERSION_ID); keep Oracle MySQL 8.0+ rules otherwise. - Use mysql_stmt_bind_param on MariaDB; mysql_stmt_bind_named_param only for MySQL 8.3+ without MariaDB headers. - SSL: MYSQL_OPT_SSL_ENFORCE on MariaDB connector, MYSQL_OPT_SSL_MODE elsewhere. - Track custom_script_loader.cpp so static script link succeeds; CMake find_package(MySQL) requires COMPONENTS lib on CMake 3.16.
This commit is contained in:
@@ -129,13 +129,17 @@ uint32 MySQLConnection::Open()
|
||||
|
||||
if (m_connectionInfo.ssl != "")
|
||||
{
|
||||
#ifdef MARIADB_VERSION_ID
|
||||
my_bool const ssl_enforce = (m_connectionInfo.ssl == "ssl") ? 1 : 0;
|
||||
if (ssl_enforce)
|
||||
mysql_options(mysqlInit, MYSQL_OPT_SSL_ENFORCE, &ssl_enforce);
|
||||
#else
|
||||
mysql_ssl_mode opt_use_ssl = SSL_MODE_DISABLED;
|
||||
if (m_connectionInfo.ssl == "ssl")
|
||||
{
|
||||
opt_use_ssl = SSL_MODE_REQUIRED;
|
||||
}
|
||||
|
||||
mysql_options(mysqlInit, MYSQL_OPT_SSL_MODE, (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(),
|
||||
@@ -216,7 +220,7 @@ bool MySQLConnection::Execute(PreparedStatementBase* stmt)
|
||||
|
||||
uint32 _s = getMSTime();
|
||||
|
||||
#if MYSQL_VERSION_ID >= 80300
|
||||
#if MYSQL_VERSION_ID >= 80300 && !defined(MARIADB_VERSION_ID)
|
||||
if (mysql_stmt_bind_named_param(msql_STMT, msql_BIND, m_mStmt->GetParameterCount(), nullptr))
|
||||
#else
|
||||
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
|
||||
@@ -268,7 +272,7 @@ bool MySQLConnection::_Query(PreparedStatementBase* stmt, MySQLPreparedStatement
|
||||
|
||||
uint32 _s = getMSTime();
|
||||
|
||||
#if MYSQL_VERSION_ID >= 80300
|
||||
#if MYSQL_VERSION_ID >= 80300 && !defined(MARIADB_VERSION_ID)
|
||||
if (mysql_stmt_bind_named_param(msql_STMT, msql_BIND, m_mStmt->GetParameterCount(), nullptr))
|
||||
#else
|
||||
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
|
||||
|
||||
Reference in New Issue
Block a user