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>
This commit is contained in:
Andy Shaw 2017-09-09 01:31:27 +02:00
parent 291233a8d0
commit 3e2de48161

View File

@ -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();
}
////////////////////////////////////////////////////////////////////////////