diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-11-08 13:48:02 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-11-09 15:31:34 +0200 |
commit | c229e2d3330999401244ed0fe4d180aa1cdc62bb (patch) | |
tree | 6c0613df99b25f227ac5547f1e64124f78154545 | |
parent | 64a90b70d9df842511a2d87bf45b2e13c4e814a8 (diff) | |
download | qtlocation-mapboxgl-c229e2d3330999401244ed0fe4d180aa1cdc62bb.tar.gz |
[Qt] Call QSqlQuery::finish() when inactive
-rw-r--r-- | platform/qt/src/sqlite3.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp index f5e5f7a690..1d18946364 100644 --- a/platform/qt/src/sqlite3.cpp +++ b/platform/qt/src/sqlite3.cpp @@ -305,18 +305,19 @@ void Statement::bindBlob(int offset, const std::vector<uint8_t>& value, bool ret bool Statement::run() { assert(impl); - if (impl->query.isValid()) { - return impl->query.next(); + if (!impl->query.isValid()) { + if (impl->query.exec()) { + impl->lastInsertRowId = impl->query.lastInsertId().value<int64_t>(); + impl->changes = impl->query.numRowsAffected(); + } else { + checkQueryError(impl->query); + } } - if (!impl->query.exec()) { - checkQueryError(impl->query); - } - - impl->lastInsertRowId = impl->query.lastInsertId().value<int64_t>(); - impl->changes = impl->query.numRowsAffected(); + const bool hasNext = impl->query.next(); + if (!hasNext) impl->query.finish(); - return impl->query.next(); + return hasNext; } template bool Statement::get(int); |