1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qsqldriverplugin.h"
5
6QT_BEGIN_NAMESPACE
7
8/*!
9 \class QSqlDriverPlugin
10 \brief The QSqlDriverPlugin class provides an abstract base for custom QSqlDriver plugins.
11
12 \ingroup plugins
13 \inmodule QtSql
14
15 The SQL driver plugin is a simple plugin interface that makes it
16 easy to create your own SQL driver plugins that can be loaded
17 dynamically by Qt.
18
19 Writing a SQL plugin is achieved by subclassing this base class,
20 reimplementing the pure virtual function create(), and
21 exporting the class with the Q_PLUGIN_METADATA() macro. See the SQL
22 plugins that come with Qt for example implementations (in the
23 \c{plugins/src/sqldrivers} subdirectory of the source
24 distribution).
25
26 The json file containing the metadata for the plugin contains a list of
27 keys indicating the supported sql drivers
28
29 \code
30 { "Keys": [ "mysqldriver" ] }
31 \endcode
32
33 \sa {How to Create Qt Plugins}
34*/
35
36/*!
37 \fn QSqlDriver *QSqlDriverPlugin::create(const QString& key)
38
39 Creates and returns a QSqlDriver object for the driver called \a
40 key. The driver key is usually the class name of the required
41 driver. Keys are case sensitive.
42
43 \sa {How to Create Qt Plugins}
44*/
45
46/*!
47 Constructs a SQL driver plugin and sets the parent to \a parent.
48 This is invoked automatically by the moc generated code that exports the plugin.
49*/
50
51QSqlDriverPlugin::QSqlDriverPlugin(QObject *parent)
52 : QObject(parent)
53{
54}
55
56/*!
57 Destroys the SQL driver plugin.
58
59 You never have to call this explicitly. Qt destroys a plugin
60 automatically when it is no longer used.
61*/
62QSqlDriverPlugin::~QSqlDriverPlugin()
63{
64}
65
66QT_END_NAMESPACE
67
68#include "moc_qsqldriverplugin.cpp"
69

source code of qtbase/src/sql/kernel/qsqldriverplugin.cpp