1 /****************************************************************************
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
6 ** This file is part of the QtSql module of the Katie Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file. Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 ****************************************************************************/
25 #include "qsqldriver.h"
26 #include "qsqlresult.h"
27 #include "qsqlcachedresult_p.h"
33 class QSQLiteDriverPrivate;
34 class QSQLiteResultPrivate;
37 class QSQLiteResult : public QSqlCachedResult
39 friend class QSQLiteDriver;
40 friend class QSQLiteResultPrivate;
42 explicit QSQLiteResult(const QSQLiteDriver* db);
44 QVariant handle() const;
47 bool gotoNext(QSqlCachedResult::ValueCache& row, int idx);
48 bool reset(const QString &query);
49 bool prepare(const QString &query);
52 int numRowsAffected() const;
53 QVariant lastInsertId() const;
54 QSqlRecord record() const;
55 void virtual_hook(int id, void *data);
58 QSQLiteResultPrivate* d;
61 class Q_SQL_EXPORT QSQLiteDriver : public QSqlDriver
64 friend class QSQLiteResult;
66 explicit QSQLiteDriver(QObject *parent = nullptr);
67 explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = nullptr);
69 bool hasFeature(DriverFeature f) const;
70 bool open(const QString & db,
72 const QString & password,
75 const QString & connOpts);
77 QSqlResult *createResult() const;
78 bool beginTransaction();
79 bool commitTransaction();
80 bool rollbackTransaction();
81 QStringList tables(QSql::TableType) const;
83 QSqlRecord record(const QString& tablename) const;
84 QSqlIndex primaryIndex(const QString &table) const;
85 QVariant handle() const;
86 QString escapeIdentifier(const QString &identifier, IdentifierType) const;
89 QSQLiteDriverPrivate* d;
95 #endif // QSQL_SQLITE_H