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 | #include <qstringlist.h> |
6 | #include "qsql_sqlite_p.h" |
7 | #include "qsql_sqlite_vfs_p.h" |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | using namespace Qt::StringLiterals; |
12 | |
13 | class QSQLiteDriverPlugin : public QSqlDriverPlugin |
14 | { |
15 | Q_OBJECT |
16 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface"FILE "sqlite.json") |
17 | |
18 | public: |
19 | QSQLiteDriverPlugin(); |
20 | |
21 | QSqlDriver* create(const QString &) override; |
22 | }; |
23 | |
24 | QSQLiteDriverPlugin::QSQLiteDriverPlugin() |
25 | : QSqlDriverPlugin() |
26 | { |
27 | register_qt_vfs(); |
28 | } |
29 | |
30 | QSqlDriver* QSQLiteDriverPlugin::create(const QString &name) |
31 | { |
32 | if (name == "QSQLITE"_L1) { |
33 | QSQLiteDriver* driver = new QSQLiteDriver(); |
34 | return driver; |
35 | } |
36 | |
37 | return nullptr; |
38 | } |
39 | |
40 | QT_END_NAMESPACE |
41 | |
42 | #include "smain.moc" |
43 |