qsqlquery.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqlquery.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QSqlQueryPrivate-
8{-
9public:-
10 QSqlQueryPrivate(QSqlResult* result);-
11 ~QSqlQueryPrivate();-
12 QAtomicInt ref;-
13 QSqlResult* sqlResult;-
14-
15 static QSqlQueryPrivate* shared_null();-
16};-
17-
18namespace { namespace Q_QGS_nullQueryPrivate { typedef QSqlQueryPrivate Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 8 times by 8 tests
Evaluated by:
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 8 times by 8 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}
executed 8 times by 8 tests: end of block
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (0))) : value (0) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 1440 times by 8 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
&holder.value;
executed 1440 times by 8 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
} } } static QGlobalStatic<QSqlQueryPrivate, Q_QGS_nullQueryPrivate::innerFunction, Q_QGS_nullQueryPrivate::guard> nullQueryPrivate;
0-1440
19namespace { namespace Q_QGS_nullDriver { typedef QSqlNullDriver Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 9 times by 9 tests
Evaluated by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 9 times by 9 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}
executed 9 times by 9 tests: end of block
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 9 times by 9 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
&holder.value;
executed 9 times by 9 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
} } } static QGlobalStatic<QSqlNullDriver, Q_QGS_nullDriver::innerFunction, Q_QGS_nullDriver::guard> nullDriver;
0-9
20namespace { namespace Q_QGS_nullResult { typedef QSqlNullResult Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 9 times by 9 tests
Evaluated by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 9 times by 9 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}
executed 9 times by 9 tests: end of block
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsql - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (nullDriver()))) : value (nullDriver()) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 2198 times by 17 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
&holder.value;
executed 2198 times by 17 tests: return &holder.value;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
} } } static QGlobalStatic<QSqlNullResult, Q_QGS_nullResult::innerFunction, Q_QGS_nullResult::guard> nullResult;
0-2198
21-
22QSqlQueryPrivate* QSqlQueryPrivate::shared_null()-
23{-
24 QSqlQueryPrivate *null = nullQueryPrivate();-
25 null->ref.ref();-
26 return
executed 1440 times by 8 tests: return null;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
null;
executed 1440 times by 8 tests: return null;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1440
27}-
28-
29-
30-
31-
32QSqlQueryPrivate::QSqlQueryPrivate(QSqlResult* result)-
33 : ref(1), sqlResult(result)-
34{-
35 if (!sqlResult
!sqlResultDescription
TRUEevaluated 8 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 2182 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
8-2182
36 sqlResult = nullResult();
executed 8 times by 8 tests: sqlResult = nullResult();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
8
37}
executed 2190 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
2190
38-
39QSqlQueryPrivate::~QSqlQueryPrivate()-
40{-
41 QSqlResult *nr = nullResult();-
42 if (!nr
!nrDescription
TRUEnever evaluated
FALSEevaluated 2190 times by 17 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
|| sqlResult == nr
sqlResult == nrDescription
TRUEevaluated 8 times by 8 tests
Evaluated by:
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
FALSEevaluated 2182 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-2190
43 return;
executed 8 times by 8 tests: return;
Executed by:
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqldriver - unknown status
  • tst_qsqlquery - unknown status
  • tst_qsqlquerymodel - unknown status
  • tst_qsqlrelationaltablemodel - unknown status
  • tst_qsqltablemodel - unknown status
  • tst_qsqlthread - unknown status
8
44 delete sqlResult;-
45}
executed 2182 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
2182
46QSqlQuery::QSqlQuery(QSqlResult *result)-
47{-
48 d = new QSqlQueryPrivate(result);-
49}
executed 2182 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
2182
50-
51-
52-
53-
54-
55QSqlQuery::~QSqlQuery()-
56{-
57 if (!d->ref.deref()
!d->ref.deref()Description
TRUEevaluated 1604 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 2019 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
1604-2019
58 delete d;
executed 1604 times by 9 tests: delete d;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1604
59}
executed 3623 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
3623
60-
61-
62-
63-
64-
65QSqlQuery::QSqlQuery(const QSqlQuery& other)-
66{-
67 d = other.d;-
68 d->ref.ref();-
69}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSqlQuery
1
70-
71-
72-
73-
74static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db)-
75{-
76 QSqlDatabase database = db;-
77 if (!database.isValid()
!database.isValid()Description
TRUEevaluated 773 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 667 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
667-773
78 database = QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection), false);
executed 773 times by 5 tests: database = QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection), false);
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
773
79 if (database.isValid()
database.isValid()Description
TRUEevaluated 1180 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 260 times by 4 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
260-1180
80 *q = QSqlQuery(database.driver()->createResult());-
81 }
executed 1180 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
1180
82 if (!query.isEmpty()
!query.isEmpty()Description
TRUEevaluated 540 times by 6 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 900 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
540-900
83 q->exec(query);
executed 540 times by 6 tests: q->exec(query);
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
540
84}
executed 1440 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
1440
85QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db)-
86{-
87 d = QSqlQueryPrivate::shared_null();-
88 qInit(this, query, db);-
89}
executed 1109 times by 7 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1109
90QSqlQuery::QSqlQuery(QSqlDatabase db)-
91{-
92 d = QSqlQueryPrivate::shared_null();-
93 qInit(this, QString(), db);-
94}
executed 331 times by 7 tests: end of block
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
331
95-
96-
97-
98-
99-
100-
101QSqlQuery& QSqlQuery::operator=(const QSqlQuery& other)-
102{-
103 qAtomicAssign(d, other.d);-
104 return
executed 2022 times by 8 tests: return *this;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
*this;
executed 2022 times by 8 tests: return *this;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2022
105}-
106bool QSqlQuery::isNull(int field) const-
107{-
108 return
executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);
Executed by:
  • tst_QSqlQuery
!d->sqlResult->isActive()
executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);
Executed by:
  • tst_QSqlQuery
10
109 || !d->sqlResult->isValid()
executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);
Executed by:
  • tst_QSqlQuery
10
110 || d->sqlResult->isNull(field);
executed 10 times by 1 test: return !d->sqlResult->isActive() || !d->sqlResult->isValid() || d->sqlResult->isNull(field);
Executed by:
  • tst_QSqlQuery
10
111}-
112bool QSqlQuery::isNull(const QString &name) const-
113{-
114 int index = d->sqlResult->record().indexOf(name);-
115 if (index > -1
index > -1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
)
1-4
116 return
executed 4 times by 1 test: return isNull(index);
Executed by:
  • tst_QSqlQuery
isNull(index);
executed 4 times by 1 test: return isNull(index);
Executed by:
  • tst_QSqlQuery
4
117 QMessageLogger(__FILE__, 342, __PRETTY_FUNCTION__).warning("QSqlQuery::isNull: unknown field name '%s'", QString(name).toLocal8Bit().constData());-
118 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
119}-
120bool QSqlQuery::exec(const QString& query)-
121{-
122-
123-
124-
125-
126 if (d->ref.load() != 1
d->ref.load() != 1Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2553 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
5-2553
127 bool fo = isForwardOnly();-
128 *this = QSqlQuery(driver()->createResult());-
129 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());-
130 setForwardOnly(fo);-
131 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
else {
5
132 d->sqlResult->clear();-
133 d->sqlResult->setActive(false);-
134 d->sqlResult->setLastError(QSqlError());-
135 d->sqlResult->setAt(QSql::BeforeFirstRow);-
136 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());-
137 }
executed 2553 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
2553
138 d->sqlResult->setQuery(query.trimmed());-
139 if (!driver()->isOpen()
!driver()->isOpen()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2556 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| driver()->isOpenError()
driver()->isOpenError()Description
TRUEnever evaluated
FALSEevaluated 2556 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-2556
140 QMessageLogger(__FILE__, 391, __PRETTY_FUNCTION__).warning("QSqlQuery::exec: database not open");-
141 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
142 }-
143 if (query.isEmpty()
query.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 2556 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-2556
144 QMessageLogger(__FILE__, 395, __PRETTY_FUNCTION__).warning("QSqlQuery::exec: empty query");-
145 return
never executed: return false;
false;
never executed: return false;
0
146 }-
147-
148 bool retval = d->sqlResult->reset(query);-
149-
150-
151-
152-
153-
154 return
executed 2556 times by 9 tests: return retval;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
retval;
executed 2556 times by 9 tests: return retval;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2556
155}-
156QVariant QSqlQuery::value(int index) const-
157{-
158 if (isActive()
isActive()Description
TRUEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
&& isValid()
isValid()Description
TRUEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
&& (
(index > -1)Description
TRUEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
index > -1)
(index > -1)Description
TRUEevaluated 9138 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-9138
159 return
executed 9138 times by 8 tests: return d->sqlResult->data(index);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->data(index);
executed 9138 times by 8 tests: return d->sqlResult->data(index);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
9138
160 QMessageLogger(__FILE__, 431, __PRETTY_FUNCTION__).warning("QSqlQuery::value: not positioned on a valid record");-
161 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
162}-
163QVariant QSqlQuery::value(const QString& name) const-
164{-
165 int index = d->sqlResult->record().indexOf(name);-
166 if (index > -1
index > -1Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEnever evaluated
)
0-5
167 return
executed 5 times by 1 test: return value(index);
Executed by:
  • tst_QSqlQuery
value(index);
executed 5 times by 1 test: return value(index);
Executed by:
  • tst_QSqlQuery
5
168 QMessageLogger(__FILE__, 449, __PRETTY_FUNCTION__).warning("QSqlQuery::value: unknown field name '%s'", QString(name).toLocal8Bit().constData());-
169 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
170}-
171int QSqlQuery::at() const-
172{-
173 return
executed 10980 times by 9 tests: return d->sqlResult->at();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->at();
executed 10980 times by 9 tests: return d->sqlResult->at();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
10980
174}-
175QString QSqlQuery::lastQuery() const-
176{-
177 return
executed 124 times by 3 tests: return d->sqlResult->lastQuery();
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
d->sqlResult->lastQuery();
executed 124 times by 3 tests: return d->sqlResult->lastQuery();
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
124
178}-
179-
180-
181-
182-
183-
184const QSqlDriver *QSqlQuery::driver() const-
185{-
186 return
executed 6714 times by 9 tests: return d->sqlResult->driver();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->driver();
executed 6714 times by 9 tests: return d->sqlResult->driver();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
6714
187}-
188-
189-
190-
191-
192-
193const QSqlResult* QSqlQuery::result() const-
194{-
195 return
executed 155 times by 3 tests: return d->sqlResult;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
d->sqlResult;
executed 155 times by 3 tests: return d->sqlResult;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
155
196}-
197bool QSqlQuery::seek(int index, bool relative)-
198{-
199 if (!isSelect()
!isSelect()Description
TRUEnever evaluated
FALSEevaluated 3877 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
|| !isActive()
!isActive()Description
TRUEnever evaluated
FALSEevaluated 3877 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
)
0-3877
200 return
never executed: return false;
false;
never executed: return false;
0
201 int actualIdx;-
202 if (!relative
!relativeDescription
TRUEevaluated 3874 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
3-3874
203 if (index < 0
index < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 3872 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
2-3872
204 d->sqlResult->setAt(QSql::BeforeFirstRow);-
205 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
206 }-
207 actualIdx = index;-
208 }
executed 3872 times by 5 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
else {
3872
209 switch (at()) {-
210 case
executed 1 time by 1 test: case QSql::BeforeFirstRow:
Executed by:
  • tst_QSqlQuery
QSql::BeforeFirstRow:
executed 1 time by 1 test: case QSql::BeforeFirstRow:
Executed by:
  • tst_QSqlQuery
1
211 if (index > 0
index > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEnever evaluated
)
0-1
212 actualIdx = index - 1;
executed 1 time by 1 test: actualIdx = index - 1;
Executed by:
  • tst_QSqlQuery
1
213 else {-
214 return
never executed: return false;
false;
never executed: return false;
0
215 }-
216 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QSqlQuery
1
217 case
executed 1 time by 1 test: case QSql::AfterLastRow:
Executed by:
  • tst_QSqlQuery
QSql::AfterLastRow:
executed 1 time by 1 test: case QSql::AfterLastRow:
Executed by:
  • tst_QSqlQuery
1
218 if (index < 0
index < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEnever evaluated
) {
0-1
219 d->sqlResult->fetchLast();-
220 actualIdx = at() + index + 1;-
221 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSqlQuery
else {
1
222 return
never executed: return false;
false;
never executed: return false;
0
223 }-
224 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QSqlQuery
1
225 default
executed 1 time by 1 test: default:
Executed by:
  • tst_QSqlQuery
:
executed 1 time by 1 test: default:
Executed by:
  • tst_QSqlQuery
1
226 if ((
(at() + index) < 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
at() + index) < 0
(at() + index) < 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
0-1
227 d->sqlResult->setAt(QSql::BeforeFirstRow);-
228 return
never executed: return false;
false;
never executed: return false;
0
229 }-
230 actualIdx = at() + index;-
231 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QSqlQuery
1
232 }-
233 }-
234-
235 if (isForwardOnly()
isForwardOnly()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 3873 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
&& actualIdx < at()
actualIdx < at()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
1-3873
236 QMessageLogger(__FILE__, 595, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query");-
237 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
1
238 }-
239 if (actualIdx == (at() + 1)
actualIdx == (at() + 1)Description
TRUEevaluated 1224 times by 4 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 2650 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
&& at() != QSql::BeforeFirstRow
at() != QSql::BeforeFirstRowDescription
TRUEevaluated 1221 times by 4 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
3-2650
240 if (!d->sqlResult->fetchNext()
!d->sqlResult->fetchNext()Description
TRUEnever evaluated
FALSEevaluated 1221 times by 4 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
0-1221
241 d->sqlResult->setAt(QSql::AfterLastRow);-
242 return
never executed: return false;
false;
never executed: return false;
0
243 }-
244 return
executed 1221 times by 4 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 1221 times by 4 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
1221
245 }-
246 if (actualIdx == (at() - 1)
actualIdx == (at() - 1)Description
TRUEevaluated 39 times by 3 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 2614 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
39-2614
247 if (!d->sqlResult->fetchPrevious()
!d->sqlResult->fetchPrevious()Description
TRUEnever evaluated
FALSEevaluated 39 times by 3 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
0-39
248 d->sqlResult->setAt(QSql::BeforeFirstRow);-
249 return
never executed: return false;
false;
never executed: return false;
0
250 }-
251 return
executed 39 times by 3 tests: return true;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 39 times by 3 tests: return true;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
39
252 }-
253 if (!d->sqlResult->fetch(actualIdx)
!d->sqlResult-...tch(actualIdx)Description
TRUEevaluated 270 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 2344 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
270-2344
254 d->sqlResult->setAt(QSql::AfterLastRow);-
255 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
256 }-
257 return
executed 2344 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
true;
executed 2344 times by 5 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
2344
258}-
259bool QSqlQuery::next()-
260{-
261 if (!isSelect()
!isSelect()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlTableModel
FALSEevaluated 3171 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| !isActive()
!isActive()Description
TRUEnever evaluated
FALSEevaluated 3171 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-3171
262 return
executed 4 times by 2 tests: return false;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlTableModel
false;
executed 4 times by 2 tests: return false;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlTableModel
4
263 bool b = false;-
264 switch (at()) {-
265 case
executed 687 times by 8 tests: case QSql::BeforeFirstRow:
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
QSql::BeforeFirstRow:
executed 687 times by 8 tests: case QSql::BeforeFirstRow:
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
687
266 b = d->sqlResult->fetchFirst();-
267 return
executed 687 times by 8 tests: return b;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
b;
executed 687 times by 8 tests: return b;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
687
268 case
executed 25 times by 8 tests: case QSql::AfterLastRow:
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
QSql::AfterLastRow:
executed 25 times by 8 tests: case QSql::AfterLastRow:
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
25
269 return
executed 25 times by 8 tests: return false;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
false;
executed 25 times by 8 tests: return false;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
25
270 default
executed 2459 times by 8 tests: default:
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
:
executed 2459 times by 8 tests: default:
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2459
271 if (!d->sqlResult->fetchNext()
!d->sqlResult->fetchNext()Description
TRUEevaluated 821 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEevaluated 1638 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
821-1638
272 d->sqlResult->setAt(QSql::AfterLastRow);-
273 return
executed 821 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 821 times by 8 tests: return false;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
821
274 }-
275 return
executed 1638 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 1638 times by 8 tests: return true;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
1638
276 }-
277}-
278bool QSqlQuery::previous()-
279{-
280 if (!isSelect()
!isSelect()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
|| !isActive()
!isActive()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-3
281 return
never executed: return false;
false;
never executed: return false;
0
282 if (isForwardOnly()
isForwardOnly()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
1-2
283 QMessageLogger(__FILE__, 702, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query");-
284 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
1
285 }-
286-
287 bool b = false;-
288 switch (at()) {-
289 case
never executed: case QSql::BeforeFirstRow:
QSql::BeforeFirstRow:
never executed: case QSql::BeforeFirstRow:
0
290 return
never executed: return false;
false;
never executed: return false;
0
291 case
executed 1 time by 1 test: case QSql::AfterLastRow:
Executed by:
  • tst_QSqlQuery
QSql::AfterLastRow:
executed 1 time by 1 test: case QSql::AfterLastRow:
Executed by:
  • tst_QSqlQuery
1
292 b = d->sqlResult->fetchLast();-
293 return
executed 1 time by 1 test: return b;
Executed by:
  • tst_QSqlQuery
b;
executed 1 time by 1 test: return b;
Executed by:
  • tst_QSqlQuery
1
294 default
executed 1 time by 1 test: default:
Executed by:
  • tst_QSqlQuery
:
executed 1 time by 1 test: default:
Executed by:
  • tst_QSqlQuery
1
295 if (!d->sqlResult->fetchPrevious()
!d->sqlResult->fetchPrevious()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
0-1
296 d->sqlResult->setAt(QSql::BeforeFirstRow);-
297 return
never executed: return false;
false;
never executed: return false;
0
298 }-
299 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
300 }-
301}-
302bool QSqlQuery::first()-
303{-
304 if (!isSelect()
!isSelect()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlThread
|| !isActive()
!isActive()Description
TRUEnever evaluated
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlThread
)
0-18
305 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QSqlQuery
1
306 if (isForwardOnly()
isForwardOnly()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QSqlQuery
  • tst_QSqlThread
&& at() > QSql::BeforeFirstRow
at() > QSql::BeforeFirstRowDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
) {
1-15
307 QMessageLogger(__FILE__, 737, __PRETTY_FUNCTION__).warning("QSqlQuery::seek: cannot seek backwards in a forward only query");-
308 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
309 }-
310 bool b = false;-
311 b = d->sqlResult->fetchFirst();-
312 return
executed 16 times by 2 tests: return b;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlThread
b;
executed 16 times by 2 tests: return b;
Executed by:
  • tst_QSqlQuery
  • tst_QSqlThread
16
313}-
314bool QSqlQuery::last()-
315{-
316 if (!isSelect()
!isSelect()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QSqlQuery
|| !isActive()
!isActive()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-8
317 return
never executed: return false;
false;
never executed: return false;
0
318 bool b = false;-
319 b = d->sqlResult->fetchLast();-
320 return
executed 8 times by 1 test: return b;
Executed by:
  • tst_QSqlQuery
b;
executed 8 times by 1 test: return b;
Executed by:
  • tst_QSqlQuery
8
321}-
322int QSqlQuery::size() const-
323{-
324 if (isActive()
isActive()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlQuery
&& d->sqlResult->driver()->hasFeature(QSqlDriver::QuerySize)
d->sqlResult->...er::QuerySize)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-5
325 return
never executed: return d->sqlResult->size();
d->sqlResult->size();
never executed: return d->sqlResult->size();
0
326 return
executed 6 times by 1 test: return -1;
Executed by:
  • tst_QSqlQuery
-1;
executed 6 times by 1 test: return -1;
Executed by:
  • tst_QSqlQuery
6
327}-
328int QSqlQuery::numRowsAffected() const-
329{-
330 if (isActive()
isActive()Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
2-19
331 return
executed 19 times by 1 test: return d->sqlResult->numRowsAffected();
Executed by:
  • tst_QSqlQuery
d->sqlResult->numRowsAffected();
executed 19 times by 1 test: return d->sqlResult->numRowsAffected();
Executed by:
  • tst_QSqlQuery
19
332 return
executed 2 times by 1 test: return -1;
Executed by:
  • tst_QSqlQuery
-1;
executed 2 times by 1 test: return -1;
Executed by:
  • tst_QSqlQuery
2
333}-
334QSqlError QSqlQuery::lastError() const-
335{-
336 return
executed 11093 times by 7 tests: return d->sqlResult->lastError();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->lastError();
executed 11093 times by 7 tests: return d->sqlResult->lastError();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
11093
337}-
338-
339-
340-
341-
342-
343-
344bool QSqlQuery::isValid() const-
345{-
346 return
executed 9645 times by 8 tests: return d->sqlResult->isValid();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->isValid();
executed 9645 times by 8 tests: return d->sqlResult->isValid();
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
9645
347}-
348bool QSqlQuery::isActive() const-
349{-
350 return
executed 16973 times by 9 tests: return d->sqlResult->isActive();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->isActive();
executed 16973 times by 9 tests: return d->sqlResult->isActive();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
16973
351}-
352-
353-
354-
355-
356-
357-
358bool QSqlQuery::isSelect() const-
359{-
360 return
executed 7084 times by 9 tests: return d->sqlResult->isSelect();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->isSelect();
executed 7084 times by 9 tests: return d->sqlResult->isSelect();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
7084
361}-
362-
363-
364-
365-
366-
367-
368-
369bool QSqlQuery::isForwardOnly() const-
370{-
371 return
executed 4291 times by 6 tests: return d->sqlResult->isForwardOnly();
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->isForwardOnly();
executed 4291 times by 6 tests: return d->sqlResult->isForwardOnly();
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
4291
372}-
373void QSqlQuery::setForwardOnly(bool forward)-
374{-
375 d->sqlResult->setForwardOnly(forward);-
376}
executed 647 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
647
377QSqlRecord QSqlQuery::record() const-
378{-
379 QSqlRecord rec = d->sqlResult->record();-
380-
381 if (isValid()
isValid()Description
TRUEevaluated 100 times by 5 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 403 times by 6 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
) {
100-403
382 for (int i = 0; i < rec.count()
i < rec.count()Description
TRUEevaluated 241 times by 5 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
FALSEevaluated 100 times by 5 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
; ++i)
100-241
383 rec.setValue(i, value(i));
executed 241 times by 5 tests: rec.setValue(i, value(i));
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
241
384 }
executed 100 times by 5 tests: end of block
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
100
385 return
executed 503 times by 7 tests: return rec;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
rec;
executed 503 times by 7 tests: return rec;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
503
386}-
387-
388-
389-
390-
391-
392-
393void QSqlQuery::clear()-
394{-
395 *this = QSqlQuery(driver()->createResult());-
396}
executed 398 times by 7 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
398
397bool QSqlQuery::prepare(const QString& query)-
398{-
399 if (d->ref.load() != 1
d->ref.load() != 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 230 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
2-230
400 bool fo = isForwardOnly();-
401 *this = QSqlQuery(driver()->createResult());-
402 setForwardOnly(fo);-
403 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());-
404 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
else {
2
405 d->sqlResult->setActive(false);-
406 d->sqlResult->setLastError(QSqlError());-
407 d->sqlResult->setAt(QSql::BeforeFirstRow);-
408 d->sqlResult->setNumericalPrecisionPolicy(d->sqlResult->numericalPrecisionPolicy());-
409 }
executed 230 times by 7 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
230
410 if (!driver()
!driver()Description
TRUEnever evaluated
FALSEevaluated 232 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-232
411 QMessageLogger(__FILE__, 972, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: no driver");-
412 return
never executed: return false;
false;
never executed: return false;
0
413 }-
414 if (!driver()->isOpen()
!driver()->isOpen()Description
TRUEnever evaluated
FALSEevaluated 232 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
|| driver()->isOpenError()
driver()->isOpenError()Description
TRUEnever evaluated
FALSEevaluated 232 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-232
415 QMessageLogger(__FILE__, 976, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: database not open");-
416 return
never executed: return false;
false;
never executed: return false;
0
417 }-
418 if (query.isEmpty()
query.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 232 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
0-232
419 QMessageLogger(__FILE__, 980, __PRETTY_FUNCTION__).warning("QSqlQuery::prepare: empty query");-
420 return
never executed: return false;
false;
never executed: return false;
0
421 }-
422-
423-
424-
425 return
executed 232 times by 7 tests: return d->sqlResult->savePrepare(query);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->sqlResult->savePrepare(query);
executed 232 times by 7 tests: return d->sqlResult->savePrepare(query);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
232
426}-
427bool QSqlQuery::exec()-
428{-
429-
430-
431-
432-
433 d->sqlResult->resetBindCount();-
434-
435 if (d->sqlResult->lastError().isValid()
d->sqlResult->...or().isValid()Description
TRUEevaluated 92072 times by 2 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
FALSEevaluated 24656 times by 7 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
24656-92072
436 d->sqlResult->setLastError(QSqlError());
executed 92072 times by 2 tests: d->sqlResult->setLastError(QSqlError());
Executed by:
  • tst_QItemModel
  • tst_QSqlQuery
92072
437-
438 bool retval = d->sqlResult->exec();-
439-
440-
441-
442-
443-
444 return
executed 116728 times by 7 tests: return retval;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
retval;
executed 116728 times by 7 tests: return retval;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
116728
445}-
446bool QSqlQuery::execBatch(BatchExecutionMode mode)-
447{-
448 d->sqlResult->resetBindCount();-
449 return
executed 2 times by 1 test: return d->sqlResult->execBatch(mode == ValuesAsColumns);
Executed by:
  • tst_QSqlQuery
d->sqlResult->execBatch(mode == ValuesAsColumns);
executed 2 times by 1 test: return d->sqlResult->execBatch(mode == ValuesAsColumns);
Executed by:
  • tst_QSqlQuery
2
450}-
451void QSqlQuery::bindValue(const QString& placeholder, const QVariant& val,-
452 QSql::ParamType paramType-
453)-
454{-
455 d->sqlResult->bindValue(placeholder, val, paramType);-
456}
executed 48 times by 2 tests: end of block
Executed by:
  • tst_QSqlQuery
  • tst_QSqlThread
48
457-
458-
459-
460-
461-
462-
463-
464void QSqlQuery::bindValue(int pos, const QVariant& val, QSql::ParamType paramType)-
465{-
466 d->sqlResult->bindValue(pos, val, paramType);-
467}
executed 89 times by 4 tests: end of block
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlThread
89
468void QSqlQuery::addBindValue(const QVariant& val, QSql::ParamType paramType)-
469{-
470 d->sqlResult->addBindValue(val, paramType);-
471}
executed 233364 times by 5 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
233364
472-
473-
474-
475-
476-
477-
478QVariant QSqlQuery::boundValue(const QString& placeholder) const-
479{-
480 return
never executed: return d->sqlResult->boundValue(placeholder);
d->sqlResult->boundValue(placeholder);
never executed: return d->sqlResult->boundValue(placeholder);
0
481}-
482-
483-
484-
485-
486QVariant QSqlQuery::boundValue(int pos) const-
487{-
488 return
executed 1 time by 1 test: return d->sqlResult->boundValue(pos);
Executed by:
  • tst_QSqlQuery
d->sqlResult->boundValue(pos);
executed 1 time by 1 test: return d->sqlResult->boundValue(pos);
Executed by:
  • tst_QSqlQuery
1
489}-
490QMap<QString,QVariant> QSqlQuery::boundValues() const-
491{-
492 QMap<QString,QVariant> map;-
493-
494 const QVector<QVariant> values(d->sqlResult->boundValues());-
495 for (int i = 0; i < values.count()
i < values.count()Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 53 times by 1 test
Evaluated by:
  • tst_QSqlQuery
; ++i)
53-122
496 map[d->sqlResult->boundValueName(i)] = values.at(i);
executed 122 times by 1 test: map[d->sqlResult->boundValueName(i)] = values.at(i);
Executed by:
  • tst_QSqlQuery
122
497 return
executed 53 times by 1 test: return map;
Executed by:
  • tst_QSqlQuery
map;
executed 53 times by 1 test: return map;
Executed by:
  • tst_QSqlQuery
53
498}-
499QString QSqlQuery::executedQuery() const-
500{-
501 return
executed 1 time by 1 test: return d->sqlResult->executedQuery();
Executed by:
  • tst_QSqlQuery
d->sqlResult->executedQuery();
executed 1 time by 1 test: return d->sqlResult->executedQuery();
Executed by:
  • tst_QSqlQuery
1
502}-
503QVariant QSqlQuery::lastInsertId() const-
504{-
505 return
executed 7 times by 2 tests: return d->sqlResult->lastInsertId();
Executed by:
  • tst_QSqlQuery
  • tst_QSqlTableModel
d->sqlResult->lastInsertId();
executed 7 times by 2 tests: return d->sqlResult->lastInsertId();
Executed by:
  • tst_QSqlQuery
  • tst_QSqlTableModel
7
506}-
507void QSqlQuery::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)-
508{-
509 d->sqlResult->setNumericalPrecisionPolicy(precisionPolicy);-
510}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QSqlDatabase
6
511-
512-
513-
514-
515-
516-
517QSql::NumericalPrecisionPolicy QSqlQuery::numericalPrecisionPolicy() const-
518{-
519 return
never executed: return d->sqlResult->numericalPrecisionPolicy();
d->sqlResult->numericalPrecisionPolicy();
never executed: return d->sqlResult->numericalPrecisionPolicy();
0
520}-
521void QSqlQuery::finish()-
522{-
523 if (isActive()
isActive()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEnever evaluated
) {
0-3
524 d->sqlResult->setLastError(QSqlError());-
525 d->sqlResult->setAt(QSql::BeforeFirstRow);-
526 d->sqlResult->detachFromResultSet();-
527 d->sqlResult->setActive(false);-
528 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
3
529}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
3
530bool QSqlQuery::nextResult()-
531{-
532 if (isActive()
isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
533 return
never executed: return d->sqlResult->nextResult();
d->sqlResult->nextResult();
never executed: return d->sqlResult->nextResult();
0
534 return
never executed: return false;
false;
never executed: return false;
0
535}-
536-
537-
Switch to Source codePreprocessed file

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