summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <[email protected]>2012-05-27 05:34:53 +0200
committerQt by Nokia <[email protected]>2012-06-07 21:18:36 +0200
commit9d3e77f18e3bd19c1723199f0dfb5af9eabdabe8 (patch)
treed7dd2d88f0b1dc583873dc51a659253f856617b8
parentee7fa67eb0060b9c794bae4c7b06110c3b9626e0 (diff)
Remove QFactoryInterface from sql drivers
Change-Id: Ib31e6c4ce5264fc1e4281c8846df5630a6479a7c Reviewed-by: Mark Brand <[email protected]> Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
-rw-r--r--src/plugins/sqldrivers/db2/main.cpp6
-rw-r--r--src/plugins/sqldrivers/ibase/main.cpp6
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp9
-rw-r--r--src/plugins/sqldrivers/oci/main.cpp9
-rw-r--r--src/plugins/sqldrivers/odbc/main.cpp9
-rw-r--r--src/plugins/sqldrivers/psql/main.cpp9
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp6
-rw-r--r--src/plugins/sqldrivers/sqlite2/smain.cpp6
-rw-r--r--src/plugins/sqldrivers/tds/main.cpp9
-rw-r--r--src/sql/kernel/qsqldatabase.cpp2
-rw-r--r--src/sql/kernel/qsqldriverplugin.cpp20
-rw-r--r--src/sql/kernel/qsqldriverplugin.h10
12 files changed, 10 insertions, 91 deletions
diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp
index 186eacf2e97..8ea36edfcf2 100644
--- a/src/plugins/sqldrivers/db2/main.cpp
+++ b/src/plugins/sqldrivers/db2/main.cpp
@@ -54,7 +54,6 @@ public:
QDB2DriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QDB2DriverPlugin::QDB2DriverPlugin()
@@ -71,11 +70,6 @@ QSqlDriver* QDB2DriverPlugin::create(const QString &name)
return 0;
}
-QStringList QDB2DriverPlugin::keys() const
-{
- return QStringList(QStringLiteral("QDB2"));
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp
index e820c6a333b..e45aa767f14 100644
--- a/src/plugins/sqldrivers/ibase/main.cpp
+++ b/src/plugins/sqldrivers/ibase/main.cpp
@@ -54,7 +54,6 @@ public:
QIBaseDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QIBaseDriverPlugin::QIBaseDriverPlugin()
@@ -71,11 +70,6 @@ QSqlDriver* QIBaseDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QIBaseDriverPlugin::keys() const
-{
- return QStringList(QStringLiteral("QIBASE"));
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index 70937218c30..977358140b2 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -54,7 +54,6 @@ public:
QMYSQLDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QMYSQLDriverPlugin::QMYSQLDriverPlugin()
@@ -71,14 +70,6 @@ QSqlDriver* QMYSQLDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QMYSQLDriverPlugin::keys() const
-{
- QStringList l;
- l << QLatin1String("QMYSQL3");
- l << QLatin1String("QMYSQL");
- return l;
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp
index 205bfae7831..f23af7dad3d 100644
--- a/src/plugins/sqldrivers/oci/main.cpp
+++ b/src/plugins/sqldrivers/oci/main.cpp
@@ -54,7 +54,6 @@ public:
QOCIDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QOCIDriverPlugin::QOCIDriverPlugin()
@@ -71,14 +70,6 @@ QSqlDriver* QOCIDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QOCIDriverPlugin::keys() const
-{
- QStringList l;
- l.append(QLatin1String("QOCI8"));
- l.append(QLatin1String("QOCI"));
- return l;
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp
index c55af6e6fc7..c6bc4752af3 100644
--- a/src/plugins/sqldrivers/odbc/main.cpp
+++ b/src/plugins/sqldrivers/odbc/main.cpp
@@ -54,7 +54,6 @@ public:
QODBCDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QODBCDriverPlugin::QODBCDriverPlugin()
@@ -71,14 +70,6 @@ QSqlDriver* QODBCDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QODBCDriverPlugin::keys() const
-{
- QStringList l;
- l.append(QLatin1String("QODBC3"));
- l.append(QLatin1String("QODBC"));
- return l;
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp
index 117df561ab8..570e03137ca 100644
--- a/src/plugins/sqldrivers/psql/main.cpp
+++ b/src/plugins/sqldrivers/psql/main.cpp
@@ -54,7 +54,6 @@ public:
QPSQLDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QPSQLDriverPlugin::QPSQLDriverPlugin()
@@ -71,14 +70,6 @@ QSqlDriver* QPSQLDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QPSQLDriverPlugin::keys() const
-{
- QStringList l;
- l.append(QLatin1String("QPSQL7"));
- l.append(QLatin1String("QPSQL"));
- return l;
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp
index 90ed72eedc3..196d7a9d85e 100644
--- a/src/plugins/sqldrivers/sqlite/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite/smain.cpp
@@ -54,7 +54,6 @@ public:
QSQLiteDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QSQLiteDriverPlugin::QSQLiteDriverPlugin()
@@ -71,11 +70,6 @@ QSqlDriver* QSQLiteDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QSQLiteDriverPlugin::keys() const
-{
- return QStringList(QStringLiteral("QSQLITE"));
-}
-
QT_END_NAMESPACE
#include "smain.moc"
diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp
index 49cfd1cdfb9..98a00d90511 100644
--- a/src/plugins/sqldrivers/sqlite2/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite2/smain.cpp
@@ -54,7 +54,6 @@ public:
QSQLite2DriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QSQLite2DriverPlugin::QSQLite2DriverPlugin()
@@ -71,11 +70,6 @@ QSqlDriver* QSQLite2DriverPlugin::create(const QString &name)
return 0;
}
-QStringList QSQLite2DriverPlugin::keys() const
-{
- return QStringList(QStringLiteral("QSQLITE2"));
-}
-
QT_END_NAMESPACE
#include "smain.moc"
diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
index c63f0e56066..6c106b295cf 100644
--- a/src/plugins/sqldrivers/tds/main.cpp
+++ b/src/plugins/sqldrivers/tds/main.cpp
@@ -61,7 +61,6 @@ public:
QTDSDriverPlugin();
QSqlDriver* create(const QString &);
- QStringList keys() const;
};
QTDSDriverPlugin::QTDSDriverPlugin()
@@ -78,14 +77,6 @@ QSqlDriver* QTDSDriverPlugin::create(const QString &name)
return 0;
}
-QStringList QTDSDriverPlugin::keys() const
-{
- QStringList l;
- l.append(QLatin1String("QTDS7"));
- l.append(QLatin1String("QTDS"));
- return l;
-}
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 7e820d90473..f4a4cf94471 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -778,7 +778,7 @@ void QSqlDatabasePrivate::init(const QString &type)
#ifndef QT_NO_LIBRARY
if (!driver && loader())
- driver = qLoadPlugin<QSqlDriver, QSqlDriverFactoryInterface>(loader(), type);
+ driver = qLoadPlugin<QSqlDriver, QSqlDriverPlugin>(loader(), type);
#endif // QT_NO_LIBRARY
if (!driver) {
diff --git a/src/sql/kernel/qsqldriverplugin.cpp b/src/sql/kernel/qsqldriverplugin.cpp
index ea28ba2aa18..34772222f9b 100644
--- a/src/sql/kernel/qsqldriverplugin.cpp
+++ b/src/sql/kernel/qsqldriverplugin.cpp
@@ -55,24 +55,20 @@ QT_BEGIN_NAMESPACE
dynamically by Qt.
Writing a SQL plugin is achieved by subclassing this base class,
- reimplementing the pure virtual functions keys() and create(), and
- exporting the class with the Q_EXPORT_PLUGIN2() macro. See the SQL
+ reimplementing the pure virtual function create(), and
+ exporting the class with the Q_PLUGIN_METADATA() macro. See the SQL
plugins that come with Qt for example implementations (in the
\c{plugins/src/sqldrivers} subdirectory of the source
distribution).
- \sa {How to Create Qt Plugins}
-*/
-
-/*!
- \fn QStringList QSqlDriverPlugin::keys() const
-
- Returns the list of drivers (keys) this plugin supports.
+ The json file containing the metadata for the plugin contains a list of
+ keys indicating the supported sql drivers
- These keys are usually the class names of the custom drivers that
- are implemented in the plugin.
+ \code
+ { "Keys": [ "mysqldriver" ] }
+ \endcode
- \sa create()
+ \sa {How to Create Qt Plugins}
*/
/*!
diff --git a/src/sql/kernel/qsqldriverplugin.h b/src/sql/kernel/qsqldriverplugin.h
index 96dcec03131..4af9c8f73fb 100644
--- a/src/sql/kernel/qsqldriverplugin.h
+++ b/src/sql/kernel/qsqldriverplugin.h
@@ -52,23 +52,15 @@ QT_BEGIN_NAMESPACE
class QSqlDriver;
-struct Q_SQL_EXPORT QSqlDriverFactoryInterface : public QFactoryInterface
-{
- virtual QSqlDriver *create(const QString &name) = 0;
-};
-
#define QSqlDriverFactoryInterface_iid "org.qt-project.Qt.QSqlDriverFactoryInterface"
-Q_DECLARE_INTERFACE(QSqlDriverFactoryInterface, QSqlDriverFactoryInterface_iid)
-class Q_SQL_EXPORT QSqlDriverPlugin : public QObject, public QSqlDriverFactoryInterface
+class Q_SQL_EXPORT QSqlDriverPlugin : public QObject
{
Q_OBJECT
- Q_INTERFACES(QSqlDriverFactoryInterface:QFactoryInterface)
public:
explicit QSqlDriverPlugin(QObject *parent = 0);
~QSqlDriverPlugin();
- virtual QStringList keys() const = 0;
virtual QSqlDriver *create(const QString &key) = 0;
};