Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | struct QHolder { | - |
6 | QHolder(const QString& hldr = QString(), int index = -1): holderName(hldr), holderPos(index) {} executed: } Execution Count:18 | 18 |
7 | bool operator==(const QHolder& h) const { return h.holderPos == holderPos && h.holderName == holderName; } never executed: return h.holderPos == holderPos && h.holderName == holderName; | 0 |
8 | bool operator!=(const QHolder& h) const { return h.holderPos != holderPos || h.holderName != holderName; } never executed: return h.holderPos != holderPos || h.holderName != holderName; | 0 |
9 | QString holderName; | - |
10 | int holderPos; | - |
11 | }; | - |
12 | | - |
13 | class QSqlResultPrivate | - |
14 | { | - |
15 | public: | - |
16 | QSqlResultPrivate(QSqlResult* d) | - |
17 | : q(d), idx(QSql::BeforeFirstRow), active(false), | - |
18 | isSel(false), forwardOnly(false), precisionPolicy(QSql::LowPrecisionDouble), bindCount(0), binds(QSqlResult::PositionalBinding) | - |
19 | {} executed: } Execution Count:2111 | 2111 |
20 | | - |
21 | void clearValues() | - |
22 | { | - |
23 | values.clear(); | - |
24 | bindCount = 0; | - |
25 | } executed: } Execution Count:2607 | 2607 |
26 | | - |
27 | void resetBindCount() | - |
28 | { | - |
29 | bindCount = 0; | - |
30 | } executed: } Execution Count:116708 | 116708 |
31 | | - |
32 | void clearIndex() | - |
33 | { | - |
34 | indexes.clear(); | - |
35 | holders.clear(); | - |
36 | types.clear(); | - |
37 | } executed: } Execution Count:2607 | 2607 |
38 | | - |
39 | void clear() | - |
40 | { | - |
41 | clearValues(); | - |
42 | clearIndex();; | - |
43 | } executed: } Execution Count:2607 | 2607 |
44 | | - |
45 | QString positionalToNamedBinding(); | - |
46 | QString namedToPositionalBinding(); | - |
47 | QString holderAt(int index) const; | - |
48 | | - |
49 | public: | - |
50 | QSqlResult* q; | - |
51 | QPointer<QSqlDriver> sqldriver; | - |
52 | int idx; | - |
53 | QString sql; | - |
54 | bool active; | - |
55 | bool isSel; | - |
56 | QSqlError error; | - |
57 | bool forwardOnly; | - |
58 | QSql::NumericalPrecisionPolicy precisionPolicy; | - |
59 | | - |
60 | int bindCount; | - |
61 | QSqlResult::BindingSyntax binds; | - |
62 | | - |
63 | QString executedQuery; | - |
64 | QHash<int, QSql::ParamType> types; | - |
65 | QVector<QVariant> values; | - |
66 | typedef QHash<QString, QList<int> > IndexMap; | - |
67 | IndexMap indexes; | - |
68 | | - |
69 | typedef QVector<QHolder> QHolderVector; | - |
70 | QHolderVector holders; | - |
71 | }; | - |
72 | | - |
73 | static QString qFieldSerial(int); | - |
74 | | - |
75 | QString QSqlResultPrivate::holderAt(int index) const | - |
76 | { | - |
77 | return holders.size() > index ? holders.at(index).holderName : qFieldSerial(index); executed: return holders.size() > index ? holders.at(index).holderName : qFieldSerial(index); Execution Count:136 | 136 |
78 | } | - |
79 | | - |
80 | | - |
81 | static QString qFieldSerial(int i) | - |
82 | { | - |
83 | ushort arr[] = { ':', 'f', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | - |
84 | ushort *ptr = &arr[1]; | - |
85 | | - |
86 | while (i > 0) { evaluated: i > 0 yes Evaluation Count:116806 | yes Evaluation Count:233532 |
| 116806-233532 |
87 | *(++ptr) = 'a' + i % 16; | - |
88 | i >>= 4; | - |
89 | } executed: } Execution Count:116806 | 116806 |
90 | | - |
91 | return QString(reinterpret_cast<const QChar *>(arr), int(ptr - arr) + 1); executed: return QString(reinterpret_cast<const QChar *>(arr), int(ptr - arr) + 1); Execution Count:233532 | 233532 |
92 | } | - |
93 | | - |
94 | static bool qIsAlnum(QChar ch) | - |
95 | { | - |
96 | uint u = uint(ch.unicode()); | - |
97 | | - |
98 | return u - 'a' < 26 || u - 'A' < 26 || u - '0' < 10 || u == '_'; executed: return u - 'a' < 26 || u - 'A' < 26 || u - '0' < 10 || u == '_'; Execution Count:62 | 62 |
99 | } | - |
100 | | - |
101 | QString QSqlResultPrivate::positionalToNamedBinding() | - |
102 | { | - |
103 | int n = sql.size(); | - |
104 | | - |
105 | QString result; | - |
106 | result.reserve(n * 5 / 4); | - |
107 | bool inQuote = false; | - |
108 | int count = 0; | - |
109 | | - |
110 | for (int i = 0; i < n; ++i) { evaluated: i < n yes Evaluation Count:53 | yes Evaluation Count:1 |
| 1-53 |
111 | QChar ch = sql.at(i); | - |
112 | if (ch == QLatin1Char('?') && !inQuote) { evaluated: ch == QLatin1Char('?') yes Evaluation Count:3 | yes Evaluation Count:50 |
partially evaluated: !inQuote yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-50 |
113 | result += qFieldSerial(count++); | - |
114 | } else { executed: } Execution Count:3 | 3 |
115 | if (ch == QLatin1Char('\'')) partially evaluated: ch == QLatin1Char('\'') no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
116 | inQuote = !inQuote; never executed: inQuote = !inQuote; | 0 |
117 | result += ch; | - |
118 | } executed: } Execution Count:50 | 50 |
119 | } | - |
120 | result.squeeze(); | - |
121 | return result; executed: return result; Execution Count:1 | 1 |
122 | } | - |
123 | | - |
124 | QString QSqlResultPrivate::namedToPositionalBinding() | - |
125 | { | - |
126 | int n = sql.size(); | - |
127 | | - |
128 | QString result; | - |
129 | result.reserve(n); | - |
130 | bool inQuote = false; | - |
131 | int count = 0; | - |
132 | int i = 0; | - |
133 | | - |
134 | while (i < n) { evaluated: i < n yes Evaluation Count:11836 | yes Evaluation Count:218 |
| 218-11836 |
135 | QChar ch = sql.at(i); | - |
136 | if (ch == QLatin1Char(':') && !inQuote evaluated: ch == QLatin1Char(':') yes Evaluation Count:15 | yes Evaluation Count:11821 |
partially evaluated: !inQuote yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-11821 |
137 | && (i == 0 || sql.at(i - 1) != QLatin1Char(':')) partially evaluated: i == 0 no Evaluation Count:0 | yes Evaluation Count:15 |
partially evaluated: sql.at(i - 1) != QLatin1Char(':') yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
138 | && (i + 1 < n && qIsAlnum(sql.at(i + 1)))) { partially evaluated: i + 1 < n yes Evaluation Count:15 | no Evaluation Count:0 |
partially evaluated: qIsAlnum(sql.at(i + 1)) yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
139 | int pos = i + 2; | - |
140 | while (pos < n && qIsAlnum(sql.at(pos))) evaluated: pos < n yes Evaluation Count:39 | yes Evaluation Count:3 |
evaluated: qIsAlnum(sql.at(pos)) yes Evaluation Count:27 | yes Evaluation Count:12 |
| 3-39 |
141 | ++pos; executed: ++pos; Execution Count:27 | 27 |
142 | QString holder(sql.mid(i, pos - i)); | - |
143 | indexes[holder].append(count++); | - |
144 | holders.append(QHolder(holder, i)); | - |
145 | result += QLatin1Char('?'); | - |
146 | i = pos; | - |
147 | } else { executed: } Execution Count:15 | 15 |
148 | if (ch == QLatin1Char('\'')) evaluated: ch == QLatin1Char('\'') yes Evaluation Count:5 | yes Evaluation Count:11816 |
| 5-11816 |
149 | inQuote = !inQuote; executed: inQuote = !inQuote; Execution Count:5 | 5 |
150 | result += ch; | - |
151 | ++i; | - |
152 | } executed: } Execution Count:11821 | 11821 |
153 | } | - |
154 | result.squeeze(); | - |
155 | values.resize(holders.size()); | - |
156 | return result; executed: return result; Execution Count:218 | 218 |
157 | } | - |
158 | QSqlResult::QSqlResult(const QSqlDriver *db) | - |
159 | { | - |
160 | d = new QSqlResultPrivate(this); | - |
161 | d->sqldriver = const_cast<QSqlDriver *>(db); | - |
162 | if(db) { partially evaluated: db yes Evaluation Count:2111 | no Evaluation Count:0 |
| 0-2111 |
163 | setNumericalPrecisionPolicy(db->numericalPrecisionPolicy()); | - |
164 | } executed: } Execution Count:2111 | 2111 |
165 | } executed: } Execution Count:2111 | 2111 |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | QSqlResult::~QSqlResult() | - |
172 | { | - |
173 | delete d; | - |
174 | } executed: } Execution Count:2111 | 2111 |
175 | void QSqlResult::setQuery(const QString& query) | - |
176 | { | - |
177 | d->sql = query; | - |
178 | } executed: } Execution Count:2392 | 2392 |
179 | QString QSqlResult::lastQuery() const | - |
180 | { | - |
181 | return d->sql; executed: return d->sql; Execution Count:108 | 108 |
182 | } | - |
183 | int QSqlResult::at() const | - |
184 | { | - |
185 | return d->idx; executed: return d->idx; Execution Count:102601 | 102601 |
186 | } | - |
187 | bool QSqlResult::isValid() const | - |
188 | { | - |
189 | return d->idx != QSql::BeforeFirstRow && d->idx != QSql::AfterLastRow; executed: return d->idx != QSql::BeforeFirstRow && d->idx != QSql::AfterLastRow; Execution Count:9521 | 9521 |
190 | } | - |
191 | bool QSqlResult::isActive() const | - |
192 | { | - |
193 | return d->active; executed: return d->active; Execution Count:19851 | 19851 |
194 | } | - |
195 | void QSqlResult::setAt(int index) | - |
196 | { | - |
197 | d->idx = index; | - |
198 | } executed: } Execution Count:291266 | 291266 |
199 | void QSqlResult::setSelect(bool select) | - |
200 | { | - |
201 | d->isSel = select; | - |
202 | } executed: } Execution Count:121549 | 121549 |
203 | bool QSqlResult::isSelect() const | - |
204 | { | - |
205 | return d->isSel; executed: return d->isSel; Execution Count:7490 | 7490 |
206 | } | - |
207 | | - |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | | - |
213 | const QSqlDriver *QSqlResult::driver() const | - |
214 | { | - |
215 | return d->sqldriver; executed: return d->sqldriver; Execution Count:16642 | 16642 |
216 | } | - |
217 | void QSqlResult::setActive(bool active) | - |
218 | { | - |
219 | if (active && d->executedQuery.isEmpty()) evaluated: active yes Evaluation Count:26671 | yes Evaluation Count:106437 |
evaluated: d->executedQuery.isEmpty() yes Evaluation Count:1180 | yes Evaluation Count:25491 |
| 1180-106437 |
220 | d->executedQuery = d->sql; executed: d->executedQuery = d->sql; Execution Count:1180 | 1180 |
221 | | - |
222 | d->active = active; | - |
223 | } executed: } Execution Count:133108 | 133108 |
224 | void QSqlResult::setLastError(const QSqlError &error) | - |
225 | { | - |
226 | d->error = error; | - |
227 | } executed: } Execution Count:306299 | 306299 |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | QSqlError QSqlResult::lastError() const | - |
235 | { | - |
236 | return d->error; executed: return d->error; Execution Count:246654 | 246654 |
237 | } | - |
238 | bool QSqlResult::fetchNext() | - |
239 | { | - |
240 | return fetch(at() + 1); never executed: return fetch(at() + 1); | 0 |
241 | } | - |
242 | bool QSqlResult::fetchPrevious() | - |
243 | { | - |
244 | return fetch(at() - 1); never executed: return fetch(at() - 1); | 0 |
245 | } | - |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | bool QSqlResult::isForwardOnly() const | - |
254 | { | - |
255 | return d->forwardOnly; executed: return d->forwardOnly; Execution Count:42118 | 42118 |
256 | } | - |
257 | void QSqlResult::setForwardOnly(bool forward) | - |
258 | { | - |
259 | d->forwardOnly = forward; | - |
260 | } executed: } Execution Count:621 | 621 |
261 | bool QSqlResult::savePrepare(const QString& query) | - |
262 | { | - |
263 | if (!driver()) partially evaluated: !driver() no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
264 | return false; never executed: return false; | 0 |
265 | d->clear(); | - |
266 | d->sql = query; | - |
267 | if (!driver()->hasFeature(QSqlDriver::PreparedQueries)) partially evaluated: !driver()->hasFeature(QSqlDriver::PreparedQueries) no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
268 | return prepare(query); never executed: return prepare(query); | 0 |
269 | | - |
270 | if (driver()->hasFeature(QSqlDriver::NamedPlaceholders)) { evaluated: driver()->hasFeature(QSqlDriver::NamedPlaceholders) yes Evaluation Count:1 | yes Evaluation Count:217 |
| 1-217 |
271 | | - |
272 | d->namedToPositionalBinding(); | - |
273 | d->executedQuery = d->positionalToNamedBinding(); | - |
274 | } else { executed: } Execution Count:1 | 1 |
275 | d->executedQuery = d->namedToPositionalBinding(); | - |
276 | } executed: } Execution Count:217 | 217 |
277 | return prepare(d->executedQuery); executed: return prepare(d->executedQuery); Execution Count:218 | 218 |
278 | } | - |
279 | bool QSqlResult::prepare(const QString& query) | - |
280 | { | - |
281 | if (d->holders.isEmpty()) { partially evaluated: d->holders.isEmpty() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
282 | int n = query.size(); | - |
283 | | - |
284 | bool inQuote = false; | - |
285 | int i = 0; | - |
286 | | - |
287 | while (i < n) { evaluated: i < n yes Evaluation Count:53 | yes Evaluation Count:1 |
| 1-53 |
288 | QChar ch = query.at(i); | - |
289 | if (ch == QLatin1Char(':') && !inQuote evaluated: ch == QLatin1Char(':') yes Evaluation Count:3 | yes Evaluation Count:50 |
partially evaluated: !inQuote yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-50 |
290 | && (i == 0 || query.at(i - 1) != QLatin1Char(':')) partially evaluated: i == 0 no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: query.at(i - 1) != QLatin1Char(':') yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
291 | && (i + 1 < n && qIsAlnum(query.at(i + 1)))) { partially evaluated: i + 1 < n yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: qIsAlnum(query.at(i + 1)) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
292 | int pos = i + 2; | - |
293 | while (pos < n && qIsAlnum(query.at(pos))) partially evaluated: pos < n yes Evaluation Count:5 | no Evaluation Count:0 |
evaluated: qIsAlnum(query.at(pos)) yes Evaluation Count:2 | yes Evaluation Count:3 |
| 0-5 |
294 | ++pos; executed: ++pos; Execution Count:2 | 2 |
295 | | - |
296 | QString holder(query.mid(i, pos - i)); | - |
297 | d->indexes[holder].append(d->holders.size()); | - |
298 | d->holders.append(QHolder(holder, i)); | - |
299 | i = pos; | - |
300 | } else { executed: } Execution Count:3 | 3 |
301 | if (ch == QLatin1Char('\'')) partially evaluated: ch == QLatin1Char('\'') no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
302 | inQuote = !inQuote; never executed: inQuote = !inQuote; | 0 |
303 | ++i; | - |
304 | } executed: } Execution Count:50 | 50 |
305 | } | - |
306 | d->values.resize(d->holders.size()); | - |
307 | } executed: } Execution Count:1 | 1 |
308 | d->sql = query; | - |
309 | return true; executed: return true; Execution Count:1 | 1 |
310 | } | - |
311 | | - |
312 | | - |
313 | | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | bool QSqlResult::exec() | - |
319 | { | - |
320 | bool ret; | - |
321 | | - |
322 | QString query = lastQuery(); | - |
323 | if (d->binds == NamedBinding) { never evaluated: d->binds == NamedBinding | 0 |
324 | int i; | - |
325 | QVariant val; | - |
326 | QString holder; | - |
327 | for (i = d->holders.count() - 1; i >= 0; --i) { | 0 |
328 | holder = d->holders.at(i).holderName; | - |
329 | val = d->values.value(d->indexes.value(holder).value(0,-1)); | - |
330 | QSqlField f(QLatin1String(""), val.type()); | - |
331 | f.setValue(val); | - |
332 | query = query.replace(d->holders.at(i).holderPos, | - |
333 | holder.length(), driver()->formatValue(f)); | - |
334 | } | 0 |
335 | } else { | 0 |
336 | QString val; | - |
337 | int i = 0; | - |
338 | int idx = 0; | - |
339 | for (idx = 0; idx < d->values.count(); ++idx) { never evaluated: idx < d->values.count() | 0 |
340 | i = query.indexOf(QLatin1Char('?'), i); | - |
341 | if (i == -1) | 0 |
342 | continue; never executed: continue; | 0 |
343 | QVariant var = d->values.value(idx); | - |
344 | QSqlField f(QLatin1String(""), var.type()); | - |
345 | if (var.isNull()) never evaluated: var.isNull() | 0 |
346 | f.clear(); never executed: f.clear(); | 0 |
347 | else | - |
348 | f.setValue(var); never executed: f.setValue(var); | 0 |
349 | val = driver()->formatValue(f); | - |
350 | query = query.replace(i, 1, driver()->formatValue(f)); | - |
351 | i += val.length(); | - |
352 | } | 0 |
353 | } | 0 |
354 | | - |
355 | | - |
356 | QString orig = lastQuery(); | - |
357 | ret = reset(query); | - |
358 | d->executedQuery = query; | - |
359 | setQuery(orig); | - |
360 | d->resetBindCount(); | - |
361 | return ret; never executed: return ret; | 0 |
362 | } | - |
363 | | - |
364 | | - |
365 | | - |
366 | | - |
367 | | - |
368 | | - |
369 | | - |
370 | void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType paramType) | - |
371 | { | - |
372 | d->binds = PositionalBinding; | - |
373 | d->indexes[qFieldSerial(index)].append(index); | - |
374 | if (d->values.count() <= index) evaluated: d->values.count() <= index yes Evaluation Count:431 | yes Evaluation Count:232974 |
| 431-232974 |
375 | d->values.resize(index + 1); executed: d->values.resize(index + 1); Execution Count:431 | 431 |
376 | d->values[index] = val; | - |
377 | if (paramType != QSql::In || !d->types.isEmpty()) partially evaluated: paramType != QSql::In no Evaluation Count:0 | yes Evaluation Count:233405 |
partially evaluated: !d->types.isEmpty() no Evaluation Count:0 | yes Evaluation Count:233405 |
| 0-233405 |
378 | d->types[index] = paramType; never executed: d->types[index] = paramType; | 0 |
379 | } executed: } Execution Count:233405 | 233405 |
380 | void QSqlResult::bindValue(const QString& placeholder, const QVariant& val, | - |
381 | QSql::ParamType paramType) | - |
382 | { | - |
383 | d->binds = NamedBinding; | - |
384 | | - |
385 | | - |
386 | QList<int> indexes = d->indexes.value(placeholder); | - |
387 | for (QForeachContainer<__typeof__(indexes)> _container_(indexes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (int idx = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
388 | if (d->values.count() <= idx) partially evaluated: d->values.count() <= idx no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
389 | d->values.resize(idx + 1); never executed: d->values.resize(idx + 1); | 0 |
390 | d->values[idx] = val; | - |
391 | if (paramType != QSql::In || !d->types.isEmpty()) partially evaluated: paramType != QSql::In no Evaluation Count:0 | yes Evaluation Count:38 |
partially evaluated: !d->types.isEmpty() no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
392 | d->types[idx] = paramType; never executed: d->types[idx] = paramType; | 0 |
393 | } executed: } Execution Count:38 | 38 |
394 | } executed: } Execution Count:46 | 46 |
395 | | - |
396 | | - |
397 | | - |
398 | | - |
399 | | - |
400 | | - |
401 | | - |
402 | void QSqlResult::addBindValue(const QVariant& val, QSql::ParamType paramType) | - |
403 | { | - |
404 | d->binds = PositionalBinding; | - |
405 | bindValue(d->bindCount, val, paramType); | - |
406 | ++d->bindCount; | - |
407 | } executed: } Execution Count:233334 | 233334 |
408 | | - |
409 | | - |
410 | | - |
411 | | - |
412 | | - |
413 | | - |
414 | | - |
415 | QVariant QSqlResult::boundValue(int index) const | - |
416 | { | - |
417 | return d->values.value(index); executed: return d->values.value(index); Execution Count:1 | 1 |
418 | } | - |
419 | QVariant QSqlResult::boundValue(const QString& placeholder) const | - |
420 | { | - |
421 | QList<int> indexes = d->indexes.value(placeholder); | - |
422 | return d->values.value(indexes.value(0,-1)); never executed: return d->values.value(indexes.value(0,-1)); | 0 |
423 | } | - |
424 | | - |
425 | | - |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | QSql::ParamType QSqlResult::bindValueType(int index) const | - |
431 | { | - |
432 | return d->types.value(index, QSql::In); never executed: return d->types.value(index, QSql::In); | 0 |
433 | } | - |
434 | | - |
435 | | - |
436 | | - |
437 | | - |
438 | | - |
439 | | - |
440 | | - |
441 | QSql::ParamType QSqlResult::bindValueType(const QString& placeholder) const | - |
442 | { | - |
443 | return d->types.value(d->indexes.value(placeholder).value(0,-1), QSql::In); never executed: return d->types.value(d->indexes.value(placeholder).value(0,-1), QSql::In); | 0 |
444 | } | - |
445 | | - |
446 | | - |
447 | | - |
448 | | - |
449 | | - |
450 | | - |
451 | int QSqlResult::boundValueCount() const | - |
452 | { | - |
453 | return d->values.count(); never executed: return d->values.count(); | 0 |
454 | } | - |
455 | | - |
456 | | - |
457 | | - |
458 | | - |
459 | | - |
460 | | - |
461 | | - |
462 | QVector<QVariant>& QSqlResult::boundValues() const | - |
463 | { | - |
464 | return d->values; executed: return d->values; Execution Count:118992 | 118992 |
465 | } | - |
466 | | - |
467 | | - |
468 | | - |
469 | | - |
470 | QSqlResult::BindingSyntax QSqlResult::bindingSyntax() const | - |
471 | { | - |
472 | return d->binds; never executed: return d->binds; | 0 |
473 | } | - |
474 | | - |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | void QSqlResult::clear() | - |
480 | { | - |
481 | d->clear(); | - |
482 | } executed: } Execution Count:2389 | 2389 |
483 | QString QSqlResult::executedQuery() const | - |
484 | { | - |
485 | return d->executedQuery; executed: return d->executedQuery; Execution Count:1 | 1 |
486 | } | - |
487 | | - |
488 | void QSqlResult::resetBindCount() | - |
489 | { | - |
490 | d->resetBindCount(); | - |
491 | } executed: } Execution Count:116708 | 116708 |
492 | | - |
493 | | - |
494 | | - |
495 | | - |
496 | | - |
497 | | - |
498 | | - |
499 | QString QSqlResult::boundValueName(int index) const | - |
500 | { | - |
501 | return d->holderAt(index); executed: return d->holderAt(index); Execution Count:136 | 136 |
502 | } | - |
503 | | - |
504 | | - |
505 | | - |
506 | | - |
507 | | - |
508 | | - |
509 | | - |
510 | bool QSqlResult::hasOutValues() const | - |
511 | { | - |
512 | if (d->types.isEmpty()) never evaluated: d->types.isEmpty() | 0 |
513 | return false; never executed: return false; | 0 |
514 | QHash<int, QSql::ParamType>::ConstIterator it; | - |
515 | for (it = d->types.constBegin(); it != d->types.constEnd(); ++it) { never evaluated: it != d->types.constEnd() | 0 |
516 | if (it.value() != QSql::In) never evaluated: it.value() != QSql::In | 0 |
517 | return true; never executed: return true; | 0 |
518 | } | 0 |
519 | return false; never executed: return false; | 0 |
520 | } | - |
521 | QSqlRecord QSqlResult::record() const | - |
522 | { | - |
523 | return QSqlRecord(); never executed: return QSqlRecord(); | 0 |
524 | } | - |
525 | QVariant QSqlResult::lastInsertId() const | - |
526 | { | - |
527 | return QVariant(); never executed: return QVariant(); | 0 |
528 | } | - |
529 | | - |
530 | | - |
531 | | - |
532 | void QSqlResult::virtual_hook(int, void *) | - |
533 | { | - |
534 | } | - |
535 | bool QSqlResult::execBatch(bool arrayBind) | - |
536 | { | - |
537 | (void)arrayBind;; | - |
538 | | - |
539 | QVector<QVariant> values = d->values; | - |
540 | if (values.count() == 0) never evaluated: values.count() == 0 | 0 |
541 | return false; never executed: return false; | 0 |
542 | for (int i = 0; i < values.at(0).toList().count(); ++i) { never evaluated: i < values.at(0).toList().count() | 0 |
543 | for (int j = 0; j < values.count(); ++j) never evaluated: j < values.count() | 0 |
544 | bindValue(j, values.at(j).toList().at(i), QSql::In); never executed: bindValue(j, values.at(j).toList().at(i), QSql::In); | 0 |
545 | if (!exec()) | 0 |
546 | return false; never executed: return false; | 0 |
547 | } | 0 |
548 | return true; never executed: return true; | 0 |
549 | } | - |
550 | | - |
551 | | - |
552 | | - |
553 | void QSqlResult::detachFromResultSet() | - |
554 | { | - |
555 | } | - |
556 | | - |
557 | | - |
558 | | - |
559 | void QSqlResult::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) | - |
560 | { | - |
561 | d->precisionPolicy = policy; | - |
562 | } executed: } Execution Count:4728 | 4728 |
563 | | - |
564 | | - |
565 | | - |
566 | QSql::NumericalPrecisionPolicy QSqlResult::numericalPrecisionPolicy() const | - |
567 | { | - |
568 | return d->precisionPolicy; executed: return d->precisionPolicy; Execution Count:2626 | 2626 |
569 | } | - |
570 | | - |
571 | | - |
572 | | - |
573 | bool QSqlResult::nextResult() | - |
574 | { | - |
575 | return false; never executed: return false; | 0 |
576 | } | - |
577 | QVariant QSqlResult::handle() const | - |
578 | { | - |
579 | return QVariant(); never executed: return QVariant(); | 0 |
580 | } | - |
581 | | - |
582 | | - |
583 | | - |
| | |