Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | void QSqlQueryModelPrivate::prefetch(int limit) | - |
8 | { | - |
9 | QSqlQueryModel * const q = q_func(); | - |
10 | | - |
11 | if (atEnd || limit <= bottom.row() || bottom.column() == -1) evaluated: atEnd yes Evaluation Count:2 | yes Evaluation Count:388 |
partially evaluated: limit <= bottom.row() no Evaluation Count:0 | yes Evaluation Count:388 |
evaluated: bottom.column() == -1 yes Evaluation Count:1 | yes Evaluation Count:387 |
| 0-388 |
12 | return; executed: return; Execution Count:3 | 3 |
13 | | - |
14 | QModelIndex newBottom; | - |
15 | const int oldBottomRow = qMax(bottom.row(), 0); | - |
16 | | - |
17 | | - |
18 | if (query.seek(limit)) { evaluated: query.seek(limit) yes Evaluation Count:130 | yes Evaluation Count:257 |
| 130-257 |
19 | newBottom = q->createIndex(limit, bottom.column()); | - |
20 | } else { executed: } Execution Count:130 | 130 |
21 | | - |
22 | int i = oldBottomRow; | - |
23 | if (query.seek(i)) { evaluated: query.seek(i) yes Evaluation Count:246 | yes Evaluation Count:11 |
| 11-246 |
24 | while (query.next()) evaluated: query.next() yes Evaluation Count:526 | yes Evaluation Count:246 |
| 246-526 |
25 | ++i; executed: ++i; Execution Count:526 | 526 |
26 | newBottom = q->createIndex(i, bottom.column()); | - |
27 | } else { executed: } Execution Count:246 | 246 |
28 | | - |
29 | newBottom = q->createIndex(-1, bottom.column()); | - |
30 | } executed: } Execution Count:11 | 11 |
31 | atEnd = true; | - |
32 | } executed: } Execution Count:257 | 257 |
33 | if (newBottom.row() >= 0 && newBottom.row() > bottom.row()) { evaluated: newBottom.row() >= 0 yes Evaluation Count:376 | yes Evaluation Count:11 |
partially evaluated: newBottom.row() > bottom.row() yes Evaluation Count:376 | no Evaluation Count:0 |
| 0-376 |
34 | q->beginInsertRows(QModelIndex(), bottom.row() + 1, newBottom.row()); | - |
35 | bottom = newBottom; | - |
36 | q->endInsertRows(); | - |
37 | } else { executed: } Execution Count:376 | 376 |
38 | bottom = newBottom; | - |
39 | } executed: } Execution Count:11 | 11 |
40 | } | - |
41 | | - |
42 | QSqlQueryModelPrivate::~QSqlQueryModelPrivate() | - |
43 | { | - |
44 | } | - |
45 | | - |
46 | void QSqlQueryModelPrivate::initColOffsets(int size) | - |
47 | { | - |
48 | colOffsets.resize(size); | - |
49 | memset(colOffsets.data(), 0, colOffsets.size() * sizeof(int)); | - |
50 | } executed: } Execution Count:438 | 438 |
51 | | - |
52 | int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const | - |
53 | { | - |
54 | if (modelColumn < 0 || modelColumn >= rec.count() || !rec.isGenerated(modelColumn) || modelColumn >= colOffsets.size()) evaluated: modelColumn < 0 yes Evaluation Count:15 | yes Evaluation Count:3254 |
partially evaluated: modelColumn >= rec.count() no Evaluation Count:0 | yes Evaluation Count:3254 |
evaluated: !rec.isGenerated(modelColumn) yes Evaluation Count:12 | yes Evaluation Count:3242 |
partially evaluated: modelColumn >= colOffsets.size() no Evaluation Count:0 | yes Evaluation Count:3242 |
| 0-3254 |
55 | return -1; executed: return -1; Execution Count:27 | 27 |
56 | return modelColumn - colOffsets[modelColumn]; executed: return modelColumn - colOffsets[modelColumn]; Execution Count:3242 | 3242 |
57 | } | - |
58 | QSqlQueryModel::QSqlQueryModel(QObject *parent) | - |
59 | : QAbstractTableModel(*new QSqlQueryModelPrivate, parent) | - |
60 | { | - |
61 | } executed: } Execution Count:113 | 113 |
62 | | - |
63 | | - |
64 | | - |
65 | QSqlQueryModel::QSqlQueryModel(QSqlQueryModelPrivate &dd, QObject *parent) | - |
66 | : QAbstractTableModel(dd, parent) | - |
67 | { | - |
68 | } executed: } Execution Count:174 | 174 |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | QSqlQueryModel::~QSqlQueryModel() | - |
76 | { | - |
77 | } | - |
78 | void QSqlQueryModel::fetchMore(const QModelIndex &parent) | - |
79 | { | - |
80 | QSqlQueryModelPrivate * const d = d_func(); | - |
81 | if (parent.isValid()) partially evaluated: parent.isValid() no Evaluation Count:0 | yes Evaluation Count:390 |
| 0-390 |
82 | return; | 0 |
83 | d->prefetch(qMax(d->bottom.row(), 0) + 255); | - |
84 | } executed: } Execution Count:390 | 390 |
85 | bool QSqlQueryModel::canFetchMore(const QModelIndex &parent) const | - |
86 | { | - |
87 | const QSqlQueryModelPrivate * const d = d_func(); | - |
88 | return (!parent.isValid() && !d->atEnd); executed: return (!parent.isValid() && !d->atEnd); Execution Count:1029 | 1029 |
89 | } | - |
90 | | - |
91 | | - |
92 | | - |
93 | void QSqlQueryModel::beginInsertRows(const QModelIndex &parent, int first, int last) | - |
94 | { | - |
95 | QSqlQueryModelPrivate * const d = d_func(); | - |
96 | if (!d->nestedResetLevel) evaluated: !d->nestedResetLevel yes Evaluation Count:85 | yes Evaluation Count:364 |
| 85-364 |
97 | QAbstractTableModel::beginInsertRows(parent, first, last); executed: QAbstractTableModel::beginInsertRows(parent, first, last); Execution Count:85 | 85 |
98 | } executed: } Execution Count:449 | 449 |
99 | | - |
100 | | - |
101 | | - |
102 | void QSqlQueryModel::endInsertRows() | - |
103 | { | - |
104 | QSqlQueryModelPrivate * const d = d_func(); | - |
105 | if (!d->nestedResetLevel) evaluated: !d->nestedResetLevel yes Evaluation Count:85 | yes Evaluation Count:364 |
| 85-364 |
106 | QAbstractTableModel::endInsertRows(); executed: QAbstractTableModel::endInsertRows(); Execution Count:85 | 85 |
107 | } executed: } Execution Count:449 | 449 |
108 | | - |
109 | | - |
110 | | - |
111 | void QSqlQueryModel::beginRemoveRows(const QModelIndex &parent, int first, int last) | - |
112 | { | - |
113 | QSqlQueryModelPrivate * const d = d_func(); | - |
114 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
115 | QAbstractTableModel::beginRemoveRows(parent, first, last); executed: QAbstractTableModel::beginRemoveRows(parent, first, last); Execution Count:32 | 32 |
116 | } executed: } Execution Count:32 | 32 |
117 | | - |
118 | | - |
119 | | - |
120 | void QSqlQueryModel::endRemoveRows() | - |
121 | { | - |
122 | QSqlQueryModelPrivate * const d = d_func(); | - |
123 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
124 | QAbstractTableModel::endRemoveRows(); executed: QAbstractTableModel::endRemoveRows(); Execution Count:32 | 32 |
125 | } executed: } Execution Count:32 | 32 |
126 | | - |
127 | | - |
128 | | - |
129 | void QSqlQueryModel::beginInsertColumns(const QModelIndex &parent, int first, int last) | - |
130 | { | - |
131 | QSqlQueryModelPrivate * const d = d_func(); | - |
132 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
133 | QAbstractTableModel::beginInsertColumns(parent, first, last); executed: QAbstractTableModel::beginInsertColumns(parent, first, last); Execution Count:10 | 10 |
134 | } executed: } Execution Count:10 | 10 |
135 | | - |
136 | | - |
137 | | - |
138 | void QSqlQueryModel::endInsertColumns() | - |
139 | { | - |
140 | QSqlQueryModelPrivate * const d = d_func(); | - |
141 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
142 | QAbstractTableModel::endInsertColumns(); executed: QAbstractTableModel::endInsertColumns(); Execution Count:10 | 10 |
143 | } executed: } Execution Count:10 | 10 |
144 | | - |
145 | | - |
146 | | - |
147 | void QSqlQueryModel::beginRemoveColumns(const QModelIndex &parent, int first, int last) | - |
148 | { | - |
149 | QSqlQueryModelPrivate * const d = d_func(); | - |
150 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
151 | QAbstractTableModel::beginRemoveColumns(parent, first, last); executed: QAbstractTableModel::beginRemoveColumns(parent, first, last); Execution Count:4 | 4 |
152 | } executed: } Execution Count:4 | 4 |
153 | | - |
154 | | - |
155 | | - |
156 | void QSqlQueryModel::endRemoveColumns() | - |
157 | { | - |
158 | QSqlQueryModelPrivate * const d = d_func(); | - |
159 | if (!d->nestedResetLevel) partially evaluated: !d->nestedResetLevel yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
160 | QAbstractTableModel::endRemoveColumns(); executed: QAbstractTableModel::endRemoveColumns(); Execution Count:4 | 4 |
161 | } executed: } Execution Count:4 | 4 |
162 | | - |
163 | | - |
164 | | - |
165 | void QSqlQueryModel::beginResetModel() | - |
166 | { | - |
167 | QSqlQueryModelPrivate * const d = d_func(); | - |
168 | if (!d->nestedResetLevel) evaluated: !d->nestedResetLevel yes Evaluation Count:383 | yes Evaluation Count:316 |
| 316-383 |
169 | QAbstractTableModel::beginResetModel(); executed: QAbstractTableModel::beginResetModel(); Execution Count:383 | 383 |
170 | ++d->nestedResetLevel; | - |
171 | } executed: } Execution Count:699 | 699 |
172 | | - |
173 | | - |
174 | | - |
175 | void QSqlQueryModel::endResetModel() | - |
176 | { | - |
177 | QSqlQueryModelPrivate * const d = d_func(); | - |
178 | --d->nestedResetLevel; | - |
179 | if (!d->nestedResetLevel) evaluated: !d->nestedResetLevel yes Evaluation Count:383 | yes Evaluation Count:316 |
| 316-383 |
180 | QAbstractTableModel::endResetModel(); executed: QAbstractTableModel::endResetModel(); Execution Count:383 | 383 |
181 | } executed: } Execution Count:699 | 699 |
182 | int QSqlQueryModel::rowCount(const QModelIndex &index) const | - |
183 | { | - |
184 | const QSqlQueryModelPrivate * const d = d_func(); | - |
185 | return index.isValid() ? 0 : d->bottom.row() + 1; executed: return index.isValid() ? 0 : d->bottom.row() + 1; Execution Count:22167 | 22167 |
186 | } | - |
187 | | - |
188 | | - |
189 | | - |
190 | int QSqlQueryModel::columnCount(const QModelIndex &index) const | - |
191 | { | - |
192 | const QSqlQueryModelPrivate * const d = d_func(); | - |
193 | return index.isValid() ? 0 : d->rec.count(); executed: return index.isValid() ? 0 : d->rec.count(); Execution Count:20239 | 20239 |
194 | } | - |
195 | QVariant QSqlQueryModel::data(const QModelIndex &item, int role) const | - |
196 | { | - |
197 | const QSqlQueryModelPrivate * const d = d_func(); | - |
198 | if (!item.isValid()) evaluated: !item.isValid() yes Evaluation Count:519 | yes Evaluation Count:3240 |
| 519-3240 |
199 | return QVariant(); executed: return QVariant(); Execution Count:519 | 519 |
200 | | - |
201 | QVariant v; | - |
202 | if (role & ~(Qt::DisplayRole | Qt::EditRole)) evaluated: role & ~(Qt::DisplayRole | Qt::EditRole) yes Evaluation Count:9 | yes Evaluation Count:3231 |
| 9-3231 |
203 | return v; executed: return v; Execution Count:9 | 9 |
204 | | - |
205 | if (!d->rec.isGenerated(item.column())) evaluated: !d->rec.isGenerated(item.column()) yes Evaluation Count:20 | yes Evaluation Count:3211 |
| 20-3211 |
206 | return v; executed: return v; Execution Count:20 | 20 |
207 | QModelIndex dItem = indexInQuery(item); | - |
208 | if (dItem.row() > d->bottom.row()) partially evaluated: dItem.row() > d->bottom.row() no Evaluation Count:0 | yes Evaluation Count:3211 |
| 0-3211 |
209 | const_cast<QSqlQueryModelPrivate *>(d)->prefetch(dItem.row()); never executed: const_cast<QSqlQueryModelPrivate *>(d)->prefetch(dItem.row()); | 0 |
210 | | - |
211 | if (!d->query.seek(dItem.row())) { partially evaluated: !d->query.seek(dItem.row()) no Evaluation Count:0 | yes Evaluation Count:3211 |
| 0-3211 |
212 | d->error = d->query.lastError(); | - |
213 | return v; never executed: return v; | 0 |
214 | } | - |
215 | | - |
216 | return d->query.value(dItem.column()); executed: return d->query.value(dItem.column()); Execution Count:3211 | 3211 |
217 | } | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, int role) const | - |
224 | { | - |
225 | const QSqlQueryModelPrivate * const d = d_func(); | - |
226 | if (orientation == Qt::Horizontal) { evaluated: orientation == Qt::Horizontal yes Evaluation Count:32 | yes Evaluation Count:1601 |
| 32-1601 |
227 | QVariant val = d->headers.value(section).value(role); | - |
228 | if (role == Qt::DisplayRole && !val.isValid()) evaluated: role == Qt::DisplayRole yes Evaluation Count:27 | yes Evaluation Count:5 |
partially evaluated: !val.isValid() yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
229 | val = d->headers.value(section).value(Qt::EditRole); executed: val = d->headers.value(section).value(Qt::EditRole); Execution Count:27 | 27 |
230 | if (val.isValid()) evaluated: val.isValid() yes Evaluation Count:2 | yes Evaluation Count:30 |
| 2-30 |
231 | return val; executed: return val; Execution Count:2 | 2 |
232 | if (role == Qt::DisplayRole && d->rec.count() > section && d->columnInQuery(section) != -1) evaluated: role == Qt::DisplayRole yes Evaluation Count:25 | yes Evaluation Count:5 |
evaluated: d->rec.count() > section yes Evaluation Count:20 | yes Evaluation Count:5 |
evaluated: d->columnInQuery(section) != -1 yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-25 |
233 | return d->rec.fieldName(section); executed: return d->rec.fieldName(section); Execution Count:16 | 16 |
234 | } executed: } Execution Count:14 | 14 |
235 | return QAbstractItemModel::headerData(section, orientation, role); executed: return QAbstractItemModel::headerData(section, orientation, role); Execution Count:1615 | 1615 |
236 | } | - |
237 | void QSqlQueryModel::queryChange() | - |
238 | { | - |
239 | | - |
240 | } | - |
241 | void QSqlQueryModel::setQuery(const QSqlQuery &query) | - |
242 | { | - |
243 | QSqlQueryModelPrivate * const d = d_func(); | - |
244 | beginResetModel(); | - |
245 | | - |
246 | QSqlRecord newRec = query.record(); | - |
247 | bool columnsChanged = (newRec != d->rec); | - |
248 | | - |
249 | if (d->colOffsets.size() != newRec.count() || columnsChanged) evaluated: d->colOffsets.size() != newRec.count() yes Evaluation Count:66 | yes Evaluation Count:316 |
evaluated: columnsChanged yes Evaluation Count:187 | yes Evaluation Count:129 |
| 66-316 |
250 | d->initColOffsets(newRec.count()); executed: d->initColOffsets(newRec.count()); Execution Count:253 | 253 |
251 | | - |
252 | d->bottom = QModelIndex(); | - |
253 | d->error = QSqlError(); | - |
254 | d->query = query; | - |
255 | d->rec = newRec; | - |
256 | d->atEnd = true; | - |
257 | | - |
258 | if (query.isForwardOnly()) { partially evaluated: query.isForwardOnly() no Evaluation Count:0 | yes Evaluation Count:382 |
| 0-382 |
259 | d->error = QSqlError(QLatin1String("Forward-only queries " | - |
260 | "cannot be used in a data model"), | - |
261 | QString(), QSqlError::ConnectionError); | - |
262 | endResetModel(); | - |
263 | return; | 0 |
264 | } | - |
265 | | - |
266 | if (!query.isActive()) { evaluated: !query.isActive() yes Evaluation Count:7 | yes Evaluation Count:375 |
| 7-375 |
267 | d->error = query.lastError(); | - |
268 | endResetModel(); | - |
269 | return; executed: return; Execution Count:7 | 7 |
270 | } | - |
271 | | - |
272 | if (query.driver()->hasFeature(QSqlDriver::QuerySize) && d->query.size() > 0) { partially evaluated: query.driver()->hasFeature(QSqlDriver::QuerySize) no Evaluation Count:0 | yes Evaluation Count:375 |
never evaluated: d->query.size() > 0 | 0-375 |
273 | d->bottom = createIndex(d->query.size() - 1, d->rec.count() - 1); | - |
274 | } else { | 0 |
275 | d->bottom = createIndex(-1, d->rec.count() - 1); | - |
276 | d->atEnd = false; | - |
277 | } executed: } Execution Count:375 | 375 |
278 | | - |
279 | | - |
280 | | - |
281 | fetchMore(); | - |
282 | | - |
283 | endResetModel(); | - |
284 | queryChange(); | - |
285 | } executed: } Execution Count:375 | 375 |
286 | void QSqlQueryModel::setQuery(const QString &query, const QSqlDatabase &db) | - |
287 | { | - |
288 | setQuery(QSqlQuery(query, db)); | - |
289 | } executed: } Execution Count:57 | 57 |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | void QSqlQueryModel::clear() | - |
295 | { | - |
296 | QSqlQueryModelPrivate * const d = d_func(); | - |
297 | d->error = QSqlError(); | - |
298 | d->atEnd = true; | - |
299 | d->query.clear(); | - |
300 | d->rec.clear(); | - |
301 | d->colOffsets.clear(); | - |
302 | d->bottom = QModelIndex(); | - |
303 | d->headers.clear(); | - |
304 | } executed: } Execution Count:190 | 190 |
305 | bool QSqlQueryModel::setHeaderData(int section, Qt::Orientation orientation, | - |
306 | const QVariant &value, int role) | - |
307 | { | - |
308 | QSqlQueryModelPrivate * const d = d_func(); | - |
309 | if (orientation != Qt::Horizontal || section < 0 || columnCount() <= section) evaluated: orientation != Qt::Horizontal yes Evaluation Count:4 | yes Evaluation Count:18 |
evaluated: section < 0 yes Evaluation Count:6 | yes Evaluation Count:12 |
evaluated: columnCount() <= section yes Evaluation Count:6 | yes Evaluation Count:6 |
| 4-18 |
310 | return false; executed: return false; Execution Count:16 | 16 |
311 | | - |
312 | if (d->headers.size() <= section) evaluated: d->headers.size() <= section yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
313 | d->headers.resize(qMax(section + 1, 16)); executed: d->headers.resize(qMax(section + 1, 16)); Execution Count:4 | 4 |
314 | d->headers[section][role] = value; | - |
315 | headerDataChanged(orientation, section, section); | - |
316 | return true; executed: return true; Execution Count:6 | 6 |
317 | } | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | QSqlQuery QSqlQueryModel::query() const | - |
325 | { | - |
326 | const QSqlQueryModelPrivate * const d = d_func(); | - |
327 | return d->query; never executed: return d->query; | 0 |
328 | } | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | QSqlError QSqlQueryModel::lastError() const | - |
337 | { | - |
338 | const QSqlQueryModelPrivate * const d = d_func(); | - |
339 | return d->error; executed: return d->error; Execution Count:796 | 796 |
340 | } | - |
341 | | - |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | | - |
348 | void QSqlQueryModel::setLastError(const QSqlError &error) | - |
349 | { | - |
350 | QSqlQueryModelPrivate * const d = d_func(); | - |
351 | d->error = error; | - |
352 | } | 0 |
353 | QSqlRecord QSqlQueryModel::record(int row) const | - |
354 | { | - |
355 | const QSqlQueryModelPrivate * const d = d_func(); | - |
356 | if (row < 0) partially evaluated: row < 0 no Evaluation Count:0 | yes Evaluation Count:250 |
| 0-250 |
357 | return d->rec; never executed: return d->rec; | 0 |
358 | | - |
359 | QSqlRecord rec = d->rec; | - |
360 | for (int i = 0; i < rec.count(); ++i) evaluated: i < rec.count() yes Evaluation Count:606 | yes Evaluation Count:250 |
| 250-606 |
361 | rec.setValue(i, data(createIndex(row, i), Qt::EditRole)); executed: rec.setValue(i, data(createIndex(row, i), Qt::EditRole)); Execution Count:606 | 606 |
362 | return rec; executed: return rec; Execution Count:250 | 250 |
363 | } | - |
364 | QSqlRecord QSqlQueryModel::record() const | - |
365 | { | - |
366 | const QSqlQueryModelPrivate * const d = d_func(); | - |
367 | return d->rec; executed: return d->rec; Execution Count:21 | 21 |
368 | } | - |
369 | bool QSqlQueryModel::insertColumns(int column, int count, const QModelIndex &parent) | - |
370 | { | - |
371 | QSqlQueryModelPrivate * const d = d_func(); | - |
372 | if (count <= 0 || parent.isValid() || column < 0 || column > d->rec.count()) partially evaluated: count <= 0 no Evaluation Count:0 | yes Evaluation Count:14 |
evaluated: parent.isValid() yes Evaluation Count:1 | yes Evaluation Count:13 |
evaluated: column < 0 yes Evaluation Count:1 | yes Evaluation Count:12 |
evaluated: column > d->rec.count() yes Evaluation Count:2 | yes Evaluation Count:10 |
| 0-14 |
373 | return false; executed: return false; Execution Count:4 | 4 |
374 | | - |
375 | beginInsertColumns(parent, column, column + count - 1); | - |
376 | for (int c = 0; c < count; ++c) { evaluated: c < count yes Evaluation Count:10 | yes Evaluation Count:10 |
| 10 |
377 | QSqlField field; | - |
378 | field.setReadOnly(true); | - |
379 | field.setGenerated(false); | - |
380 | d->rec.insert(column, field); | - |
381 | if (d->colOffsets.size() < d->rec.count()) { evaluated: d->colOffsets.size() < d->rec.count() yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
382 | int nVal = d->colOffsets.isEmpty() ? 0 : d->colOffsets[d->colOffsets.size() - 1]; partially evaluated: d->colOffsets.isEmpty() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
383 | d->colOffsets.append(nVal); | - |
384 | qt_noop(); | - |
385 | } executed: } Execution Count:9 | 9 |
386 | for (int i = column + 1; i < d->colOffsets.count(); ++i) evaluated: i < d->colOffsets.count() yes Evaluation Count:22 | yes Evaluation Count:10 |
| 10-22 |
387 | ++d->colOffsets[i]; executed: ++d->colOffsets[i]; Execution Count:22 | 22 |
388 | } executed: } Execution Count:10 | 10 |
389 | endInsertColumns(); | - |
390 | return true; executed: return true; Execution Count:10 | 10 |
391 | } | - |
392 | bool QSqlQueryModel::removeColumns(int column, int count, const QModelIndex &parent) | - |
393 | { | - |
394 | QSqlQueryModelPrivate * const d = d_func(); | - |
395 | if (count <= 0 || parent.isValid() || column < 0 || column >= d->rec.count()) partially evaluated: count <= 0 no Evaluation Count:0 | yes Evaluation Count:7 |
evaluated: parent.isValid() yes Evaluation Count:1 | yes Evaluation Count:6 |
partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: column >= d->rec.count() yes Evaluation Count:2 | yes Evaluation Count:4 |
| 0-7 |
396 | return false; executed: return false; Execution Count:3 | 3 |
397 | | - |
398 | beginRemoveColumns(parent, column, column + count - 1); | - |
399 | | - |
400 | int i; | - |
401 | for (i = 0; i < count; ++i) evaluated: i < count yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
402 | d->rec.remove(column); executed: d->rec.remove(column); Execution Count:4 | 4 |
403 | for (i = column; i < d->colOffsets.count(); ++i) evaluated: i < d->colOffsets.count() yes Evaluation Count:9 | yes Evaluation Count:4 |
| 4-9 |
404 | d->colOffsets[i] -= count; executed: d->colOffsets[i] -= count; Execution Count:9 | 9 |
405 | | - |
406 | endRemoveColumns(); | - |
407 | return true; executed: return true; Execution Count:4 | 4 |
408 | } | - |
409 | QModelIndex QSqlQueryModel::indexInQuery(const QModelIndex &item) const | - |
410 | { | - |
411 | const QSqlQueryModelPrivate * const d = d_func(); | - |
412 | int modelColumn = d->columnInQuery(item.column()); | - |
413 | if (modelColumn < 0) evaluated: modelColumn < 0 yes Evaluation Count:23 | yes Evaluation Count:3226 |
| 23-3226 |
414 | return QModelIndex(); executed: return QModelIndex(); Execution Count:23 | 23 |
415 | return createIndex(item.row(), modelColumn, item.internalPointer()); executed: return createIndex(item.row(), modelColumn, item.internalPointer()); Execution Count:3226 | 3226 |
416 | } | - |
417 | | - |
418 | | - |
419 | | - |
| | |