summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-09-09 01:31:27 +0200
committerAndy Shaw <andy.shaw@qt.io>2017-10-03 12:10:54 +0000
commit3e2de481617aabb51dd8d635fd1d8d363610ed3f (patch)
tree97bf755a7387cadbb454d00dd667f4b489b90795 /src
parent291233a8d05b79a19e3ae2951824d1c0444cbd27 (diff)
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 <ritt.ks@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp9
1 files changed, 9 insertions, 0 deletions
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();
+}
+
////////////////////////////////////////////////////////////////////////////