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.

Pick-to: 5.15 6.2 6.4 6.5
Fixes: QTBUG-109832
Change-Id: I935edb14495d162ed58109610946b2805d37bbc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Christian Ehrlicher 2023-02-12 17:09:20 +01:00
parent b73574c4a6
commit 5bc61ec5d0

View File

@ -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));