diff options
author | Slávek Banko <[email protected]> | 2018-06-03 11:18:00 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2018-06-03 11:18:00 +0200 |
commit | a889f4346955fc3dcd3e3d57b84843226e361aae (patch) | |
tree | 47a7a3abfb0a76364484debb88f146faed80ff61 /src/sql/drivers/mysql/qsql_mysql.cpp | |
parent | 1de7443921ea94b5d9f1e5cb6ecfd5a9b8906a7b (diff) | |
download | tqt3-a889f4346955fc3dcd3e3d57b84843226e361aae.tar.gz tqt3-a889f4346955fc3dcd3e3d57b84843226e361aae.zip |
Backport mysql driver mariadb fix - see QTBUG-63108
[taken from RedHat Qt3 patches]
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'src/sql/drivers/mysql/qsql_mysql.cpp')
-rw-r--r-- | src/sql/drivers/mysql/qsql_mysql.cpp | 34 |
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 9d2f6c570..5178e7a79 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -350,30 +350,40 @@ int TQMYSQLResult::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 - tqWarning( "TQMYSQLDriver::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 + ) { + tqWarning("TQMYSQLDriver::qServerInit: unable to start server."); } - # endif // MYSQL_VERSION_ID #endif // Q_NO_MYSQL_EMBEDDED + +#if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID) + tqAddPostRoutine(mysql_server_end); +#endif } TQMYSQLDriver::TQMYSQLDriver( TQObject * parent, const char * name ) |