qsqldatabase.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqldatabase.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace { namespace Q_QGS_loader { typedef QFactoryLoader 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 ("org.qt-project.Qt.QSqlDriverFactoryInterface", QLatin1String("/sqldrivers")))) : value ("org.qt-project.Qt.QSqlDriverFactoryInterface", QLatin1String("/sqldrivers")) { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 96 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 96 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<QFactoryLoader, Q_QGS_loader::innerFunction, Q_QGS_loader::guard> loader;
0-96
6-
7-
8-
9-
10-
11const-
12-
13char *QSqlDatabase::defaultConnection = const_cast<char *>("qt_sql_default_connection");-
14-
15typedef QHash<QString, QSqlDriverCreatorBase*> DriverDict;-
16-
17class QConnectionDict: public QHash<QString, QSqlDatabase>-
18{-
19public:-
20 inline bool contains_ts(const QString &key)-
21 {-
22 QReadLocker locker(&lock);-
23 return
executed 2 times by 1 test: return contains(key);
Executed by:
  • tst_QSqlDatabase
contains(key);
executed 2 times by 1 test: return contains(key);
Executed by:
  • tst_QSqlDatabase
2
24 }-
25 inline QStringList keys_ts() const-
26 {-
27 QReadLocker locker(&lock);-
28 return
never executed: return keys();
keys();
never executed: return keys();
0
29 }-
30-
31 mutable QReadWriteLock lock;-
32};-
33namespace { namespace Q_QGS_dbDict { typedef QConnectionDict 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 2321 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 2321 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<QConnectionDict, Q_QGS_dbDict::innerFunction, Q_QGS_dbDict::guard> dbDict;
0-2321
34-
35class QSqlDatabasePrivate-
36{-
37public:-
38 QSqlDatabasePrivate(QSqlDatabase *d, QSqlDriver *dr = 0):-
39 ref(1),-
40 q(d),-
41 driver(dr),-
42 port(-1)-
43 {-
44 precisionPolicy = QSql::LowPrecisionDouble;-
45 }
executed 44 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
44
46 QSqlDatabasePrivate(const QSqlDatabasePrivate &other);-
47 ~QSqlDatabasePrivate();-
48 void init(const QString& type);-
49 void copy(const QSqlDatabasePrivate *other);-
50 void disable();-
51-
52 QAtomicInt ref;-
53 QSqlDatabase *q;-
54 QSqlDriver* driver;-
55 QString dbname;-
56 QString uname;-
57 QString pword;-
58 QString hname;-
59 QString drvName;-
60 int port;-
61 QString connOptions;-
62 QString connName;-
63 QSql::NumericalPrecisionPolicy precisionPolicy;-
64-
65 static QSqlDatabasePrivate *shared_null();-
66 static QSqlDatabase database(const QString& name, bool open);-
67 static void addDatabase(const QSqlDatabase &db, const QString & name);-
68 static void removeDatabase(const QString& name);-
69 static void invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn = true);-
70 static DriverDict &driverDict();-
71 static void cleanConnections();-
72};-
73-
74QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other) : ref(1)-
75{-
76 q = other.q;-
77 dbname = other.dbname;-
78 uname = other.uname;-
79 pword = other.pword;-
80 hname = other.hname;-
81 drvName = other.drvName;-
82 port = other.port;-
83 connOptions = other.connOptions;-
84 driver = other.driver;-
85 precisionPolicy = other.precisionPolicy;-
86}
never executed: end of block
0
87-
88QSqlDatabasePrivate::~QSqlDatabasePrivate()-
89{-
90 if (driver != shared_null()->driver
driver != shar...null()->driverDescription
TRUEevaluated 33 times by 11 tests
Evaluated by:
  • 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_qsqltablemodel - unknown status
FALSEevaluated 13 times by 12 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • 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
)
13-33
91 delete driver;
executed 33 times by 11 tests: delete driver;
Executed by:
  • 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_qsqltablemodel - unknown status
33
92}
executed 46 times by 17 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
  • 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
46
93-
94void QSqlDatabasePrivate::cleanConnections()-
95{-
96 QConnectionDict *dict = dbDict();-
97 ((!(dict)) ? qt_assert("dict",__FILE__,194) : qt_noop());-
98 QWriteLocker locker(&dict->lock);-
99-
100 QConnectionDict::iterator it = dict->begin();-
101 while (it != dict->end()
it != dict->end()Description
TRUEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QSql
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqltablemodel - unknown status
FALSEevaluated 22 times by 9 tests
Evaluated by:
  • tst_QSql
  • 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
) {
7-22
102 invalidateDb(it.value(), it.key(), false);-
103 ++it;-
104 }
executed 7 times by 4 tests: end of block
Executed by:
  • tst_QSql
  • tst_qitemmodel - unknown status
  • tst_qsqldatabase - unknown status
  • tst_qsqltablemodel - unknown status
7
105 dict->clear();-
106}
executed 22 times by 9 tests: end of block
Executed by:
  • tst_QSql
  • 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
22
107-
108static bool qDriverDictInit = false;-
109static void cleanDriverDict()-
110{-
111 qDeleteAll(QSqlDatabasePrivate::driverDict());-
112 QSqlDatabasePrivate::driverDict().clear();-
113 QSqlDatabasePrivate::cleanConnections();-
114 qDriverDictInit = false;-
115}
executed 22 times by 9 tests: end of block
Executed by:
  • tst_QSql
  • 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
22
116-
117DriverDict &QSqlDatabasePrivate::driverDict()-
118{-
119 static DriverDict dict;-
120 if (!qDriverDictInit
!qDriverDictInitDescription
TRUEevaluated 21 times by 8 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEevaluated 87 times by 16 tests
Evaluated by:
  • 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
) {
21-87
121 qDriverDictInit = true;-
122 qAddPostRoutine(cleanDriverDict);-
123 }
executed 21 times by 8 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
21
124 return
executed 108 times by 17 tests: return dict;
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
dict;
executed 108 times by 17 tests: return dict;
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
108
125}-
126-
127QSqlDatabasePrivate *QSqlDatabasePrivate::shared_null()-
128{-
129 static QSqlNullDriver dr;-
130 static QSqlDatabasePrivate n(__null, &dr);-
131 return
executed 8121 times by 18 tests: return &n;
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_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
&n;
executed 8121 times by 18 tests: return &n;
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_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
8121
132}-
133-
134void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn)-
135{-
136 if (db.d->ref.load() != 1
db.d->ref.load() != 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlDatabase
FALSEevaluated 36 times by 11 tests
Evaluated by:
  • 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_qsqltablemodel - unknown status
&& doWarn
doWarnDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlDatabase
FALSEnever evaluated
) {
0-36
137 QMessageLogger(__FILE__, 234, __PRETTY_FUNCTION__).warning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "-
138 "all queries will cease to work.", name.toLocal8Bit().constData());-
139 db.d->disable();-
140 db.d->connName.clear();-
141 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSqlDatabase
1
142}
executed 37 times by 11 tests: end of block
Executed by:
  • 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_qsqltablemodel - unknown status
37
143-
144void QSqlDatabasePrivate::removeDatabase(const QString &name)-
145{-
146 QConnectionDict *dict = dbDict();-
147 ((!(dict)) ? qt_assert("dict",__FILE__,244) : qt_noop());-
148 QWriteLocker locker(&dict->lock);-
149-
150 if (!dict->contains(name)
!dict->contains(name)Description
TRUEnever evaluated
FALSEevaluated 30 times by 8 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-30
151 return;
never executed: return;
0
152-
153 invalidateDb(dict->take(name), name);-
154}
executed 30 times by 8 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
30
155-
156void QSqlDatabasePrivate::addDatabase(const QSqlDatabase &db, const QString &name)-
157{-
158 QConnectionDict *dict = dbDict();-
159 ((!(dict)) ? qt_assert("dict",__FILE__,256) : qt_noop());-
160 QWriteLocker locker(&dict->lock);-
161-
162 if (dict->contains(name)
dict->contains(name)Description
TRUEnever evaluated
FALSEevaluated 36 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-36
163 invalidateDb(dict->take(name), name);-
164 QMessageLogger(__FILE__, 261, __PRETTY_FUNCTION__).warning("QSqlDatabasePrivate::addDatabase: duplicate connection name '%s', old "-
165 "connection removed.", name.toLocal8Bit().data());-
166 }
never executed: end of block
0
167 dict->insert(name, db);-
168 db.d->connName = name;-
169}
executed 36 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
36
170-
171-
172-
173QSqlDatabase QSqlDatabasePrivate::database(const QString& name, bool open)-
174{-
175 const QConnectionDict *dict = dbDict();-
176 ((!(dict)) ? qt_assert("dict",__FILE__,273) : qt_noop());-
177-
178 dict->lock.lockForRead();-
179 QSqlDatabase db = dict->value(name);-
180 dict->lock.unlock();-
181 if (db.isValid()
db.isValid()Description
TRUEevaluated 1969 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 262 times by 5 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
&& !db.isOpen()
!db.isOpen()Description
TRUEevaluated 24 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEevaluated 1945 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
&& open
openDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
FALSEevaluated 19 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
) {
5-1969
182 if (!db.open()
!db.open()Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QSqlQuery
)
0-5
183 QMessageLogger(__FILE__, 280, __PRETTY_FUNCTION__).warning() << "QSqlDatabasePrivate::database: unable to open database:" << db.lastError().text();
never executed: QMessageLogger(__FILE__, 280, __PRETTY_FUNCTION__).warning() << "QSqlDatabasePrivate::database: unable to open database:" << db.lastError().text();
0
184-
185 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QSqlQuery
5
186 return
executed 2231 times by 9 tests: return db;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
db;
executed 2231 times by 9 tests: return db;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2231
187}-
188-
189-
190-
191-
192-
193void QSqlDatabasePrivate::copy(const QSqlDatabasePrivate *other)-
194{-
195 q = other->q;-
196 dbname = other->dbname;-
197 uname = other->uname;-
198 pword = other->pword;-
199 hname = other->hname;-
200 drvName = other->drvName;-
201 port = other->port;-
202 connOptions = other->connOptions;-
203 precisionPolicy = other->precisionPolicy;-
204}
executed 7 times by 3 tests: end of block
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlTableModel
  • tst_QSqlThread
7
205-
206void QSqlDatabasePrivate::disable()-
207{-
208 if (driver != shared_null()->driver
driver != shar...null()->driverDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlDatabase
FALSEnever evaluated
) {
0-1
209 delete driver;-
210 driver = shared_null()->driver;-
211 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSqlDatabase
1
212}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSqlDatabase
1
213QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &connectionName)-
214{-
215 QSqlDatabase db(type);-
216 QSqlDatabasePrivate::addDatabase(db, connectionName);-
217 return
executed 29 times by 8 tests: return db;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
db;
executed 29 times by 8 tests: return db;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
29
218}-
219QSqlDatabase QSqlDatabase::database(const QString& connectionName, bool open)-
220{-
221 return
executed 2231 times by 9 tests: return QSqlDatabasePrivate::database(connectionName, open);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
QSqlDatabasePrivate::database(connectionName, open);
executed 2231 times by 9 tests: return QSqlDatabasePrivate::database(connectionName, open);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2231
222}-
223void QSqlDatabase::removeDatabase(const QString& connectionName)-
224{-
225 QSqlDatabasePrivate::removeDatabase(connectionName);-
226}
executed 30 times by 8 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
30
227-
228-
229-
230-
231-
232-
233-
234QStringList QSqlDatabase::drivers()-
235{-
236 QStringList list;-
237 if (QFactoryLoader *fl = loader()
QFactoryLoader *fl = loader()Description
TRUEevaluated 26 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
) {
0-26
238 typedef QMultiMap<int, QString> PluginKeyMap;-
239 typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;-
240-
241 const PluginKeyMap keyMap = fl->keyMap();-
242 const PluginKeyMapConstIterator cend = keyMap.constEnd();-
243 for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend
it != cendDescription
TRUEevaluated 234 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEevaluated 26 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
; ++it)
26-234
244 if (!list.contains(it.value())
!list.contains(it.value())Description
TRUEevaluated 234 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-234
245 list << it.value();
executed 234 times by 7 tests: list << it.value();
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
234
246 }
executed 26 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
26
247-
248 DriverDict dict = QSqlDatabasePrivate::driverDict();-
249 for (DriverDict::const_iterator i = dict.constBegin(); i != dict.constEnd()
i != dict.constEnd()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEevaluated 26 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
; ++i) {
1-26
250 if (!list.contains(i.key())
!list.contains(i.key())Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEnever evaluated
)
0-1
251 list << i.key();
executed 1 time by 1 test: list << i.key();
Executed by:
  • tst_QSql
1
252 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSql
1
253-
254 return
executed 26 times by 7 tests: return list;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
list;
executed 26 times by 7 tests: return list;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
26
255}-
256void QSqlDatabase::registerSqlDriver(const QString& name, QSqlDriverCreatorBase *creator)-
257{-
258 delete QSqlDatabasePrivate::driverDict().take(name);-
259 if (creator
creatorDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEnever evaluated
)
0-1
260 QSqlDatabasePrivate::driverDict().insert(name, creator);
executed 1 time by 1 test: QSqlDatabasePrivate::driverDict().insert(name, creator);
Executed by:
  • tst_QSql
1
261}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSql
1
262bool QSqlDatabase::contains(const QString& connectionName)-
263{-
264 return
executed 2 times by 1 test: return dbDict()->contains_ts(connectionName);
Executed by:
  • tst_QSqlDatabase
dbDict()->contains_ts(connectionName);
executed 2 times by 1 test: return dbDict()->contains_ts(connectionName);
Executed by:
  • tst_QSqlDatabase
2
265}-
266QStringList QSqlDatabase::connectionNames()-
267{-
268 return
never executed: return dbDict()->keys_ts();
dbDict()->keys_ts();
never executed: return dbDict()->keys_ts();
0
269}-
270QSqlDatabase::QSqlDatabase(const QString &type)-
271{-
272 d = new QSqlDatabasePrivate(this);-
273 d->init(type);-
274}
executed 36 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
36
275-
276-
277-
278-
279-
280-
281-
282QSqlDatabase::QSqlDatabase(QSqlDriver *driver)-
283{-
284 d = new QSqlDatabasePrivate(this, driver);-
285}
never executed: end of block
0
286-
287-
288-
289-
290-
291-
292QSqlDatabase::QSqlDatabase()-
293{-
294 d = QSqlDatabasePrivate::shared_null();-
295 d->ref.ref();-
296}
executed 1287 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
1287
297-
298-
299-
300-
301QSqlDatabase::QSqlDatabase(const QSqlDatabase &other)-
302{-
303 d = other.d;-
304 d->ref.ref();-
305}
executed 19102 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
19102
306-
307-
308-
309-
310QSqlDatabase &QSqlDatabase::operator=(const QSqlDatabase &other)-
311{-
312 qAtomicAssign(d, other.d);-
313 return
executed 968 times by 9 tests: return *this;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
*this;
executed 968 times by 9 tests: return *this;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
968
314}-
315-
316-
317-
318-
319-
320-
321-
322void QSqlDatabasePrivate::init(const QString &type)-
323{-
324 drvName = type;-
325-
326 if (!driver
!driverDescription
TRUEevaluated 36 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
) {
0-36
327 }
executed 36 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
36
328-
329 if (!driver
!driverDescription
TRUEevaluated 36 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
) {
0-36
330 DriverDict dict = QSqlDatabasePrivate::driverDict();-
331 for (DriverDict::const_iterator it = dict.constBegin();-
332 it != dict.constEnd()
it != dict.constEnd()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEevaluated 36 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
!driverDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEnever evaluated
; ++it) {
0-36
333 if (type == it.key()
type == it.key()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEnever evaluated
) {
0-1
334 driver = ((QSqlDriverCreatorBase*)(*it))->createObject();-
335 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSql
1
336 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSql
1
337 }
executed 36 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
36
338-
339 if (!driver
!driverDescription
TRUEevaluated 35 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 1 time by 1 test
Evaluated by:
  • tst_QSql
&& loader()
loader()Description
TRUEevaluated 35 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-35
340 driver = qLoadPlugin<QSqlDriver, QSqlDriverPlugin>(loader(), type);
executed 35 times by 9 tests: driver = qLoadPlugin<QSqlDriver, QSqlDriverPlugin>(loader(), type);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
35
341-
342 if (!driver
!driverDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
FALSEevaluated 33 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
3-33
343 QMessageLogger(__FILE__, 781, __PRETTY_FUNCTION__).warning("QSqlDatabase: %s driver not loaded", type.toLatin1().data());-
344 QMessageLogger(__FILE__, 782, __PRETTY_FUNCTION__).warning("QSqlDatabase: available drivers: %s",-
345 QSqlDatabase::drivers().join(QLatin1Char(' ')).toLatin1().data());-
346 if (QCoreApplication::instance() == 0
QCoreApplicati...nstance() == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSql
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlQuery
)
1-2
347 QMessageLogger(__FILE__, 785, __PRETTY_FUNCTION__).warning("QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins");
executed 1 time by 1 test: QMessageLogger(__FILE__, 785, __PRETTY_FUNCTION__).warning("QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins");
Executed by:
  • tst_QSql
1
348 driver = shared_null()->driver;-
349 }
executed 3 times by 3 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
3
350}
executed 36 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
36
351-
352-
353-
354-
355-
356-
357-
358QSqlDatabase::~QSqlDatabase()-
359{-
360 if (!d->ref.deref()
!d->ref.deref()Description
TRUEevaluated 37 times by 11 tests
Evaluated by:
  • 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_qsqltablemodel - unknown status
FALSEevaluated 20389 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
) {
37-20389
361 close();-
362 delete d;-
363 }
executed 37 times by 11 tests: end of block
Executed by:
  • 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_qsqltablemodel - unknown status
37
364}
executed 20426 times by 12 tests: end of block
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_qsqltablemodel - unknown status
20426
365QSqlQuery QSqlDatabase::exec(const QString & query) const-
366{-
367 QSqlQuery r(d->driver->createResult());-
368 if (!query.isEmpty()
!query.isEmpty()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QSqlRelationalTableModel
FALSEnever evaluated
) {
0-16
369 r.exec(query);-
370 d->driver->setLastError(r.lastError());-
371 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QSqlRelationalTableModel
16
372 return
executed 16 times by 1 test: return r;
Executed by:
  • tst_QSqlRelationalTableModel
r;
executed 16 times by 1 test: return r;
Executed by:
  • tst_QSqlRelationalTableModel
16
373}-
374bool QSqlDatabase::open()-
375{-
376 return
executed 48 times by 9 tests: return d->driver->open(d->dbname, d->uname, d->pword, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver->open(d->dbname, d->uname, d->pword, d->hname,
executed 48 times by 9 tests: return d->driver->open(d->dbname, d->uname, d->pword, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
48
377 d->port, d->connOptions);
executed 48 times by 9 tests: return d->driver->open(d->dbname, d->uname, d->pword, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
48
378}-
379bool QSqlDatabase::open(const QString& user, const QString& password)-
380{-
381 setUserName(user);-
382 return
executed 1 time by 1 test: return d->driver->open(d->dbname, user, password, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QSql
d->driver->open(d->dbname, user, password, d->hname,
executed 1 time by 1 test: return d->driver->open(d->dbname, user, password, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QSql
1
383 d->port, d->connOptions);
executed 1 time by 1 test: return d->driver->open(d->dbname, user, password, d->hname, d->port, d->connOptions);
Executed by:
  • tst_QSql
1
384}-
385void QSqlDatabase::close()-
386{-
387 d->driver->close();-
388}
executed 80 times by 11 tests: end of block
Executed by:
  • 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_qsqltablemodel - unknown status
80
389-
390-
391-
392-
393-
394-
395bool QSqlDatabase::isOpen() const-
396{-
397 return
executed 2027 times by 9 tests: return d->driver->isOpen();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver->isOpen();
executed 2027 times by 9 tests: return d->driver->isOpen();
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
2027
398}-
399-
400-
401-
402-
403-
404-
405-
406bool QSqlDatabase::isOpenError() const-
407{-
408 return
executed 10 times by 1 test: return d->driver->isOpenError();
Executed by:
  • tst_QSqlDatabase
d->driver->isOpenError();
executed 10 times by 1 test: return d->driver->isOpenError();
Executed by:
  • tst_QSqlDatabase
10
409}-
410bool QSqlDatabase::transaction()-
411{-
412 if (!d->driver->hasFeature(QSqlDriver::Transactions)
!d->driver->ha...:Transactions)Description
TRUEnever evaluated
FALSEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
)
0-5
413 return
never executed: return false;
false;
never executed: return false;
0
414 return
executed 5 times by 3 tests: return d->driver->beginTransaction();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
d->driver->beginTransaction();
executed 5 times by 3 tests: return d->driver->beginTransaction();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
5
415}-
416bool QSqlDatabase::commit()-
417{-
418 if (!d->driver->hasFeature(QSqlDriver::Transactions)
!d->driver->ha...:Transactions)Description
TRUEnever evaluated
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
)
0-4
419 return
never executed: return false;
false;
never executed: return false;
0
420 return
executed 4 times by 3 tests: return d->driver->commitTransaction();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
d->driver->commitTransaction();
executed 4 times by 3 tests: return d->driver->commitTransaction();
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
4
421}-
422bool QSqlDatabase::rollback()-
423{-
424 if (!d->driver->hasFeature(QSqlDriver::Transactions)
!d->driver->ha...:Transactions)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlDatabase
)
0-1
425 return
never executed: return false;
false;
never executed: return false;
0
426 return
executed 1 time by 1 test: return d->driver->rollbackTransaction();
Executed by:
  • tst_QSqlDatabase
d->driver->rollbackTransaction();
executed 1 time by 1 test: return d->driver->rollbackTransaction();
Executed by:
  • tst_QSqlDatabase
1
427}-
428void QSqlDatabase::setDatabaseName(const QString& name)-
429{-
430 if (isValid()
isValid()Description
TRUEevaluated 25 times by 9 tests
Evaluated by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-25
431 d->dbname = name;
executed 25 times by 9 tests: d->dbname = name;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
25
432}
executed 25 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
25
433void QSqlDatabase::setUserName(const QString& name)-
434{-
435 if (isValid()
isValid()Description
TRUEevaluated 23 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-23
436 d->uname = name;
executed 23 times by 7 tests: d->uname = name;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
23
437}
executed 23 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
23
438void QSqlDatabase::setPassword(const QString& password)-
439{-
440 if (isValid()
isValid()Description
TRUEevaluated 22 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-22
441 d->pword = password;
executed 22 times by 7 tests: d->pword = password;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
22
442}
executed 22 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
22
443void QSqlDatabase::setHostName(const QString& host)-
444{-
445 if (isValid()
isValid()Description
TRUEevaluated 23 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-23
446 d->hname = host;
executed 23 times by 7 tests: d->hname = host;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
23
447}
executed 23 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
23
448void QSqlDatabase::setPort(int port)-
449{-
450 if (isValid()
isValid()Description
TRUEevaluated 20 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-20
451 d->port = port;
executed 20 times by 7 tests: d->port = port;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
20
452}
executed 20 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
20
453-
454-
455-
456-
457-
458-
459-
460QString QSqlDatabase::databaseName() const-
461{-
462 return
executed 21 times by 5 tests: return d->dbname;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlTableModel
  • tst_QSqlThread
d->dbname;
executed 21 times by 5 tests: return d->dbname;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlTableModel
  • tst_QSqlThread
21
463}-
464-
465-
466-
467-
468-
469-
470QString QSqlDatabase::userName() const-
471{-
472 return
executed 2 times by 1 test: return d->uname;
Executed by:
  • tst_QSql
d->uname;
executed 2 times by 1 test: return d->uname;
Executed by:
  • tst_QSql
2
473}-
474-
475-
476-
477-
478-
479-
480QString QSqlDatabase::password() const-
481{-
482 return
executed 2 times by 1 test: return d->pword;
Executed by:
  • tst_QSql
d->pword;
executed 2 times by 1 test: return d->pword;
Executed by:
  • tst_QSql
2
483}-
484-
485-
486-
487-
488-
489-
490QString QSqlDatabase::hostName() const-
491{-
492 return
executed 11564 times by 8 tests: return d->hname;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->hname;
executed 11564 times by 8 tests: return d->hname;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
11564
493}-
494-
495-
496-
497-
498-
499-
500QString QSqlDatabase::driverName() const-
501{-
502 return
executed 35660 times by 8 tests: return d->drvName;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->drvName;
executed 35660 times by 8 tests: return d->drvName;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
35660
503}-
504-
505-
506-
507-
508-
509-
510-
511int QSqlDatabase::port() const-
512{-
513 return
executed 11564 times by 8 tests: return d->port;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->port;
executed 11564 times by 8 tests: return d->port;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
11564
514}-
515QSqlDriver* QSqlDatabase::driver() const-
516{-
517 return
executed 4311 times by 8 tests: return d->driver;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver;
executed 4311 times by 8 tests: return d->driver;
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
4311
518}-
519QSqlError QSqlDatabase::lastError() const-
520{-
521 return
executed 29 times by 6 tests: return d->driver->lastError();
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver->lastError();
executed 29 times by 6 tests: return d->driver->lastError();
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QSqlThread
29
522}-
523QStringList QSqlDatabase::tables(QSql::TableType type) const-
524{-
525 return
executed 51 times by 8 tests: return d->driver->tables(type);
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver->tables(type);
executed 51 times by 8 tests: return d->driver->tables(type);
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
51
526}-
527QSqlIndex QSqlDatabase::primaryIndex(const QString& tablename) const-
528{-
529 return
executed 187 times by 4 tests: return d->driver->primaryIndex(tablename);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
d->driver->primaryIndex(tablename);
executed 187 times by 4 tests: return d->driver->primaryIndex(tablename);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
187
530}-
531QSqlRecord QSqlDatabase::record(const QString& tablename) const-
532{-
533 return
executed 328 times by 5 tests: return d->driver->record(tablename);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
d->driver->record(tablename);
executed 328 times by 5 tests: return d->driver->record(tablename);
Executed by:
  • tst_QItemModel
  • tst_QSqlDatabase
  • tst_QSqlQuery
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
328
534}-
535void QSqlDatabase::setConnectOptions(const QString &options)-
536{-
537 if (isValid()
isValid()Description
TRUEevaluated 21 times by 7 tests
Evaluated by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
FALSEnever evaluated
)
0-21
538 d->connOptions = options;
executed 21 times by 7 tests: d->connOptions = options;
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
21
539}
executed 21 times by 7 tests: end of block
Executed by:
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlThread
21
540-
541-
542-
543-
544-
545-
546-
547QString QSqlDatabase::connectOptions() const-
548{-
549 return
never executed: return d->connOptions;
d->connOptions;
never executed: return d->connOptions;
0
550}-
551bool QSqlDatabase::isDriverAvailable(const QString& name)-
552{-
553 return
never executed: return drivers().contains(name);
drivers().contains(name);
never executed: return drivers().contains(name);
0
554}-
555QSqlDatabase QSqlDatabase::addDatabase(QSqlDriver* driver, const QString& connectionName)-
556{-
557 QSqlDatabase db(driver);-
558 QSqlDatabasePrivate::addDatabase(db, connectionName);-
559 return
never executed: return db;
db;
never executed: return db;
0
560}-
561-
562-
563-
564-
565-
566-
567-
568bool QSqlDatabase::isValid() const-
569{-
570 return
executed 6783 times by 9 tests: return d->driver && d->driver != d->shared_null()->driver;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
d->driver && d->driver != d->shared_null()->driver;
executed 6783 times by 9 tests: return d->driver && d->driver != d->shared_null()->driver;
Executed by:
  • tst_QItemModel
  • tst_QSql
  • tst_QSqlDatabase
  • tst_QSqlDriver
  • tst_QSqlQuery
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QSqlThread
6783
571}-
572QSqlDatabase QSqlDatabase::cloneDatabase(const QSqlDatabase &other, const QString &connectionName)-
573{-
574 if (!other.isValid()
!other.isValid()Description
TRUEnever evaluated
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QSqlDatabase
  • tst_QSqlTableModel
  • tst_QSqlThread
)
0-7
575 return
never executed: return QSqlDatabase();
QSqlDatabase();
never executed: return QSqlDatabase();
0
576-
577 QSqlDatabase db(other.driverName());-
578 db.d->copy(other.d);-
579 QSqlDatabasePrivate::addDatabase(db, connectionName);-
580 return
executed 7 times by 3 tests: return db;
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlTableModel
  • tst_QSqlThread
db;
executed 7 times by 3 tests: return db;
Executed by:
  • tst_QSqlDatabase
  • tst_QSqlTableModel
  • tst_QSqlThread
7
581}-
582QString QSqlDatabase::connectionName() const-
583{-
584 return
executed 4 times by 1 test: return d->connName;
Executed by:
  • tst_QSqlDatabase
d->connName;
executed 4 times by 1 test: return d->connName;
Executed by:
  • tst_QSqlDatabase
4
585}-
586void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)-
587{-
588 if(driver()
driver()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSqlDatabase
FALSEnever evaluated
)
0-2
589 driver()->setNumericalPrecisionPolicy(precisionPolicy);
executed 2 times by 1 test: driver()->setNumericalPrecisionPolicy(precisionPolicy);
Executed by:
  • tst_QSqlDatabase
2
590 d->precisionPolicy = precisionPolicy;-
591}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QSqlDatabase
2
592QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const-
593{-
594 if(driver()
driver()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSqlDatabase
FALSEnever evaluated
)
0-1
595 return
executed 1 time by 1 test: return driver()->numericalPrecisionPolicy();
Executed by:
  • tst_QSqlDatabase
driver()->numericalPrecisionPolicy();
executed 1 time by 1 test: return driver()->numericalPrecisionPolicy();
Executed by:
  • tst_QSqlDatabase
1
596 else-
597 return
never executed: return d->precisionPolicy;
d->precisionPolicy;
never executed: return d->precisionPolicy;
0
598}-
599-
600-
601-
602QDebug operator<<(QDebug dbg, const QSqlDatabase &d)-
603{-
604 QDebugStateSaver saver(dbg);-
605 dbg.nospace();-
606 dbg.noquote();-
607 if (!d.isValid()
!d.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
608 dbg << "QSqlDatabase(invalid)";-
609 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
610 }-
611-
612 dbg << "QSqlDatabase(driver=\"" << d.driverName() << "\", database=\""-
613 << d.databaseName() << "\", host=\"" << d.hostName() << "\", port=" << d.port()-
614 << ", user=\"" << d.userName() << "\", open=" << d.isOpen() << ')';-
615 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
616}-
617-
618-
619-
Switch to Source codePreprocessed file

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