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>
This commit is contained in:
parent
947704cefe
commit
b3f94eba6d
@ -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" }
|
||||
]
|
||||
},
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user