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 <thiago.macieira@intel.com>
(cherry picked from commit 5bc61ec5d028d57640b9c4cd515ed7dfebac945c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2023-02-12 17:09:20 +01:00 committed by Qt Cherry-pick Bot
parent 091160a9af
commit e4ef4fd3a6

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