Qt 4.8
Public Functions | Public Variables | List of all members
QSqlCachedResultPrivate Class Reference

Public Functions

int cacheCount () const
 
bool canSeek (int i) const
 
void cleanup ()
 
void init (int count, bool fo)
 
int nextIndex ()
 
 QSqlCachedResultPrivate ()
 
void revertLast ()
 

Public Variables

bool atEnd
 
QSqlCachedResult::ValueCache cache
 
int colCount
 
bool forwardOnly
 
int rowCacheEnd
 

Detailed Description

Definition at line 64 of file qsqlcachedresult.cpp.

Constructors and Destructors

◆ QSqlCachedResultPrivate()

QSqlCachedResultPrivate::QSqlCachedResultPrivate ( )

Functions

◆ cacheCount()

int QSqlCachedResultPrivate::cacheCount ( ) const
inline

Definition at line 136 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::fetch(), and QSqlCachedResult::fetchLast().

137 {
140  return rowCacheEnd / colCount;
141 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ canSeek()

bool QSqlCachedResultPrivate::canSeek ( int  i) const

Definition at line 122 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::fetch(), QSqlCachedResult::fetchFirst(), and QSqlCachedResult::fetchNext().

123 {
124  if (forwardOnly || i < 0)
125  return false;
126  return rowCacheEnd >= (i + 1) * colCount;
127 }

◆ cleanup()

void QSqlCachedResultPrivate::cleanup ( )

Definition at line 87 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::cleanup(), and init().

88 {
89  cache.clear();
90  forwardOnly = false;
91  atEnd = false;
92  colCount = 0;
93  rowCacheEnd = 0;
94 }
QSqlCachedResult::ValueCache cache
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347

◆ init()

void QSqlCachedResultPrivate::init ( int  count,
bool  fo 
)

Definition at line 96 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::init().

97 {
98  Q_ASSERT(count);
99  cleanup();
100  forwardOnly = fo;
101  colCount = count;
102  if (fo) {
103  cache.resize(count);
104  rowCacheEnd = count;
105  } else {
107  }
108 }
QSqlCachedResult::ValueCache cache
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
static const uint initial_cache_size

◆ nextIndex()

int QSqlCachedResultPrivate::nextIndex ( )

Definition at line 110 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::cacheNext().

111 {
112  if (forwardOnly)
113  return 0;
114  int newIdx = rowCacheEnd;
115  if (newIdx + colCount > cache.size())
116  cache.resize(qMin(cache.size() * 2, cache.size() + 10000));
118 
119  return newIdx;
120 }
QSqlCachedResult::ValueCache cache
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ revertLast()

void QSqlCachedResultPrivate::revertLast ( )

Definition at line 129 of file qsqlcachedresult.cpp.

Referenced by QSqlCachedResult::cacheNext().

Properties

◆ atEnd

bool QSqlCachedResultPrivate::atEnd

◆ cache

QSqlCachedResult::ValueCache QSqlCachedResultPrivate::cache

◆ colCount

int QSqlCachedResultPrivate::colCount

◆ forwardOnly

bool QSqlCachedResultPrivate::forwardOnly

◆ rowCacheEnd

int QSqlCachedResultPrivate::rowCacheEnd

The documentation for this class was generated from the following file: