summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-12-30 19:42:33 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-01-03 14:55:48 +0100
commitb3f94eba6d4a329b5c64c7fb60ba33e3a8df301e (patch)
treedcf9aefbf25f015875590c134491161fa4f2ad14
parent947704cefe9e8723c8c9bb332268dcedb1ea1060 (diff)
SQL: add proper support to build QMYSQL with MariaDB client libraries
The QMYSQL plugin can also be build with the MariaDB client libraries since they are source compatible. But the MariaDB libraries could not be found on windows because the library name differs. Therefore add the correct library names and update the documentation to make clear that MariaDB is supported through the QMYSQL plugin. [ChangeLog][Sql][QMYSQL] The QMYSQL plugin can now be build with the MariaDB C connector libs on Windows. Change-Id: Id99f8be96c4179fd2321b3e61c90bb300c53bb82 Reviewed-by: Marius Kittler <mariuskittler@gmx.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r--src/plugins/sqldrivers/configure.json2
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp4
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver.qdoc2
-rw-r--r--src/sql/doc/src/sql-driver.qdoc32
4 files changed, 29 insertions, 11 deletions
diff --git a/src/plugins/sqldrivers/configure.json b/src/plugins/sqldrivers/configure.json
index cd20eef1df..28ccbeadcd 100644
--- a/src/plugins/sqldrivers/configure.json
+++ b/src/plugins/sqldrivers/configure.json
@@ -72,7 +72,9 @@
{ "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": false },
{ "type": "mysqlConfig", "query": "--libs", "cleanlibs": false },
{ "libs": "-lmysqlclient_r", "condition": "!config.win32" },
+ { "libs": "-llibmariadb", "condition": "config.win32" },
{ "libs": "-llibmysql", "condition": "config.win32" },
+ { "libs": "-lmariadb", "condition": "!config.win32" },
{ "libs": "-lmysqlclient", "condition": "!config.win32" }
]
},
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index d8d70483ef..4c6753097f 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -61,7 +61,9 @@ QMYSQLDriverPlugin::QMYSQLDriverPlugin()
QSqlDriver* QMYSQLDriverPlugin::create(const QString &name)
{
- if (name == QLatin1String("QMYSQL") || name == QLatin1String("QMYSQL3")) {
+ if (name == QLatin1String("QMYSQL") ||
+ name == QLatin1String("QMYSQL3") ||
+ name == QLatin1String("QMARIADB")) {
QMYSQLDriver* driver = new QMYSQLDriver();
return driver;
}
diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
index 12a39d80b2..b869b309b7 100644
--- a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
+++ b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
@@ -235,7 +235,7 @@ make sub-oci
//! [35]
QSqlDatabase: QPSQL driver not loaded
-QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
+QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QMARIADB QODBC QODBC3 QPSQL QPSQL7
Could not create database object
//! [35]
diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index 3a0fcfa1e7..4d6df63749 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -48,7 +48,7 @@
\header \li Driver name \li DBMS
\row \li \l{#QDB2}{QDB2} \li IBM DB2 (version 7.1 and above)
\row \li \l{#QIBASE}{QIBASE} \li Borland InterBase
- \row \li \l{#QMYSQL}{QMYSQL} \li MySQL (version 5.0 and above)
+ \row \li \l{#QMYSQL}{QMYSQL / MARIADB} \li MySQL or MariaDB (version 5.0 and above)
\row \li \l{#QOCI}{QOCI} \li Oracle Call Interface Driver
\row \li \l{#QODBC}{QODBC}
\li Open Database Connectivity (ODBC) - Microsoft SQL Server and other
@@ -123,7 +123,13 @@
\section1 Driver Specifics
\target QMYSQL
- \section2 QMYSQL for MySQL 5 and higher
+ \section2 QMYSQL for MySQL or MariaDB 5 and higher
+
+ MariaDB is a fork of MySQL intended to remain free and open-source software
+ under the GNU General Public License. MariaDB intended to maintain high
+ compatibility with MySQL, ensuring a drop-in replacement capability with
+ library binary parity and exact matching with MySQL APIs and commands.
+ Therefore the plugin for MySQL and MariaDB are combined into one Qt plugin.
\section3 QMYSQL Stored Procedure Support
@@ -158,12 +164,13 @@
\section3 How to Build the QMYSQL Plugin on Unix and \macos
- You need the MySQL header files, as well as the shared library
- \c{libmysqlclient.so}. Depending on your Linux distribution, you may
- need to install a package which is usually called "mysql-devel".
+ You need the MySQL / MariaDB header files, as well as the shared library
+ \c{libmysqlclient.so} / \c{libmariadb.so}. Depending on your Linux distribution,
+ you may need to install a package which is usually called "mysql-devel"
+ or "mariadb-devel".
- Tell \l qmake where to find the MySQL header files and shared
- libraries (here it is assumed that MySQL is installed in
+ Tell \l qmake where to find the MySQL / MariaDB header files and shared
+ libraries (here it is assumed that MySQL / MariaDB is installed in
\c{/usr/local}) and run \c{make}:
\snippet code/doc_src_sql-driver.qdoc 3
@@ -171,7 +178,8 @@
\section3 How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files (e.g.
- \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.18.0.msi}).
+ \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.18.0.msi}) or
+ \l {https://downloads.mariadb.org/connector-c/3.1.5/}{mariadb-connector-c-3.1.5-win64.msi}.
Run the installer,
select custom installation and install the MySQL C Connector
which matches your Qt installation (x86 or x64).
@@ -181,6 +189,12 @@
\li \c {<MySQL dir>/lib/libmysql.dll}
\li \c {<MySQL dir>/include/mysql.h}
\endlist
+ and for MariaDB
+ \list
+ \li \c {<MariaDB dir>/lib/libmariadb.lib}
+ \li \c {<MariaDB dir>/lib/libmariadb.dll}
+ \li \c {<MariaDB dir>/include/mysql.h}
+ \endlist
Build the plugin as follows (here it is assumed that the MySQL
C Connector is installed in
@@ -191,7 +205,7 @@
If you are not using a Microsoft compiler, replace \c nmake with \c
mingw32-make in the line above.
- When you distribute your application, remember to include libmysql.dll
+ When you distribute your application, remember to include libmysql.dll / libmariadb.dll
in your installation package. It must be placed in the same folder
as the application executable. \e libmysql.dll additionally needs the
MSVC runtime libraries which can be installed with vcredist.exe