4#include "private/qsqlcachedresult_p.h"
7#include <QtSql/private/qsqldriver_p.h>
100 if (
d->forwardOnly) {
104 while(
at() <
i - 1) {
118 if (
d->rowCacheEnd > 0)
120 while (
at() <
i + 1) {
135 if (
d->canSeek(
at() + 1)) {
167 return fetch(
d->cacheCount() - 1);
184 int idx =
d->forwardOnly ?
i :
at() *
d->colCount +
i;
185 if (
i >=
d->colCount ||
i < 0 ||
at() < 0 || idx >=
d->rowCacheEnd)
188 return d->cache.at(idx);
194 int idx =
d->forwardOnly ?
i :
at() *
d->colCount +
i;
195 if (
i >=
d->colCount ||
i < 0 ||
at() < 0 || idx >=
d->rowCacheEnd)
198 return d->cache.at(idx).isNull();
217bool QSqlCachedResult::cacheNext()
224 d->cache.resize(
d->colCount);
qsizetype size() const noexcept
void resize(qsizetype size)
bool canSeek(int i) const
void init(int count, bool fo)
QSqlCachedResult::ValueCache cache
QVariant data(int i) override
Returns the data for field index in the current row as a QVariant.
bool fetchLast() override
Positions the result to the last record (last row) in the result.
bool fetchFirst() override
Positions the result to the first record (row 0) in the result.
bool fetchPrevious() override
Positions the result to the previous record (row) in the result.
void virtual_hook(int id, void *data) override
bool isNull(int i) override
Returns true if the field at position index in the current row is null; otherwise returns false.
virtual bool gotoNext(ValueCache &values, int index)=0
bool fetch(int i) override
Positions the result to an arbitrary (zero-based) row index.
QSqlCachedResult(QSqlCachedResultPrivate &d)
bool fetchNext() override
Positions the result to the next available record (row) in the result.
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) override
void detachFromResultSet() override
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases.
bool isForwardOnly() const
Returns true if you can only scroll forward through the result set; otherwise returns false.
virtual void virtual_hook(int id, void *data)
virtual void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy)
int at() const
Returns the current (zero-based) row position of the result.
virtual void setAt(int at)
This function is provided for derived classes to set the internal (zero-based) row position to index.
virtual void setActive(bool a)
This function is provided for derived classes to set the internal active state to active.
bool isActive() const
Returns true if the result has records to be retrieved; otherwise returns false.
Combined button and popup list for selecting options.
constexpr const T & qMin(const T &a, const T &b)
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static QT_BEGIN_NAMESPACE constexpr qsizetype initial_cache_size