Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsqldriverplugin.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
8
9/*!
10 \class QSqlDriverPlugin
11 \brief The QSqlDriverPlugin class provides an abstract base for custom QSqlDriver plugins.
12
13 \ingroup plugins
14 \inmodule QtSql
15
16 The SQL driver plugin is a simple plugin interface that makes it
17 easy to create your own SQL driver plugins that can be loaded
18 dynamically by Qt.
19
20 Writing a SQL plugin is achieved by subclassing this base class,
21 reimplementing the pure virtual function create(), and
22 exporting the class with the Q_PLUGIN_METADATA() macro. See the SQL
23 plugins that come with Qt for example implementations (in the
24 \c{plugins/src/sqldrivers} subdirectory of the source
25 distribution).
26
27 The json file containing the metadata for the plugin contains a list of
28 keys indicating the supported sql drivers
29
30 \code
31 { "Keys": [ "mysqldriver" ] }
32 \endcode
33
34 \sa {How to Create Qt Plugins}
35*/
36
37/*!
38 \fn QSqlDriver *QSqlDriverPlugin::create(const QString& key)
39
40 Creates and returns a QSqlDriver object for the driver called \a
41 key. The driver key is usually the class name of the required
42 driver. Keys are case sensitive.
43
44 \sa {How to Create Qt Plugins}
45*/
46
47/*!
48 Constructs a SQL driver plugin and sets the parent to \a parent.
49 This is invoked automatically by the moc generated code that exports the plugin.
50*/
51
52QSqlDriverPlugin::QSqlDriverPlugin(QObject *parent)
53 : QObject(parent)
54{
55}
56
57/*!
58 Destroys the SQL driver plugin.
59
60 You never have to call this explicitly. Qt destroys a plugin
61 automatically when it is no longer used.
62*/
63QSqlDriverPlugin::~QSqlDriverPlugin()
64{
65}
66
67QT_END_NAMESPACE
68
69#include "moc_qsqldriverplugin.cpp"