From 71fe29711fcb88adcc191f1350e13f7c2544c642 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Feb 2012 15:18:35 +0100 Subject: [PATCH] Use new plugin system for SQL drivers. Change-Id: I1d4db9ecc7e1cbca66674d13748070f4b19d5b8c Reviewed-by: Lars Knoll --- src/plugins/sqldrivers/db2/db2.json | 3 +++ src/plugins/sqldrivers/db2/db2.pro | 1 + src/plugins/sqldrivers/db2/main.cpp | 12 ++++++------ src/plugins/sqldrivers/ibase/ibase.json | 3 +++ src/plugins/sqldrivers/ibase/ibase.pro | 1 + src/plugins/sqldrivers/ibase/main.cpp | 12 ++++++------ src/plugins/sqldrivers/mysql/main.cpp | 8 +++++--- src/plugins/sqldrivers/mysql/mysql.json | 3 +++ src/plugins/sqldrivers/mysql/mysql.pro | 1 + src/plugins/sqldrivers/oci/main.cpp | 8 +++++--- src/plugins/sqldrivers/oci/oci.json | 3 +++ src/plugins/sqldrivers/oci/oci.pro | 1 + src/plugins/sqldrivers/odbc/main.cpp | 8 +++++--- src/plugins/sqldrivers/odbc/odbc.json | 3 +++ src/plugins/sqldrivers/odbc/odbc.pro | 1 + src/plugins/sqldrivers/psql/main.cpp | 8 +++++--- src/plugins/sqldrivers/psql/psql.json | 3 +++ src/plugins/sqldrivers/psql/psql.pro | 1 + src/plugins/sqldrivers/sqlite/smain.cpp | 12 ++++++------ src/plugins/sqldrivers/sqlite/sqlite.json | 3 +++ src/plugins/sqldrivers/sqlite/sqlite.pro | 1 + src/plugins/sqldrivers/sqlite2/smain.cpp | 12 ++++++------ src/plugins/sqldrivers/sqlite2/sqlite2.json | 3 +++ src/plugins/sqldrivers/sqlite2/sqlite2.pro | 1 + src/plugins/sqldrivers/tds/main.cpp | 8 +++++--- src/plugins/sqldrivers/tds/tds.json | 3 +++ src/plugins/sqldrivers/tds/tds.pro | 1 + 27 files changed, 85 insertions(+), 39 deletions(-) create mode 100644 src/plugins/sqldrivers/db2/db2.json create mode 100644 src/plugins/sqldrivers/ibase/ibase.json create mode 100644 src/plugins/sqldrivers/mysql/mysql.json create mode 100644 src/plugins/sqldrivers/oci/oci.json create mode 100644 src/plugins/sqldrivers/odbc/odbc.json create mode 100644 src/plugins/sqldrivers/psql/psql.json create mode 100644 src/plugins/sqldrivers/sqlite/sqlite.json create mode 100644 src/plugins/sqldrivers/sqlite2/sqlite2.json create mode 100644 src/plugins/sqldrivers/tds/tds.json diff --git a/src/plugins/sqldrivers/db2/db2.json b/src/plugins/sqldrivers/db2/db2.json new file mode 100644 index 0000000000..3f8678ae7a --- /dev/null +++ b/src/plugins/sqldrivers/db2/db2.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QDB2" ] +} diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index e053f3756b..d04e6f191b 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -1,6 +1,7 @@ TARGET = qsqldb2 SOURCES = main.cpp +OTHER_FILES += db2.json include(../../../sql/drivers/db2/qsql_db2.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp index af5eb10c67..186eacf2e9 100644 --- a/src/plugins/sqldrivers/db2/main.cpp +++ b/src/plugins/sqldrivers/db2/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QDB2DriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "db2.json") + public: QDB2DriverPlugin(); @@ -70,12 +73,9 @@ QSqlDriver* QDB2DriverPlugin::create(const QString &name) QStringList QDB2DriverPlugin::keys() const { - QStringList l; - l.append(QLatin1String("QDB2")); - return l; + return QStringList(QStringLiteral("QDB2")); } -Q_EXPORT_STATIC_PLUGIN(QDB2DriverPlugin) -Q_EXPORT_PLUGIN2(qsqldb2, QDB2DriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/ibase/ibase.json b/src/plugins/sqldrivers/ibase/ibase.json new file mode 100644 index 0000000000..e2186b32cd --- /dev/null +++ b/src/plugins/sqldrivers/ibase/ibase.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QIBASE" ] +} diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro index 7870ec8465..ca2a91aa2e 100644 --- a/src/plugins/sqldrivers/ibase/ibase.pro +++ b/src/plugins/sqldrivers/ibase/ibase.pro @@ -1,6 +1,7 @@ TARGET = qsqlibase SOURCES = main.cpp +OTHER_FILES += ibase.json include(../../../sql/drivers/ibase/qsql_ibase.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp index c1018944fd..e820c6a333 100644 --- a/src/plugins/sqldrivers/ibase/main.cpp +++ b/src/plugins/sqldrivers/ibase/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QIBaseDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "ibase.json") + public: QIBaseDriverPlugin(); @@ -70,12 +73,9 @@ QSqlDriver* QIBaseDriverPlugin::create(const QString &name) QStringList QIBaseDriverPlugin::keys() const { - QStringList l; - l << QLatin1String("QIBASE"); - return l; + return QStringList(QStringLiteral("QIBASE")); } -Q_EXPORT_STATIC_PLUGIN(QIBaseDriverPlugin) -Q_EXPORT_PLUGIN2(qsqlibase, QIBaseDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp index 86cae58701..70937218c3 100644 --- a/src/plugins/sqldrivers/mysql/main.cpp +++ b/src/plugins/sqldrivers/mysql/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QMYSQLDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "mysql.json") + public: QMYSQLDriverPlugin(); @@ -76,7 +79,6 @@ QStringList QMYSQLDriverPlugin::keys() const return l; } -Q_EXPORT_STATIC_PLUGIN(QMYSQLDriverPlugin) -Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/mysql/mysql.json b/src/plugins/sqldrivers/mysql/mysql.json new file mode 100644 index 0000000000..0caaadb7ce --- /dev/null +++ b/src/plugins/sqldrivers/mysql/mysql.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QMYSQL3", "QMYSQL" ] +} diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro index b6d42fffc8..05d1073701 100644 --- a/src/plugins/sqldrivers/mysql/mysql.pro +++ b/src/plugins/sqldrivers/mysql/mysql.pro @@ -1,6 +1,7 @@ TARGET = qsqlmysql SOURCES = main.cpp +OTHER_FILES += mysql.json include(../../../sql/drivers/mysql/qsql_mysql.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp index 4e5a07a64c..205bfae783 100644 --- a/src/plugins/sqldrivers/oci/main.cpp +++ b/src/plugins/sqldrivers/oci/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QOCIDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "oci.json") + public: QOCIDriverPlugin(); @@ -76,7 +79,6 @@ QStringList QOCIDriverPlugin::keys() const return l; } -Q_EXPORT_STATIC_PLUGIN(QOCIDriverPlugin) -Q_EXPORT_PLUGIN2(qsqloci, QOCIDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/oci/oci.json b/src/plugins/sqldrivers/oci/oci.json new file mode 100644 index 0000000000..cbed8fc1ac --- /dev/null +++ b/src/plugins/sqldrivers/oci/oci.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QOCI8", "QOCI" ] +} diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro index d7dcce9e35..89642f3653 100644 --- a/src/plugins/sqldrivers/oci/oci.pro +++ b/src/plugins/sqldrivers/oci/oci.pro @@ -1,6 +1,7 @@ TARGET = qsqloci SOURCES = main.cpp +OTHER_FILES += oci.json include(../../../sql/drivers/oci/qsql_oci.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp index eada54da9e..c55af6e6fc 100644 --- a/src/plugins/sqldrivers/odbc/main.cpp +++ b/src/plugins/sqldrivers/odbc/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QODBCDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "odbc.json") + public: QODBCDriverPlugin(); @@ -76,7 +79,6 @@ QStringList QODBCDriverPlugin::keys() const return l; } -Q_EXPORT_STATIC_PLUGIN(QODBCDriverPlugin) -Q_EXPORT_PLUGIN2(qsqlodbc, QODBCDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/odbc/odbc.json b/src/plugins/sqldrivers/odbc/odbc.json new file mode 100644 index 0000000000..41640776fb --- /dev/null +++ b/src/plugins/sqldrivers/odbc/odbc.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QODBC3", "QODBC" ] +} diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index 677eb6eedf..5ebd34fd17 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -1,6 +1,7 @@ TARGET = qsqlodbc SOURCES = main.cpp +OTHER_FILES += odbc.json include(../../../sql/drivers/odbc/qsql_odbc.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp index db233b9486..117df561ab 100644 --- a/src/plugins/sqldrivers/psql/main.cpp +++ b/src/plugins/sqldrivers/psql/main.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QPSQLDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "psql.json") + public: QPSQLDriverPlugin(); @@ -76,7 +79,6 @@ QStringList QPSQLDriverPlugin::keys() const return l; } -Q_EXPORT_STATIC_PLUGIN(QPSQLDriverPlugin) -Q_EXPORT_PLUGIN2(qsqlpsql, QPSQLDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/psql/psql.json b/src/plugins/sqldrivers/psql/psql.json new file mode 100644 index 0000000000..1579b99160 --- /dev/null +++ b/src/plugins/sqldrivers/psql/psql.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QPSQL7", "QPSQL" ] +} diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 8276c0ae90..cb0d27e171 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -1,6 +1,7 @@ TARGET = qsqlpsql SOURCES = main.cpp +OTHER_FILES += psql.json include(../../../sql/drivers/psql/qsql_psql.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp index 47cb08b75c..90ed72eedc 100644 --- a/src/plugins/sqldrivers/sqlite/smain.cpp +++ b/src/plugins/sqldrivers/sqlite/smain.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QSQLiteDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "sqlite.json") + public: QSQLiteDriverPlugin(); @@ -70,12 +73,9 @@ QSqlDriver* QSQLiteDriverPlugin::create(const QString &name) QStringList QSQLiteDriverPlugin::keys() const { - QStringList l; - l << QLatin1String("QSQLITE"); - return l; + return QStringList(QStringLiteral("QSQLITE")); } -Q_EXPORT_STATIC_PLUGIN(QSQLiteDriverPlugin) -Q_EXPORT_PLUGIN2(qsqlite, QSQLiteDriverPlugin) - QT_END_NAMESPACE + +#include "smain.moc" diff --git a/src/plugins/sqldrivers/sqlite/sqlite.json b/src/plugins/sqldrivers/sqlite/sqlite.json new file mode 100644 index 0000000000..3061d83145 --- /dev/null +++ b/src/plugins/sqldrivers/sqlite/sqlite.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QSQLITE" ] +} diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index f4c1671a4b..d1f4aa7233 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -1,6 +1,7 @@ TARGET = qsqlite SOURCES = smain.cpp +OTHER_FILES += sqlite.json include(../../../sql/drivers/sqlite/qsql_sqlite.pri) wince*: DEFINES += HAVE_LOCALTIME_S=0 diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp index f16057c0a6..49cfd1cdfb 100644 --- a/src/plugins/sqldrivers/sqlite2/smain.cpp +++ b/src/plugins/sqldrivers/sqlite2/smain.cpp @@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE class QSQLite2DriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "sqlite2.json") + public: QSQLite2DriverPlugin(); @@ -70,12 +73,9 @@ QSqlDriver* QSQLite2DriverPlugin::create(const QString &name) QStringList QSQLite2DriverPlugin::keys() const { - QStringList l; - l << QLatin1String("QSQLITE2"); - return l; + return QStringList(QStringLiteral("QSQLITE2")); } -Q_EXPORT_STATIC_PLUGIN(QSQLite2DriverPlugin) -Q_EXPORT_PLUGIN2(qsqlite2, QSQLite2DriverPlugin) - QT_END_NAMESPACE + +#include "smain.moc" diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.json b/src/plugins/sqldrivers/sqlite2/sqlite2.json new file mode 100644 index 0000000000..47bdae4d60 --- /dev/null +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QSQLITE2" ] +} diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro index e6197b9906..1cbd31c3dc 100644 --- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro @@ -1,6 +1,7 @@ TARGET = qsqlite2 SOURCES = smain.cpp +OTHER_FILES += sqlite2.json include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp index 97ca1c0ed0..c63f0e5606 100644 --- a/src/plugins/sqldrivers/tds/main.cpp +++ b/src/plugins/sqldrivers/tds/main.cpp @@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE class QTDSDriverPlugin : public QSqlDriverPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "tds.json") + public: QTDSDriverPlugin(); @@ -83,7 +86,6 @@ QStringList QTDSDriverPlugin::keys() const return l; } -Q_EXPORT_STATIC_PLUGIN(QTDSDriverPlugin) -Q_EXPORT_PLUGIN2(qsqltds, QTDSDriverPlugin) - QT_END_NAMESPACE + +#include "main.moc" diff --git a/src/plugins/sqldrivers/tds/tds.json b/src/plugins/sqldrivers/tds/tds.json new file mode 100644 index 0000000000..35955db9fa --- /dev/null +++ b/src/plugins/sqldrivers/tds/tds.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "QTDS7", "QTDS" ] +} diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro index b8e8ded321..9f7c2a193f 100644 --- a/src/plugins/sqldrivers/tds/tds.pro +++ b/src/plugins/sqldrivers/tds/tds.pro @@ -1,6 +1,7 @@ TARGET = qsqltds SOURCES = main.cpp +OTHER_FILES += tds.json include(../../../sql/drivers/tds/qsql_tds.pri) include(../qsqldriverbase.pri)