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 {/lib/libmysql.dll} \li \c {/include/mysql.h} \endlist + and for MariaDB + \list + \li \c {/lib/libmariadb.lib} + \li \c {/lib/libmariadb.dll} + \li \c {/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