From 2b03d6e8059020d551bb54fe118eda58d2e6d835 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 7 Nov 2017 23:30:52 +0200 Subject: [PATCH] [Qt] Qt SQLite driver has no setForwardOnly support --- platform/qt/src/sqlite3.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp index 7d47ae552..f5454e017 100644 --- a/platform/qt/src/sqlite3.cpp +++ b/platform/qt/src/sqlite3.cpp @@ -102,7 +102,6 @@ public: class StatementImpl { public: StatementImpl(const QString& sql, const QSqlDatabase& db) : query(db) { - query.setForwardOnly(true); if (!query.prepare(sql)) { checkQueryError(query); } @@ -170,8 +169,8 @@ void Database::exec(const std::string &sql) { statement.append(';'); } QSqlQuery query(*impl->db); - query.setForwardOnly(true); query.prepare(statement); + if (!query.exec()) { checkQueryError(query); } @@ -296,12 +295,11 @@ void Statement::bindBlob(int offset, const std::vector& value, bool ret bool Statement::run() { assert(impl); + if (impl->query.isValid()) { return impl->query.next(); } - assert(!impl->query.isActive()); - impl->query.setForwardOnly(true); if (!impl->query.exec()) { checkQueryError(impl->query); }