From 3e2de481617aabb51dd8d635fd1d8d363610ed3f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sat, 9 Sep 2017 01:31:27 +0200 Subject: OCI: Clear the cache in the result for a forward only query When the query is forward-only then nextIndex() is always 0, therefore the cache values need to be cleared beforehand so that they are not reused when the next row is retrieved. Task-number: QTBUG-57765 Change-Id: I49e8427b24ec2d932e5b387699ac7f3496e9a48c Reviewed-by: Konstantin Ritt Reviewed-by: Edward Welbourne --- src/plugins/sqldrivers/oci/qsql_oci.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index 32d3681a17..a4793351de 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp @@ -206,6 +206,7 @@ protected: QVariant lastInsertId() const Q_DECL_OVERRIDE; bool execBatch(bool arrayBind = false) Q_DECL_OVERRIDE; void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; + bool fetchNext() override; }; class QOCIResultPrivate: public QSqlCachedResultPrivate @@ -2097,6 +2098,14 @@ void QOCIResult::virtual_hook(int id, void *data) QSqlCachedResult::virtual_hook(id, data); } +bool QOCIResult::fetchNext() +{ + Q_D(QOCIResult); + if (isForwardOnly()) + d->cache.clear(); + return QSqlCachedResult::fetchNext(); +} + //////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3