Backport mysql driver mariadb fix - see QTBUG-63108

[taken from RedHat Qt3 patches]

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit f3c643afc1)
r14.0.x
Slávek Banko 7 years ago
parent fbe685b96f
commit 436c783573

@ -350,30 +350,40 @@ int QMYSQLResult::numRowsAffected()
static void qServerEnd() static void qServerEnd()
{ {
#ifndef Q_NO_MYSQL_EMBEDDED #ifndef Q_NO_MYSQL_EMBEDDED
# if MYSQL_VERSION_ID >= 40000 #if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
# if MYSQL_VERSION_ID > 40000
# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
mysql_library_end();
# else
mysql_server_end(); mysql_server_end();
# endif // MYSQL_VERSION_ID # endif
#endif // Q_NO_MYSQL_EMBEDDED # endif
#endif
#endif
} }
static void qServerInit() static void qServerInit()
{ {
#ifndef Q_NO_MYSQL_EMBEDDED #ifndef Q_NO_MYSQL_EMBEDDED
# if MYSQL_VERSION_ID >= 40000 # if MYSQL_VERSION_ID >= 40000
if ( qMySqlInitHandledByUser || qMySqlConnectionCount > 1 ) if (qMySqlInitHandledByUser || qMySqlConnectionCount > 1)
return; return;
// this should only be called once if (
// has no effect on client/server library # if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
// but is vital for the embedded lib mysql_library_init(0, 0, 0)
if ( mysql_server_init( 0, 0, 0 ) ) { # else
# ifdef QT_CHECK_RANGE mysql_server_init(0, 0, 0)
qWarning( "QMYSQLDriver::qServerInit: unable to start server." );
# endif # endif
) {
qWarning("QMYSQLDriver::qServerInit: unable to start server.");
} }
# endif // MYSQL_VERSION_ID # endif // MYSQL_VERSION_ID
#endif // Q_NO_MYSQL_EMBEDDED #endif // Q_NO_MYSQL_EMBEDDED
#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID)
qAddPostRoutine(mysql_server_end);
#endif
} }
QMYSQLDriver::QMYSQLDriver( QObject * parent, const char * name ) QMYSQLDriver::QMYSQLDriver( QObject * parent, const char * name )

Loading…
Cancel
Save