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#ifndef QSQL_SQLITE_H
5#define QSQL_SQLITE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtSql/qsqldriver.h>
19
20struct sqlite3;
21
22#ifdef QT_PLUGIN
23#define Q_EXPORT_SQLDRIVER_SQLITE
24#else
25#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT
26#endif
27
28QT_BEGIN_NAMESPACE
29
30class QSqlResult;
31class QSQLiteDriverPrivate;
32
33class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver
34{
35 Q_DECLARE_PRIVATE(QSQLiteDriver)
36 Q_OBJECT
37 friend class QSQLiteResultPrivate;
38public:
39 explicit QSQLiteDriver(QObject *parent = nullptr);
40 explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = nullptr);
41 ~QSQLiteDriver();
42 bool hasFeature(DriverFeature f) const override;
43 bool open(const QString & db,
44 const QString & user,
45 const QString & password,
46 const QString & host,
47 int port,
48 const QString & connOpts) override;
49 void close() override;
50 QSqlResult *createResult() const override;
51 bool beginTransaction() override;
52 bool commitTransaction() override;
53 bool rollbackTransaction() override;
54 QStringList tables(QSql::TableType) const override;
55
56 QSqlRecord record(const QString& tablename) const override;
57 QSqlIndex primaryIndex(const QString &table) const override;
58 QVariant handle() const override;
59 QString escapeIdentifier(const QString &identifier, IdentifierType) const override;
60
61 bool subscribeToNotification(const QString &name) override;
62 bool unsubscribeFromNotification(const QString &name) override;
63 QStringList subscribedToNotifications() const override;
64private Q_SLOTS:
65 void handleNotification(const QString &tableName, qint64 rowid);
66};
67
68QT_END_NAMESPACE
69
70#endif // QSQL_SQLITE_H
71

source code of qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h