qsqlcachedresult.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqlcachedresult.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4static const uint initial_cache_size = 128;-
5-
6QSqlCachedResultPrivate::QSqlCachedResultPrivate(QSqlCachedResult *q, const QSqlDriver *drv)-
7 : QSqlResultPrivate(q, drv),-
8 rowCacheEnd(0),-
9 colCount(0),-
10 atEnd(false)-
11{-
12}
executed 1930 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1930
13-
14void QSqlCachedResultPrivate::cleanup()-
15{-
16 cache.clear();-
17 atEnd = false;-
18 colCount = 0;-
19 rowCacheEnd = 0;-
20}
executed 8636 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
8636
21-
22void QSqlCachedResultPrivate::init(int count, bool fo)-
23{-
24 ((!(count)) ? qt_assert("count",__FILE__,81) : qt_noop());-
25 cleanup();-
26 forwardOnly = fo;-
27 colCount = count;-
28 if (fo
foDescription
TRUEevaluated 639 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 485 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
485-639
29 cache.resize(count);-
30 rowCacheEnd = count;-
31 }
executed 639 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
else {
639
32 cache.resize(initial_cache_size * count);-
33 }
executed 485 times by 8 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
485
34}-
35-
36int QSqlCachedResultPrivate::nextIndex()-
37{-
38 if (forwardOnly
forwardOnlyDescription
TRUEevaluated 2237 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 34599 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
2237-34599
39 return
executed 2237 times by 8 tests: return 0;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
0;
executed 2237 times by 8 tests: return 0;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2237
40 int newIdx = rowCacheEnd;-
41 if (newIdx + colCount > cache.size()
newIdx + colCo...> cache.size()Description
TRUEevaluated 244 times by 3 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
FALSEevaluated 34355 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
244-34355
42 cache.resize(qMin(cache.size() * 2, cache.size() + 10000));
executed 244 times by 3 tests: cache.resize(qMin(cache.size() * 2, cache.size() + 10000));
Executed by:
  • tst_QItemModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
244
43 rowCacheEnd += colCount;-
44-
45 return
executed 34599 times by 8 tests: return newIdx;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
newIdx;
executed 34599 times by 8 tests: return newIdx;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
34599
46}-
47-
48bool QSqlCachedResultPrivate::canSeek(int i) const-
49{-
50 if (forwardOnly
forwardOnlyDescription
TRUEevaluated 2238 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 3388 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 3388 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-3388
51 return
executed 2238 times by 8 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
false;
executed 2238 times by 8 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2238
52 return
executed 3388 times by 8 tests: return rowCacheEnd >= (i + 1) * colCount;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
rowCacheEnd >= (i + 1) * colCount;
executed 3388 times by 8 tests: return rowCacheEnd >= (i + 1) * colCount;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
3388
53}-
54-
55void QSqlCachedResultPrivate::revertLast()-
56{-
57 if (forwardOnly
forwardOnlyDescription
TRUEevaluated 558 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 280 times by 6 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
280-558
58 return;
executed 558 times by 8 tests: return;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
558
59 rowCacheEnd -= colCount;-
60}
executed 280 times by 6 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
280
61-
62inline int QSqlCachedResultPrivate::cacheCount() const-
63{-
64 ((!(!forwardOnly)) ? qt_assert("!forwardOnly",__FILE__,121) : qt_noop());-
65 ((!(colCount)) ? qt_assert("colCount",__FILE__,122) : qt_noop());-
66 return
executed 17 times by 3 tests: return rowCacheEnd / colCount;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
rowCacheEnd / colCount;
executed 17 times by 3 tests: return rowCacheEnd / colCount;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
17
67}-
68-
69-
70-
71QSqlCachedResult::QSqlCachedResult(QSqlCachedResultPrivate &d)-
72 : QSqlResult(d)-
73{-
74}
executed 1930 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1930
75-
76void QSqlCachedResult::init(int colCount)-
77{-
78 QSqlCachedResultPrivate * const d = d_func();-
79 d->init(colCount, isForwardOnly());-
80}
executed 1124 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1124
81-
82bool QSqlCachedResult::fetch(int i)-
83{-
84 QSqlCachedResultPrivate * const d = d_func();-
85 if ((
(!isActive())Description
TRUEnever evaluated
FALSEevaluated 2662 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
!isActive())
(!isActive())Description
TRUEnever evaluated
FALSEevaluated 2662 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
|| (
(i < 0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2660 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
i < 0)
(i < 0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2660 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
)
0-2662
86 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QSqlQuery
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QSqlQuery
2
87 if (at() == i
at() == iDescription
TRUEevaluated 1716 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 944 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
)
944-1716
88 return
executed 1716 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 1716 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
1716
89 if (d->forwardOnly
d->forwardOnlyDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 943 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
1-943
90-
91 if (at() > i
at() > iDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
|| at() == QSql::AfterLastRow
at() == QSql::AfterLastRowDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-1
92 return
never executed: return false;
false;
never executed: return false;
0
93 while(at() < i - 1
at() < i - 1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
1-3
94 if (!gotoNext(d->cache, -1)
!gotoNext(d->cache, -1)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-3
95 return
never executed: return false;
false;
never executed: return false;
0
96 setAt(at() + 1);-
97 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
3
98 if (!gotoNext(d->cache, 0)
!gotoNext(d->cache, 0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-1
99 return
never executed: return false;
false;
never executed: return false;
0
100 setAt(at() + 1);-
101 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
1
102 }-
103 if (d->canSeek(i)
d->canSeek(i)Description
TRUEevaluated 539 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 404 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
404-539
104 setAt(i);-
105 return
executed 539 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 539 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
539
106 }-
107 if (d->rowCacheEnd > 0
d->rowCacheEnd > 0Description
TRUEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
FALSEevaluated 391 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
)
13-391
108 setAt(d->cacheCount());
executed 13 times by 3 tests: setAt(d->cacheCount());
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
13
109 while (at() < i + 1
at() < i + 1Description
TRUEevaluated 34438 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 132 times by 4 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
) {
132-34438
110 if (!cacheNext()
!cacheNext()Description
TRUEevaluated 272 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 34166 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
272-34166
111 if (d->canSeek(i)
d->canSeek(i)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 270 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
)
2-270
112 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QSqlQuery
2
113 return
executed 270 times by 5 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
false;
executed 270 times by 5 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
270
114 }-
115 }
executed 34166 times by 5 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
34166
116 setAt(i);-
117-
118 return
executed 134 times by 4 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
true;
executed 134 times by 4 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
134
119}-
120-
121bool QSqlCachedResult::fetchNext()-
122{-
123 QSqlCachedResultPrivate * const d = d_func();-
124 if (d->canSeek(at() + 1)
d->canSeek(at() + 1)Description
TRUEevaluated 1750 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 1958 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
1750-1958
125 setAt(at() + 1);-
126 return
executed 1750 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 1750 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
1750
127 }-
128 return
executed 1958 times by 8 tests: return cacheNext();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
cacheNext();
executed 1958 times by 8 tests: return cacheNext();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1958
129}-
130-
131bool QSqlCachedResult::fetchPrevious()-
132{-
133 return
executed 40 times by 3 tests: return fetch(at() - 1);
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
fetch(at() - 1);
executed 40 times by 3 tests: return fetch(at() - 1);
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
40
134}-
135-
136bool QSqlCachedResult::fetchFirst()-
137{-
138 QSqlCachedResultPrivate * const d = d_func();-
139 if (d->forwardOnly
d->forwardOnlyDescription
TRUEevaluated 615 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 88 times by 4 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlThread
&& at() != QSql::BeforeFirstRow
at() != QSql::BeforeFirstRowDescription
TRUEnever evaluated
FALSEevaluated 615 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-615
140 return
never executed: return false;
false;
never executed: return false;
0
141 }-
142 if (d->canSeek(0)
d->canSeek(0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 702 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
1-702
143 setAt(0);-
144 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
1
145 }-
146 return
executed 702 times by 8 tests: return cacheNext();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
cacheNext();
executed 702 times by 8 tests: return cacheNext();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
702
147}-
148-
149bool QSqlCachedResult::fetchLast()-
150{-
151 QSqlCachedResultPrivate * const d = d_func();-
152 if (d->atEnd
d->atEndDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
4-6
153 if (d->forwardOnly
d->forwardOnlyDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-4
154 return
never executed: return false;
false;
never executed: return false;
0
155 else-
156 return
executed 4 times by 1 test: return fetch(d->cacheCount() - 1);
Executed by:
  • tst_QSqlQuery
fetch(d->cacheCount() - 1);
executed 4 times by 1 test: return fetch(d->cacheCount() - 1);
Executed by:
  • tst_QSqlQuery
4
157 }-
158-
159 int i = at();-
160 while (fetchNext()
fetchNext()Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
6-22
161 ++
executed 22 times by 1 test: ++i;
Executed by:
  • tst_QSqlQuery
i;
executed 22 times by 1 test: ++i;
Executed by:
  • tst_QSqlQuery
22
162 if (d->forwardOnly
d->forwardOnlyDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSqlQuery
&& at() == QSql::AfterLastRow
at() == QSql::AfterLastRowDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEnever evaluated
) {
0-4
163 setAt(i);-
164 return
executed 2 times by 1 test: return true;
Executed by:
  • tst_QSqlQuery
true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_QSqlQuery
2
165 } else {-
166 return
executed 4 times by 1 test: return fetch(i);
Executed by:
  • tst_QSqlQuery
fetch(i);
executed 4 times by 1 test: return fetch(i);
Executed by:
  • tst_QSqlQuery
4
167 }-
168}-
169-
170QVariant QSqlCachedResult::data(int i)-
171{-
172 const QSqlCachedResultPrivate * const d = d_func();-
173 int idx = d->forwardOnly
d->forwardOnlyDescription
TRUEevaluated 5649 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 3489 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
? i : at() * d->colCount + i;
3489-5649
174 if (i >= d->colCount
i >= d->colCountDescription
TRUEnever evaluated
FALSEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| at() < 0
at() < 0Description
TRUEnever evaluated
FALSEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| idx >= d->rowCacheEnd
idx >= d->rowCacheEndDescription
TRUEnever evaluated
FALSEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-9138
175 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
176-
177 return
executed 9138 times by 8 tests: return d->cache.at(idx);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->cache.at(idx);
executed 9138 times by 8 tests: return d->cache.at(idx);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
9138
178}-
179-
180bool QSqlCachedResult::isNull(int i)-
181{-
182 const QSqlCachedResultPrivate * const d = d_func();-
183 int idx = d->forwardOnly
d->forwardOnlyDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QSqlQuery
? i : at() * d->colCount + i;
0-10
184 if (i >= d->colCount
i >= d->colCountDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QSqlQuery
|| i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QSqlQuery
|| at() < 0
at() < 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QSqlQuery
|| idx >= d->rowCacheEnd
idx >= d->rowCacheEndDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-9
185 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QSqlQuery
1
186-
187 return
executed 9 times by 1 test: return d->cache.at(idx).isNull();
Executed by:
  • tst_QSqlQuery
d->cache.at(idx).isNull();
executed 9 times by 1 test: return d->cache.at(idx).isNull();
Executed by:
  • tst_QSqlQuery
9
188}-
189-
190void QSqlCachedResult::cleanup()-
191{-
192 QSqlCachedResultPrivate * const d = d_func();-
193 setAt(QSql::BeforeFirstRow);-
194 setActive(false);-
195 d->cleanup();-
196}
executed 7512 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
7512
197-
198void QSqlCachedResult::clearValues()-
199{-
200 QSqlCachedResultPrivate * const d = d_func();-
201 setAt(QSql::BeforeFirstRow);-
202 d->rowCacheEnd = 0;-
203 d->atEnd = false;-
204}
executed 119111 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
119111
205-
206bool QSqlCachedResult::cacheNext()-
207{-
208 QSqlCachedResultPrivate * const d = d_func();-
209 if (d->atEnd
d->atEndDescription
TRUEevaluated 262 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 36836 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
262-36836
210 return
executed 262 times by 5 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
false;
executed 262 times by 5 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
262
211-
212 if(isForwardOnly()
isForwardOnly()Description
TRUEevaluated 2237 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 34599 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
2237-34599
213 d->cache.resize(d->colCount);-
214 }
executed 2237 times by 8 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2237
215-
216 if (!gotoNext(d->cache, d->nextIndex())
!gotoNext(d->c...->nextIndex())Description
TRUEevaluated 838 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 35998 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
838-35998
217 d->revertLast();-
218 d->atEnd = true;-
219 return
executed 838 times by 8 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
false;
executed 838 times by 8 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
838
220 }-
221 setAt(at() + 1);-
222 return
executed 35998 times by 8 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
true;
executed 35998 times by 8 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
35998
223}-
224-
225int QSqlCachedResult::colCount() const-
226{-
227 const QSqlCachedResultPrivate * const d = d_func();-
228 return
never executed: return d->colCount;
d->colCount;
never executed: return d->colCount;
0
229}-
230-
231QSqlCachedResult::ValueCache &QSqlCachedResult::cache()-
232{-
233 QSqlCachedResultPrivate * const d = d_func();-
234 return
never executed: return d->cache;
d->cache;
never executed: return d->cache;
0
235}-
236-
237void QSqlCachedResult::virtual_hook(int id, void *data)-
238{-
239 QSqlResult::virtual_hook(id, data);-
240}
never executed: end of block
0
241-
242void QSqlCachedResult::detachFromResultSet()-
243{-
244 cleanup();-
245}
never executed: end of block
0
246-
247void QSqlCachedResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy)-
248{-
249 QSqlResult::setNumericalPrecisionPolicy(policy);-
250 cleanup();-
251}
executed 2794 times by 9 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2794
252-
253-
254-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9