| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqlcachedresult.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtSql module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include "private/qsqlcachedresult_p.h" | - | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | #include <qvariant.h> | - | ||||||||||||||||||||||||
| 43 | #include <qdatetime.h> | - | ||||||||||||||||||||||||
| 44 | #include <qvector.h> | - | ||||||||||||||||||||||||
| 45 | #include <QtSql/private/qsqldriver_p.h> | - | ||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | /* | - | ||||||||||||||||||||||||
| 50 | QSqlCachedResult is a convenience class for databases that only allow | - | ||||||||||||||||||||||||
| 51 | forward only fetching. It will cache all the results so we can iterate | - | ||||||||||||||||||||||||
| 52 | backwards over the results again. | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | All you need to do is to inherit from QSqlCachedResult and reimplement | - | ||||||||||||||||||||||||
| 55 | gotoNext(). gotoNext() will have a reference to the internal cache and | - | ||||||||||||||||||||||||
| 56 | will give you an index where you can start filling in your data. Special | - | ||||||||||||||||||||||||
| 57 | case: If the user actually wants a forward-only query, idx will be -1 | - | ||||||||||||||||||||||||
| 58 | to indicate that we are not interested in the actual values. | - | ||||||||||||||||||||||||
| 59 | */ | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | static const uint initial_cache_size = 128; | - | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| classQSqlCachedResultPrivate{ | ||||||||||||||||||||||||||
| public:::QSqlCachedResultPrivate(); | ||||||||||||||||||||||||||
| bool canSeek(int i) const; | ||||||||||||||||||||||||||
| inline int cacheCount()QSqlCachedResult *q, const ; | ||||||||||||||||||||||||||
| void initQSqlDriver *drv) | ||||||||||||||||||||||||||
| 64 | : QSqlResultPrivate(int countq, bool fo); | - | ||||||||||||||||||||||||
| void cleanup(); | ||||||||||||||||||||||||||
| int nextIndex(); | ||||||||||||||||||||||||||
| void revertLast(); | ||||||||||||||||||||||||||
| QSqlCachedResult::ValueCache cache; | ||||||||||||||||||||||||||
| int rowCacheEnd; | ||||||||||||||||||||||||||
| int colCount; | ||||||||||||||||||||||||||
| bool forwardOnly; | ||||||||||||||||||||||||||
| bool atEnd; | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
| QSqlCachedResultPrivate::QSqlCachedResultPrivate():drv), | ||||||||||||||||||||||||||
| 65 | rowCacheEnd(0), | - | ||||||||||||||||||||||||
| 66 | colCount(0), forwardOnly(false), | - | ||||||||||||||||||||||||
| 67 | atEnd(false) | - | ||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||
| 69 | } executed 1930 times by 9 tests: end of blockExecuted by:
| 1930 | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | void QSqlCachedResultPrivate::cleanup() | - | ||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||
| 73 | cache.clear(); | - | ||||||||||||||||||||||||
| 74 | forwardOnly = false;atEnd = false; | - | ||||||||||||||||||||||||
| 75 | colCount = 0; | - | ||||||||||||||||||||||||
| 76 | rowCacheEnd = 0; | - | ||||||||||||||||||||||||
| 77 | } executed 8636 times by 9 tests: end of blockExecuted by:
| 8636 | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | void QSqlCachedResultPrivate::init(int count, bool fo) | - | ||||||||||||||||||||||||
| 80 | { | - | ||||||||||||||||||||||||
| 81 | Q_ASSERT(count); | - | ||||||||||||||||||||||||
| 82 | cleanup(); | - | ||||||||||||||||||||||||
| 83 | forwardOnly = fo; | - | ||||||||||||||||||||||||
| 84 | colCount = count; | - | ||||||||||||||||||||||||
| 85 | if (fo) { | - | ||||||||||||||||||||||||
| 86 | cache.resize(count); | - | ||||||||||||||||||||||||
| 87 | rowCacheEnd = count; | - | ||||||||||||||||||||||||
| 88 | } else { | - | ||||||||||||||||||||||||
| 89 | cache.resize(initial_cache_size * count); | - | ||||||||||||||||||||||||
| 90 | } | - | ||||||||||||||||||||||||
| 91 | } | - | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | int QSqlCachedResultPrivate::nextIndex() | - | ||||||||||||||||||||||||
| 94 | { | - | ||||||||||||||||||||||||
| 95 | if (forwardOnly) | - | ||||||||||||||||||||||||
| 96 | return 0; | - | ||||||||||||||||||||||||
| 97 | int newIdx = rowCacheEnd; | - | ||||||||||||||||||||||||
| 98 | if (newIdx + colCount > cache.size()) | - | ||||||||||||||||||||||||
| 99 | cache.resize(qMin(cache.size() * 2, cache.size() + 10000)); | - | ||||||||||||||||||||||||
| 100 | rowCacheEnd += colCount; | - | ||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | return newIdx; | - | ||||||||||||||||||||||||
| 103 | } | - | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | bool QSqlCachedResultPrivate::canSeek(int i) const | - | ||||||||||||||||||||||||
| 106 | { | - | ||||||||||||||||||||||||
| 107 | if (forwardOnly || i < 0) | - | ||||||||||||||||||||||||
| 108 | return false; | - | ||||||||||||||||||||||||
| 109 | return rowCacheEnd >= (i + 1) * colCount; | - | ||||||||||||||||||||||||
| 110 | } | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | void QSqlCachedResultPrivate::revertLast() | - | ||||||||||||||||||||||||
| 113 | { | - | ||||||||||||||||||||||||
| 114 | if (forwardOnly) | - | ||||||||||||||||||||||||
| 115 | return; | - | ||||||||||||||||||||||||
| 116 | rowCacheEnd -= colCount; | - | ||||||||||||||||||||||||
| 117 | } | - | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | inline int QSqlCachedResultPrivate::cacheCount() const | - | ||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||
| 121 | Q_ASSERT(!forwardOnly); | - | ||||||||||||||||||||||||
| 122 | Q_ASSERT(colCount); | - | ||||||||||||||||||||||||
| 123 | return rowCacheEnd / colCount; | - | ||||||||||||||||||||||||
| 124 | } | - | ||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | ////////////// | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | QSqlCachedResult::QSqlCachedResult(const QSqlDriver * db):QSqlCachedResultPrivate &d) | - | ||||||||||||||||||||||||
| 129 | : QSqlResult(db) | - | ||||||||||||||||||||||||
| {d= new QSqlCachedResultPrivate(); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| QSqlCachedResult::~QSqlCachedResult()) | ||||||||||||||||||||||||||
| 130 | { | - | ||||||||||||||||||||||||
| delete d; executed 1930 times by 9 tests: }end of blockExecuted by:
executed 1930 times by 9 tests: end of blockExecuted by:
| ||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | void QSqlCachedResult::init(int colCount) | - | ||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||
| 135 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 136 | d->init(colCount, isForwardOnly()); | - | ||||||||||||||||||||||||
| 137 | } executed 1124 times by 9 tests: end of blockExecuted by:
| 1124 | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | bool QSqlCachedResult::fetch(int i) | - | ||||||||||||||||||||||||
| 140 | { | - | ||||||||||||||||||||||||
| 141 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 142 | if ((!isActive()) || (i < 0))
| 0-2662 | ||||||||||||||||||||||||
| 143 | return false; executed 2 times by 1 test: return false;Executed by:
| 2 | ||||||||||||||||||||||||
| 144 | if (at() == i)
| 944-1716 | ||||||||||||||||||||||||
| 145 | return true; executed 1716 times by 5 tests: return true;Executed by:
| 1716 | ||||||||||||||||||||||||
| 146 | if (d->forwardOnly) {
| 1-943 | ||||||||||||||||||||||||
| 147 | // speed hack - do not copy values if not needed | - | ||||||||||||||||||||||||
| 148 | if (at() > i || at() == QSql::AfterLastRow)
| 0-1 | ||||||||||||||||||||||||
| 149 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 150 | while(at() < i - 1) {
| 1-3 | ||||||||||||||||||||||||
| 151 | if (!gotoNext(d->cache, -1))
| 0-3 | ||||||||||||||||||||||||
| 152 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 153 | setAt(at() + 1); | - | ||||||||||||||||||||||||
| 154 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 155 | if (!gotoNext(d->cache, 0))
| 0-1 | ||||||||||||||||||||||||
| 156 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 157 | setAt(at() + 1); | - | ||||||||||||||||||||||||
| 158 | return true; executed 1 time by 1 test: return true;Executed by:
| 1 | ||||||||||||||||||||||||
| 159 | } | - | ||||||||||||||||||||||||
| 160 | if (d->canSeek(i)) {
| 404-539 | ||||||||||||||||||||||||
| 161 | setAt(i); | - | ||||||||||||||||||||||||
| 162 | return true; executed 539 times by 5 tests: return true;Executed by:
| 539 | ||||||||||||||||||||||||
| 163 | } | - | ||||||||||||||||||||||||
| 164 | if (d->rowCacheEnd > 0)
| 13-391 | ||||||||||||||||||||||||
| 165 | setAt(d->cacheCount()); executed 13 times by 3 tests: setAt(d->cacheCount());Executed by:
| 13 | ||||||||||||||||||||||||
| 166 | while (at() < i + 1) {
| 132-34438 | ||||||||||||||||||||||||
| 167 | if (!cacheNext()) {
| 272-34166 | ||||||||||||||||||||||||
| 168 | if (d->canSeek(i))
| 2-270 | ||||||||||||||||||||||||
| 169 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 170 | return false; executed 270 times by 5 tests: return false;Executed by:
| 270 | ||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||
| 172 | } executed 34166 times by 5 tests: end of blockExecuted by:
| 34166 | ||||||||||||||||||||||||
| 173 | setAt(i); | - | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | return true; executed 134 times by 4 tests: return true;Executed by:
| 134 | ||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||
| 178 | bool QSqlCachedResult::fetchNext() | - | ||||||||||||||||||||||||
| 179 | { | - | ||||||||||||||||||||||||
| 180 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 181 | if (d->canSeek(at() + 1)) {
| 1750-1958 | ||||||||||||||||||||||||
| 182 | setAt(at() + 1); | - | ||||||||||||||||||||||||
| 183 | return true; executed 1750 times by 5 tests: return true;Executed by:
| 1750 | ||||||||||||||||||||||||
| 184 | } | - | ||||||||||||||||||||||||
| 185 | return cacheNext(); executed 1958 times by 8 tests: return cacheNext();Executed by:
| 1958 | ||||||||||||||||||||||||
| 186 | } | - | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | bool QSqlCachedResult::fetchPrevious() | - | ||||||||||||||||||||||||
| 189 | { | - | ||||||||||||||||||||||||
| 190 | return fetch(at() - 1); | - | ||||||||||||||||||||||||
| 191 | } | - | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | bool QSqlCachedResult::fetchFirst() | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 196 | if (d->forwardOnly && at() != QSql::BeforeFirstRow) {
| 0-615 | ||||||||||||||||||||||||
| 197 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 198 | } | - | ||||||||||||||||||||||||
| 199 | if (d->canSeek(0)) {
| 1-702 | ||||||||||||||||||||||||
| 200 | setAt(0); | - | ||||||||||||||||||||||||
| 201 | return true; executed 1 time by 1 test: return true;Executed by:
| 1 | ||||||||||||||||||||||||
| 202 | } | - | ||||||||||||||||||||||||
| 203 | return cacheNext(); executed 702 times by 8 tests: return cacheNext();Executed by:
| 702 | ||||||||||||||||||||||||
| 204 | } | - | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | bool QSqlCachedResult::fetchLast() | - | ||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||
| 208 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 209 | if (d->atEnd) {
| 4-6 | ||||||||||||||||||||||||
| 210 | if (d->forwardOnly)
| 0-4 | ||||||||||||||||||||||||
| 211 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 212 | else | - | ||||||||||||||||||||||||
| 213 | return fetch(d->cacheCount() - 1); executed 4 times by 1 test: return fetch(d->cacheCount() - 1);Executed by:
| 4 | ||||||||||||||||||||||||
| 214 | } | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | int i = at(); | - | ||||||||||||||||||||||||
| 217 | while (fetchNext())
| 6-22 | ||||||||||||||||||||||||
| 218 | ++i; /* brute force */ executed 22 times by 1 test: ++i;Executed by:
| 22 | ||||||||||||||||||||||||
| 219 | if (d->forwardOnly && at() == QSql::AfterLastRow) {
| 0-4 | ||||||||||||||||||||||||
| 220 | setAt(i); | - | ||||||||||||||||||||||||
| 221 | return true; executed 2 times by 1 test: return true;Executed by:
| 2 | ||||||||||||||||||||||||
| 222 | } else { | - | ||||||||||||||||||||||||
| 223 | return fetch(i); executed 4 times by 1 test: return fetch(i);Executed by:
| 4 | ||||||||||||||||||||||||
| 224 | } | - | ||||||||||||||||||||||||
| 225 | } | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | QVariant QSqlCachedResult::data(int i) | - | ||||||||||||||||||||||||
| 228 | { | - | ||||||||||||||||||||||||
| 229 | Q_D(const QSqlCachedResult); | - | ||||||||||||||||||||||||
| 230 | int idx = d->forwardOnly ? i : at() * d->colCount + i;
| 3489-5649 | ||||||||||||||||||||||||
| 231 | if (i >= d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd)
| 0-9138 | ||||||||||||||||||||||||
| 232 | return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | return d->cache.at(idx); executed 9138 times by 8 tests: return d->cache.at(idx);Executed by:
| 9138 | ||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | bool QSqlCachedResult::isNull(int i) | - | ||||||||||||||||||||||||
| 238 | { | - | ||||||||||||||||||||||||
| 239 | Q_D(const QSqlCachedResult); | - | ||||||||||||||||||||||||
| 240 | int idx = d->forwardOnly ? i : at() * d->colCount + i;
| 0-10 | ||||||||||||||||||||||||
| 241 | if (i >= d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd)
| 0-9 | ||||||||||||||||||||||||
| 242 | return true; executed 1 time by 1 test: return true;Executed by:
| 1 | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | return d->cache.at(idx).isNull(); executed 9 times by 1 test: return d->cache.at(idx).isNull();Executed by:
| 9 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | void QSqlCachedResult::cleanup() | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 250 | setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 251 | setActive(false); | - | ||||||||||||||||||||||||
| 252 | d->cleanup(); | - | ||||||||||||||||||||||||
| 253 | } executed 7512 times by 9 tests: end of blockExecuted by:
| 7512 | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | void QSqlCachedResult::clearValues() | - | ||||||||||||||||||||||||
| 256 | { | - | ||||||||||||||||||||||||
| 257 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 258 | setAt(QSql::BeforeFirstRow); | - | ||||||||||||||||||||||||
| 259 | d->rowCacheEnd = 0; | - | ||||||||||||||||||||||||
| 260 | d->atEnd = false; | - | ||||||||||||||||||||||||
| 261 | } executed 119111 times by 9 tests: end of blockExecuted by:
| 119111 | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | bool QSqlCachedResult::cacheNext() | - | ||||||||||||||||||||||||
| 264 | { | - | ||||||||||||||||||||||||
| 265 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 266 | if (d->atEnd)
| 262-36836 | ||||||||||||||||||||||||
| 267 | return false; executed 262 times by 5 tests: return false;Executed by:
| 262 | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | if(isForwardOnly()) {
| 2237-34599 | ||||||||||||||||||||||||
| 270 | d->cache.clear();d->cache.resize(d->colCount); | - | ||||||||||||||||||||||||
| 271 | } executed 2237 times by 8 tests: end of blockExecuted by:
| 2237 | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | if (!gotoNext(d->cache, d->nextIndex())) {
| 838-35998 | ||||||||||||||||||||||||
| 274 | d->revertLast(); | - | ||||||||||||||||||||||||
| 275 | d->atEnd = true; | - | ||||||||||||||||||||||||
| 276 | return false; executed 838 times by 8 tests: return false;Executed by:
| 838 | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | setAt(at() + 1); | - | ||||||||||||||||||||||||
| 279 | return true; executed 35998 times by 8 tests: return true;Executed by:
| 35998 | ||||||||||||||||||||||||
| 280 | } | - | ||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | int QSqlCachedResult::colCount() const | - | ||||||||||||||||||||||||
| 283 | { | - | ||||||||||||||||||||||||
| 284 | Q_D(const QSqlCachedResult); | - | ||||||||||||||||||||||||
| 285 | return d->colCount; never executed: return d->colCount; | 0 | ||||||||||||||||||||||||
| 286 | } | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | QSqlCachedResult::ValueCache &QSqlCachedResult::cache() | - | ||||||||||||||||||||||||
| 289 | { | - | ||||||||||||||||||||||||
| 290 | Q_D(QSqlCachedResult); | - | ||||||||||||||||||||||||
| 291 | return d->cache; never executed: return d->cache; | 0 | ||||||||||||||||||||||||
| 292 | } | - | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | void QSqlCachedResult::virtual_hook(int id, void *data) | - | ||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||
| 296 | QSqlResult::virtual_hook(id, data); | - | ||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | void QSqlCachedResult::detachFromResultSet() | - | ||||||||||||||||||||||||
| 300 | { | - | ||||||||||||||||||||||||
| 301 | cleanup(); | - | ||||||||||||||||||||||||
| 302 | } | - | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | void QSqlCachedResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) | - | ||||||||||||||||||||||||
| 305 | { | - | ||||||||||||||||||||||||
| 306 | QSqlResult::setNumericalPrecisionPolicy(policy); | - | ||||||||||||||||||||||||
| 307 | cleanup(); | - | ||||||||||||||||||||||||
| 308 | } | - | ||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |