summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-06-03 11:17:53 +0200
committerSlávek Banko <slavek.banko@axis.cz>2018-06-03 11:19:16 +0200
commit436c783573bed8f1b1b5546ae63c5734ad1e9534 (patch)
treea696d013f28d38c0c7da61a0ba540f707848c3c5
parentfbe685b96f5b67e2e14bc2d805ba23e28683ea48 (diff)
downloadqt3-436c783573bed8f1b1b5546ae63c5734ad1e9534.tar.gz
qt3-436c783573bed8f1b1b5546ae63c5734ad1e9534.zip
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 f3c643afc14d102ae97bacc795f125a22a4cae16)
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 5296f71..2d84b65 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -350,30 +350,40 @@ int QMYSQLResult::numRowsAffected()
static void qServerEnd()
{
#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();
-# endif // MYSQL_VERSION_ID
-#endif // Q_NO_MYSQL_EMBEDDED
+# endif
+# endif
+#endif
+#endif
}
static void qServerInit()
{
#ifndef Q_NO_MYSQL_EMBEDDED
# if MYSQL_VERSION_ID >= 40000
- if ( qMySqlInitHandledByUser || qMySqlConnectionCount > 1 )
+ if (qMySqlInitHandledByUser || qMySqlConnectionCount > 1)
return;
- // this should only be called once
- // has no effect on client/server library
- // but is vital for the embedded lib
- if ( mysql_server_init( 0, 0, 0 ) ) {
-# ifdef QT_CHECK_RANGE
- qWarning( "QMYSQLDriver::qServerInit: unable to start server." );
-# endif
+ if (
+# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
+ mysql_library_init(0, 0, 0)
+# else
+ mysql_server_init(0, 0, 0)
+# endif
+ ) {
+ qWarning("QMYSQLDriver::qServerInit: unable to start server.");
}
-
# endif // MYSQL_VERSION_ID
#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 )