From e4ef4fd3a636505b728ab8fcdc8f239264e4f32e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 12 Feb 2023 17:09:20 +0100 Subject: [PATCH] ODBC/MySQL: fix compilation with MySQL < 5.7.9 MYSQL_TYPE_JSON was introduced in MySQL 5.7.9 but our documentation states that we still support 5.6 so we have to define this value by ourself for the older versions. Fixes: QTBUG-109832 Change-Id: I935edb14495d162ed58109610946b2805d37bbc4 Reviewed-by: Thiago Macieira (cherry picked from commit 5bc61ec5d028d57640b9c4cd515ed7dfebac945c) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index b00fd5b6fdc..615f7ce4ca7 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp @@ -29,6 +29,11 @@ Q_DECLARE_METATYPE(MYSQL_RES*) Q_DECLARE_METATYPE(MYSQL*) Q_DECLARE_METATYPE(MYSQL_STMT*) +// MYSQL_TYPE_JSON was introduced with MySQL 5.7.9 +#if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID < 50709 +#define MYSQL_TYPE_JSON 245 +#endif + // MySQL above version 8 removed my_bool typedef while MariaDB kept it, // by redefining it we can regain source compatibility. using my_bool = decltype(mysql_stmt_bind_result(nullptr, nullptr));