| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/sql/kernel/qsqldatabase.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | namespace { 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
executed 9 times by 9 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 9 times by 9 tests: }; 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; returnend of blockExecuted by:
executed 96 times by 9 tests: &holder.value;return &holder.value;Executed by:
executed 96 times by 9 tests: } } } static QGlobalStatic<QFactoryLoader, Q_QGS_loader::innerFunction, Q_QGS_loader::guard> loader;return &holder.value;Executed by:
| 0-96 | ||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | const | - | ||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | char *QSqlDatabase::defaultConnection = const_cast<char *>("qt_sql_default_connection"); | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | typedef QHash<QString, QSqlDriverCreatorBase*> DriverDict; | - | ||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | class QConnectionDict: public QHash<QString, QSqlDatabase> | - | ||||||||||||||||||
| 18 | { | - | ||||||||||||||||||
| 19 | public: | - | ||||||||||||||||||
| 20 | inline bool contains_ts(const QString &key) | - | ||||||||||||||||||
| 21 | { | - | ||||||||||||||||||
| 22 | QReadLocker locker(&lock); | - | ||||||||||||||||||
| 23 | return executed 2 times by 1 test: contains(key);return contains(key);Executed by:
executed 2 times by 1 test: return contains(key);Executed by:
| 2 | ||||||||||||||||||
| 24 | } | - | ||||||||||||||||||
| 25 | inline QStringList keys_ts() const | - | ||||||||||||||||||
| 26 | { | - | ||||||||||||||||||
| 27 | QReadLocker locker(&lock); | - | ||||||||||||||||||
| 28 | return never executed: keys();return keys();never executed: return keys(); | 0 | ||||||||||||||||||
| 29 | } | - | ||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | mutable QReadWriteLock lock; | - | ||||||||||||||||||
| 32 | }; | - | ||||||||||||||||||
| 33 | namespace { 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
executed 9 times by 9 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 9 times by 9 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 2321 times by 17 tests: &holder.value;return &holder.value;Executed by:
executed 2321 times by 17 tests: } } } static QGlobalStatic<QConnectionDict, Q_QGS_dbDict::innerFunction, Q_QGS_dbDict::guard> dbDict;return &holder.value;Executed by:
| 0-2321 | ||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | class QSqlDatabasePrivate | - | ||||||||||||||||||
| 36 | { | - | ||||||||||||||||||
| 37 | public: | - | ||||||||||||||||||
| 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 blockExecuted by:
| 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 | - | |||||||||||||||||||
| 74 | QSqlDatabasePrivate::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 | - | |||||||||||||||||||
| 88 | QSqlDatabasePrivate::~QSqlDatabasePrivate() | - | ||||||||||||||||||
| 89 | { | - | ||||||||||||||||||
| 90 | if (driver != shared_null()->driver
| 13-33 | ||||||||||||||||||
| 91 | delete driver; executed 33 times by 11 tests: delete driver;Executed by:
| 33 | ||||||||||||||||||
| 92 | } executed 46 times by 17 tests: end of blockExecuted by:
| 46 | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | void 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()
| 7-22 | ||||||||||||||||||
| 102 | invalidateDb(it.value(), it.key(), false); | - | ||||||||||||||||||
| 103 | ++it; | - | ||||||||||||||||||
| 104 | } executed 7 times by 4 tests: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 105 | dict->clear(); | - | ||||||||||||||||||
| 106 | } executed 22 times by 9 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | static bool qDriverDictInit = false; | - | ||||||||||||||||||
| 109 | static 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 blockExecuted by:
| 22 | ||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | DriverDict &QSqlDatabasePrivate::driverDict() | - | ||||||||||||||||||
| 118 | { | - | ||||||||||||||||||
| 119 | static DriverDict dict; | - | ||||||||||||||||||
| 120 | if (!qDriverDictInit
| 21-87 | ||||||||||||||||||
| 121 | qDriverDictInit = true; | - | ||||||||||||||||||
| 122 | qAddPostRoutine(cleanDriverDict); | - | ||||||||||||||||||
| 123 | } executed 21 times by 8 tests: end of blockExecuted by:
| 21 | ||||||||||||||||||
| 124 | return executed 108 times by 17 tests: dict;return dict;Executed by:
executed 108 times by 17 tests: return dict;Executed by:
| 108 | ||||||||||||||||||
| 125 | } | - | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | QSqlDatabasePrivate *QSqlDatabasePrivate::shared_null() | - | ||||||||||||||||||
| 128 | { | - | ||||||||||||||||||
| 129 | static QSqlNullDriver dr; | - | ||||||||||||||||||
| 130 | static QSqlDatabasePrivate n(__null, &dr); | - | ||||||||||||||||||
| 131 | return executed 8121 times by 18 tests: &n;return &n;Executed by:
executed 8121 times by 18 tests: return &n;Executed by:
| 8121 | ||||||||||||||||||
| 132 | } | - | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn) | - | ||||||||||||||||||
| 135 | { | - | ||||||||||||||||||
| 136 | if (db.d->ref.load() != 1
| 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 blockExecuted by:
| 1 | ||||||||||||||||||
| 142 | } executed 37 times by 11 tests: end of blockExecuted by:
| 37 | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | void 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)
| 0-30 | ||||||||||||||||||
| 151 | return; never executed: return; | 0 | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | invalidateDb(dict->take(name), name); | - | ||||||||||||||||||
| 154 | } executed 30 times by 8 tests: end of blockExecuted by:
| 30 | ||||||||||||||||||
| 155 | - | |||||||||||||||||||
| 156 | void 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)
| 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 blockExecuted by:
| 36 | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | QSqlDatabase 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()
| 5-1969 | ||||||||||||||||||
| 182 | if (!db.open()
| 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 blockExecuted by:
| 5 | ||||||||||||||||||
| 186 | return executed 2231 times by 9 tests: db;return db;Executed by:
executed 2231 times by 9 tests: return db;Executed by:
| 2231 | ||||||||||||||||||
| 187 | } | - | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | void 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 blockExecuted by:
| 7 | ||||||||||||||||||
| 205 | - | |||||||||||||||||||
| 206 | void QSqlDatabasePrivate::disable() | - | ||||||||||||||||||
| 207 | { | - | ||||||||||||||||||
| 208 | if (driver != shared_null()->driver
| 0-1 | ||||||||||||||||||
| 209 | delete driver; | - | ||||||||||||||||||
| 210 | driver = shared_null()->driver; | - | ||||||||||||||||||
| 211 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 212 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 213 | QSqlDatabase 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: db;return db;Executed by:
executed 29 times by 8 tests: return db;Executed by:
| 29 | ||||||||||||||||||
| 218 | } | - | ||||||||||||||||||
| 219 | QSqlDatabase QSqlDatabase::database(const QString& connectionName, bool open) | - | ||||||||||||||||||
| 220 | { | - | ||||||||||||||||||
| 221 | return executed 2231 times by 9 tests: QSqlDatabasePrivate::database(connectionName, open);return QSqlDatabasePrivate::database(connectionName, open);Executed by:
executed 2231 times by 9 tests: return QSqlDatabasePrivate::database(connectionName, open);Executed by:
| 2231 | ||||||||||||||||||
| 222 | } | - | ||||||||||||||||||
| 223 | void QSqlDatabase::removeDatabase(const QString& connectionName) | - | ||||||||||||||||||
| 224 | { | - | ||||||||||||||||||
| 225 | QSqlDatabasePrivate::removeDatabase(connectionName); | - | ||||||||||||||||||
| 226 | } executed 30 times by 8 tests: end of blockExecuted by:
| 30 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | - | |||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | QStringList QSqlDatabase::drivers() | - | ||||||||||||||||||
| 235 | { | - | ||||||||||||||||||
| 236 | QStringList list; | - | ||||||||||||||||||
| 237 | if (QFactoryLoader *fl = loader()
| 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
| 26-234 | ||||||||||||||||||
| 244 | if (!list.contains(it.value())
| 0-234 | ||||||||||||||||||
| 245 | list << it.value(); executed 234 times by 7 tests: list << it.value();Executed by:
| 234 | ||||||||||||||||||
| 246 | } executed 26 times by 7 tests: end of blockExecuted by:
| 26 | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | DriverDict dict = QSqlDatabasePrivate::driverDict(); | - | ||||||||||||||||||
| 249 | for (DriverDict::const_iterator i = dict.constBegin(); i != dict.constEnd()
| 1-26 | ||||||||||||||||||
| 250 | if (!list.contains(i.key())
| 0-1 | ||||||||||||||||||
| 251 | list << i.key(); executed 1 time by 1 test: list << i.key();Executed by:
| 1 | ||||||||||||||||||
| 252 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | return executed 26 times by 7 tests: list;return list;Executed by:
executed 26 times by 7 tests: return list;Executed by:
| 26 | ||||||||||||||||||
| 255 | } | - | ||||||||||||||||||
| 256 | void QSqlDatabase::registerSqlDriver(const QString& name, QSqlDriverCreatorBase *creator) | - | ||||||||||||||||||
| 257 | { | - | ||||||||||||||||||
| 258 | delete QSqlDatabasePrivate::driverDict().take(name); | - | ||||||||||||||||||
| 259 | if (creator
| 0-1 | ||||||||||||||||||
| 260 | QSqlDatabasePrivate::driverDict().insert(name, creator); executed 1 time by 1 test: QSqlDatabasePrivate::driverDict().insert(name, creator);Executed by:
| 1 | ||||||||||||||||||
| 261 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 262 | bool QSqlDatabase::contains(const QString& connectionName) | - | ||||||||||||||||||
| 263 | { | - | ||||||||||||||||||
| 264 | return executed 2 times by 1 test: dbDict()->contains_ts(connectionName);return dbDict()->contains_ts(connectionName);Executed by:
executed 2 times by 1 test: return dbDict()->contains_ts(connectionName);Executed by:
| 2 | ||||||||||||||||||
| 265 | } | - | ||||||||||||||||||
| 266 | QStringList QSqlDatabase::connectionNames() | - | ||||||||||||||||||
| 267 | { | - | ||||||||||||||||||
| 268 | return never executed: dbDict()->keys_ts();return dbDict()->keys_ts();never executed: return dbDict()->keys_ts(); | 0 | ||||||||||||||||||
| 269 | } | - | ||||||||||||||||||
| 270 | QSqlDatabase::QSqlDatabase(const QString &type) | - | ||||||||||||||||||
| 271 | { | - | ||||||||||||||||||
| 272 | d = new QSqlDatabasePrivate(this); | - | ||||||||||||||||||
| 273 | d->init(type); | - | ||||||||||||||||||
| 274 | } executed 36 times by 9 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | QSqlDatabase::QSqlDatabase(QSqlDriver *driver) | - | ||||||||||||||||||
| 283 | { | - | ||||||||||||||||||
| 284 | d = new QSqlDatabasePrivate(this, driver); | - | ||||||||||||||||||
| 285 | } never executed: end of block | 0 | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | QSqlDatabase::QSqlDatabase() | - | ||||||||||||||||||
| 293 | { | - | ||||||||||||||||||
| 294 | d = QSqlDatabasePrivate::shared_null(); | - | ||||||||||||||||||
| 295 | d->ref.ref(); | - | ||||||||||||||||||
| 296 | } executed 1287 times by 9 tests: end of blockExecuted by:
| 1287 | ||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | - | |||||||||||||||||||
| 301 | QSqlDatabase::QSqlDatabase(const QSqlDatabase &other) | - | ||||||||||||||||||
| 302 | { | - | ||||||||||||||||||
| 303 | d = other.d; | - | ||||||||||||||||||
| 304 | d->ref.ref(); | - | ||||||||||||||||||
| 305 | } executed 19102 times by 9 tests: end of blockExecuted by:
| 19102 | ||||||||||||||||||
| 306 | - | |||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | - | |||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | QSqlDatabase &QSqlDatabase::operator=(const QSqlDatabase &other) | - | ||||||||||||||||||
| 311 | { | - | ||||||||||||||||||
| 312 | qAtomicAssign(d, other.d); | - | ||||||||||||||||||
| 313 | return executed 968 times by 9 tests: *this;return *this;Executed by:
executed 968 times by 9 tests: return *this;Executed by:
| 968 | ||||||||||||||||||
| 314 | } | - | ||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | - | |||||||||||||||||||
| 317 | - | |||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | void QSqlDatabasePrivate::init(const QString &type) | - | ||||||||||||||||||
| 323 | { | - | ||||||||||||||||||
| 324 | drvName = type; | - | ||||||||||||||||||
| 325 | - | |||||||||||||||||||
| 326 | if (!driver
| 0-36 | ||||||||||||||||||
| 327 | } executed 36 times by 9 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | if (!driver
| 0-36 | ||||||||||||||||||
| 330 | DriverDict dict = QSqlDatabasePrivate::driverDict(); | - | ||||||||||||||||||
| 331 | for (DriverDict::const_iterator it = dict.constBegin(); | - | ||||||||||||||||||
| 332 | it != dict.constEnd()
| 0-36 | ||||||||||||||||||
| 333 | if (type == it.key()
| 0-1 | ||||||||||||||||||
| 334 | driver = ((QSqlDriverCreatorBase*)(*it))->createObject(); | - | ||||||||||||||||||
| 335 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 336 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 337 | } executed 36 times by 9 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | if (!driver
| 0-35 | ||||||||||||||||||
| 340 | driver = qLoadPlugin<QSqlDriver, QSqlDriverPlugin>(loader(), type); executed 35 times by 9 tests: driver = qLoadPlugin<QSqlDriver, QSqlDriverPlugin>(loader(), type);Executed by:
| 35 | ||||||||||||||||||
| 341 | - | |||||||||||||||||||
| 342 | if (!driver
| 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
| 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:
| 1 | ||||||||||||||||||
| 348 | driver = shared_null()->driver; | - | ||||||||||||||||||
| 349 | } executed 3 times by 3 tests: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 350 | } executed 36 times by 9 tests: end of blockExecuted by:
| 36 | ||||||||||||||||||
| 351 | - | |||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | - | |||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | QSqlDatabase::~QSqlDatabase() | - | ||||||||||||||||||
| 359 | { | - | ||||||||||||||||||
| 360 | if (!d->ref.deref()
| 37-20389 | ||||||||||||||||||
| 361 | close(); | - | ||||||||||||||||||
| 362 | delete d; | - | ||||||||||||||||||
| 363 | } executed 37 times by 11 tests: end of blockExecuted by:
| 37 | ||||||||||||||||||
| 364 | } executed 20426 times by 12 tests: end of blockExecuted by:
| 20426 | ||||||||||||||||||
| 365 | QSqlQuery QSqlDatabase::exec(const QString & query) const | - | ||||||||||||||||||
| 366 | { | - | ||||||||||||||||||
| 367 | QSqlQuery r(d->driver->createResult()); | - | ||||||||||||||||||
| 368 | if (!query.isEmpty()
| 0-16 | ||||||||||||||||||
| 369 | r.exec(query); | - | ||||||||||||||||||
| 370 | d->driver->setLastError(r.lastError()); | - | ||||||||||||||||||
| 371 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 372 | return executed 16 times by 1 test: r;return r;Executed by:
executed 16 times by 1 test: return r;Executed by:
| 16 | ||||||||||||||||||
| 373 | } | - | ||||||||||||||||||
| 374 | bool QSqlDatabase::open() | - | ||||||||||||||||||
| 375 | { | - | ||||||||||||||||||
| 376 | return executed 48 times by 9 tests: d->driver->open(d->dbname, d->uname, d->pword, d->hname,return d->driver->open(d->dbname, d->uname, d->pword, d->hname, d->port, d->connOptions);Executed by:
executed 48 times by 9 tests: return d->driver->open(d->dbname, d->uname, d->pword, d->hname, d->port, d->connOptions);Executed by:
| 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:
| 48 | ||||||||||||||||||
| 378 | } | - | ||||||||||||||||||
| 379 | bool QSqlDatabase::open(const QString& user, const QString& password) | - | ||||||||||||||||||
| 380 | { | - | ||||||||||||||||||
| 381 | setUserName(user); | - | ||||||||||||||||||
| 382 | return executed 1 time by 1 test: d->driver->open(d->dbname, user, password, d->hname,return d->driver->open(d->dbname, user, password, d->hname, d->port, d->connOptions);Executed by:
executed 1 time by 1 test: return d->driver->open(d->dbname, user, password, d->hname, d->port, d->connOptions);Executed by:
| 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:
| 1 | ||||||||||||||||||
| 384 | } | - | ||||||||||||||||||
| 385 | void QSqlDatabase::close() | - | ||||||||||||||||||
| 386 | { | - | ||||||||||||||||||
| 387 | d->driver->close(); | - | ||||||||||||||||||
| 388 | } executed 80 times by 11 tests: end of blockExecuted by:
| 80 | ||||||||||||||||||
| 389 | - | |||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | - | |||||||||||||||||||
| 395 | bool QSqlDatabase::isOpen() const | - | ||||||||||||||||||
| 396 | { | - | ||||||||||||||||||
| 397 | return executed 2027 times by 9 tests: d->driver->isOpen();return d->driver->isOpen();Executed by:
executed 2027 times by 9 tests: return d->driver->isOpen();Executed by:
| 2027 | ||||||||||||||||||
| 398 | } | - | ||||||||||||||||||
| 399 | - | |||||||||||||||||||
| 400 | - | |||||||||||||||||||
| 401 | - | |||||||||||||||||||
| 402 | - | |||||||||||||||||||
| 403 | - | |||||||||||||||||||
| 404 | - | |||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | bool QSqlDatabase::isOpenError() const | - | ||||||||||||||||||
| 407 | { | - | ||||||||||||||||||
| 408 | return executed 10 times by 1 test: d->driver->isOpenError();return d->driver->isOpenError();Executed by:
executed 10 times by 1 test: return d->driver->isOpenError();Executed by:
| 10 | ||||||||||||||||||
| 409 | } | - | ||||||||||||||||||
| 410 | bool QSqlDatabase::transaction() | - | ||||||||||||||||||
| 411 | { | - | ||||||||||||||||||
| 412 | if (!d->driver->hasFeature(QSqlDriver::Transactions)
| 0-5 | ||||||||||||||||||
| 413 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 414 | return executed 5 times by 3 tests: d->driver->beginTransaction();return d->driver->beginTransaction();Executed by:
executed 5 times by 3 tests: return d->driver->beginTransaction();Executed by:
| 5 | ||||||||||||||||||
| 415 | } | - | ||||||||||||||||||
| 416 | bool QSqlDatabase::commit() | - | ||||||||||||||||||
| 417 | { | - | ||||||||||||||||||
| 418 | if (!d->driver->hasFeature(QSqlDriver::Transactions)
| 0-4 | ||||||||||||||||||
| 419 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 420 | return executed 4 times by 3 tests: d->driver->commitTransaction();return d->driver->commitTransaction();Executed by:
executed 4 times by 3 tests: return d->driver->commitTransaction();Executed by:
| 4 | ||||||||||||||||||
| 421 | } | - | ||||||||||||||||||
| 422 | bool QSqlDatabase::rollback() | - | ||||||||||||||||||
| 423 | { | - | ||||||||||||||||||
| 424 | if (!d->driver->hasFeature(QSqlDriver::Transactions)
| 0-1 | ||||||||||||||||||
| 425 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 426 | return executed 1 time by 1 test: d->driver->rollbackTransaction();return d->driver->rollbackTransaction();Executed by:
executed 1 time by 1 test: return d->driver->rollbackTransaction();Executed by:
| 1 | ||||||||||||||||||
| 427 | } | - | ||||||||||||||||||
| 428 | void QSqlDatabase::setDatabaseName(const QString& name) | - | ||||||||||||||||||
| 429 | { | - | ||||||||||||||||||
| 430 | if (isValid()
| 0-25 | ||||||||||||||||||
| 431 | d->dbname = name; executed 25 times by 9 tests: d->dbname = name;Executed by:
| 25 | ||||||||||||||||||
| 432 | } executed 25 times by 9 tests: end of blockExecuted by:
| 25 | ||||||||||||||||||
| 433 | void QSqlDatabase::setUserName(const QString& name) | - | ||||||||||||||||||
| 434 | { | - | ||||||||||||||||||
| 435 | if (isValid()
| 0-23 | ||||||||||||||||||
| 436 | d->uname = name; executed 23 times by 7 tests: d->uname = name;Executed by:
| 23 | ||||||||||||||||||
| 437 | } executed 23 times by 7 tests: end of blockExecuted by:
| 23 | ||||||||||||||||||
| 438 | void QSqlDatabase::setPassword(const QString& password) | - | ||||||||||||||||||
| 439 | { | - | ||||||||||||||||||
| 440 | if (isValid()
| 0-22 | ||||||||||||||||||
| 441 | d->pword = password; executed 22 times by 7 tests: d->pword = password;Executed by:
| 22 | ||||||||||||||||||
| 442 | } executed 22 times by 7 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||
| 443 | void QSqlDatabase::setHostName(const QString& host) | - | ||||||||||||||||||
| 444 | { | - | ||||||||||||||||||
| 445 | if (isValid()
| 0-23 | ||||||||||||||||||
| 446 | d->hname = host; executed 23 times by 7 tests: d->hname = host;Executed by:
| 23 | ||||||||||||||||||
| 447 | } executed 23 times by 7 tests: end of blockExecuted by:
| 23 | ||||||||||||||||||
| 448 | void QSqlDatabase::setPort(int port) | - | ||||||||||||||||||
| 449 | { | - | ||||||||||||||||||
| 450 | if (isValid()
| 0-20 | ||||||||||||||||||
| 451 | d->port = port; executed 20 times by 7 tests: d->port = port;Executed by:
| 20 | ||||||||||||||||||
| 452 | } executed 20 times by 7 tests: end of blockExecuted by:
| 20 | ||||||||||||||||||
| 453 | - | |||||||||||||||||||
| 454 | - | |||||||||||||||||||
| 455 | - | |||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | QString QSqlDatabase::databaseName() const | - | ||||||||||||||||||
| 461 | { | - | ||||||||||||||||||
| 462 | return executed 21 times by 5 tests: d->dbname;return d->dbname;Executed by:
executed 21 times by 5 tests: return d->dbname;Executed by:
| 21 | ||||||||||||||||||
| 463 | } | - | ||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | - | |||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | - | |||||||||||||||||||
| 470 | QString QSqlDatabase::userName() const | - | ||||||||||||||||||
| 471 | { | - | ||||||||||||||||||
| 472 | return executed 2 times by 1 test: d->uname;return d->uname;Executed by:
executed 2 times by 1 test: return d->uname;Executed by:
| 2 | ||||||||||||||||||
| 473 | } | - | ||||||||||||||||||
| 474 | - | |||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | - | |||||||||||||||||||
| 480 | QString QSqlDatabase::password() const | - | ||||||||||||||||||
| 481 | { | - | ||||||||||||||||||
| 482 | return executed 2 times by 1 test: d->pword;return d->pword;Executed by:
executed 2 times by 1 test: return d->pword;Executed by:
| 2 | ||||||||||||||||||
| 483 | } | - | ||||||||||||||||||
| 484 | - | |||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | - | |||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | QString QSqlDatabase::hostName() const | - | ||||||||||||||||||
| 491 | { | - | ||||||||||||||||||
| 492 | return executed 11564 times by 8 tests: d->hname;return d->hname;Executed by:
executed 11564 times by 8 tests: return d->hname;Executed by:
| 11564 | ||||||||||||||||||
| 493 | } | - | ||||||||||||||||||
| 494 | - | |||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | - | |||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | - | |||||||||||||||||||
| 500 | QString QSqlDatabase::driverName() const | - | ||||||||||||||||||
| 501 | { | - | ||||||||||||||||||
| 502 | return executed 35660 times by 8 tests: d->drvName;return d->drvName;Executed by:
executed 35660 times by 8 tests: return d->drvName;Executed by:
| 35660 | ||||||||||||||||||
| 503 | } | - | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | - | |||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | - | |||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | int QSqlDatabase::port() const | - | ||||||||||||||||||
| 512 | { | - | ||||||||||||||||||
| 513 | return executed 11564 times by 8 tests: d->port;return d->port;Executed by:
executed 11564 times by 8 tests: return d->port;Executed by:
| 11564 | ||||||||||||||||||
| 514 | } | - | ||||||||||||||||||
| 515 | QSqlDriver* QSqlDatabase::driver() const | - | ||||||||||||||||||
| 516 | { | - | ||||||||||||||||||
| 517 | return executed 4311 times by 8 tests: d->driver;return d->driver;Executed by:
executed 4311 times by 8 tests: return d->driver;Executed by:
| 4311 | ||||||||||||||||||
| 518 | } | - | ||||||||||||||||||
| 519 | QSqlError QSqlDatabase::lastError() const | - | ||||||||||||||||||
| 520 | { | - | ||||||||||||||||||
| 521 | return executed 29 times by 6 tests: d->driver->lastError();return d->driver->lastError();Executed by:
executed 29 times by 6 tests: return d->driver->lastError();Executed by:
| 29 | ||||||||||||||||||
| 522 | } | - | ||||||||||||||||||
| 523 | QStringList QSqlDatabase::tables(QSql::TableType type) const | - | ||||||||||||||||||
| 524 | { | - | ||||||||||||||||||
| 525 | return executed 51 times by 8 tests: d->driver->tables(type);return d->driver->tables(type);Executed by:
executed 51 times by 8 tests: return d->driver->tables(type);Executed by:
| 51 | ||||||||||||||||||
| 526 | } | - | ||||||||||||||||||
| 527 | QSqlIndex QSqlDatabase::primaryIndex(const QString& tablename) const | - | ||||||||||||||||||
| 528 | { | - | ||||||||||||||||||
| 529 | return executed 187 times by 4 tests: d->driver->primaryIndex(tablename);return d->driver->primaryIndex(tablename);Executed by:
executed 187 times by 4 tests: return d->driver->primaryIndex(tablename);Executed by:
| 187 | ||||||||||||||||||
| 530 | } | - | ||||||||||||||||||
| 531 | QSqlRecord QSqlDatabase::record(const QString& tablename) const | - | ||||||||||||||||||
| 532 | { | - | ||||||||||||||||||
| 533 | return executed 328 times by 5 tests: d->driver->record(tablename);return d->driver->record(tablename);Executed by:
executed 328 times by 5 tests: return d->driver->record(tablename);Executed by:
| 328 | ||||||||||||||||||
| 534 | } | - | ||||||||||||||||||
| 535 | void QSqlDatabase::setConnectOptions(const QString &options) | - | ||||||||||||||||||
| 536 | { | - | ||||||||||||||||||
| 537 | if (isValid()
| 0-21 | ||||||||||||||||||
| 538 | d->connOptions = options; executed 21 times by 7 tests: d->connOptions = options;Executed by:
| 21 | ||||||||||||||||||
| 539 | } executed 21 times by 7 tests: end of blockExecuted by:
| 21 | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | - | |||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | - | |||||||||||||||||||
| 545 | - | |||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | QString QSqlDatabase::connectOptions() const | - | ||||||||||||||||||
| 548 | { | - | ||||||||||||||||||
| 549 | return never executed: d->connOptions;return d->connOptions;never executed: return d->connOptions; | 0 | ||||||||||||||||||
| 550 | } | - | ||||||||||||||||||
| 551 | bool QSqlDatabase::isDriverAvailable(const QString& name) | - | ||||||||||||||||||
| 552 | { | - | ||||||||||||||||||
| 553 | return never executed: drivers().contains(name);return drivers().contains(name);never executed: return drivers().contains(name); | 0 | ||||||||||||||||||
| 554 | } | - | ||||||||||||||||||
| 555 | QSqlDatabase QSqlDatabase::addDatabase(QSqlDriver* driver, const QString& connectionName) | - | ||||||||||||||||||
| 556 | { | - | ||||||||||||||||||
| 557 | QSqlDatabase db(driver); | - | ||||||||||||||||||
| 558 | QSqlDatabasePrivate::addDatabase(db, connectionName); | - | ||||||||||||||||||
| 559 | return never executed: db;return db;never executed: return db; | 0 | ||||||||||||||||||
| 560 | } | - | ||||||||||||||||||
| 561 | - | |||||||||||||||||||
| 562 | - | |||||||||||||||||||
| 563 | - | |||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | - | |||||||||||||||||||
| 566 | - | |||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | bool QSqlDatabase::isValid() const | - | ||||||||||||||||||
| 569 | { | - | ||||||||||||||||||
| 570 | return executed 6783 times by 9 tests: d->driver && d->driver != d->shared_null()->driver;return d->driver && d->driver != d->shared_null()->driver;Executed by:
executed 6783 times by 9 tests: return d->driver && d->driver != d->shared_null()->driver;Executed by:
| 6783 | ||||||||||||||||||
| 571 | } | - | ||||||||||||||||||
| 572 | QSqlDatabase QSqlDatabase::cloneDatabase(const QSqlDatabase &other, const QString &connectionName) | - | ||||||||||||||||||
| 573 | { | - | ||||||||||||||||||
| 574 | if (!other.isValid()
| 0-7 | ||||||||||||||||||
| 575 | return never executed: QSqlDatabase();return 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: db;return db;Executed by:
executed 7 times by 3 tests: return db;Executed by:
| 7 | ||||||||||||||||||
| 581 | } | - | ||||||||||||||||||
| 582 | QString QSqlDatabase::connectionName() const | - | ||||||||||||||||||
| 583 | { | - | ||||||||||||||||||
| 584 | return executed 4 times by 1 test: d->connName;return d->connName;Executed by:
executed 4 times by 1 test: return d->connName;Executed by:
| 4 | ||||||||||||||||||
| 585 | } | - | ||||||||||||||||||
| 586 | void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) | - | ||||||||||||||||||
| 587 | { | - | ||||||||||||||||||
| 588 | if(driver()
| 0-2 | ||||||||||||||||||
| 589 | driver()->setNumericalPrecisionPolicy(precisionPolicy); executed 2 times by 1 test: driver()->setNumericalPrecisionPolicy(precisionPolicy);Executed by:
| 2 | ||||||||||||||||||
| 590 | d->precisionPolicy = precisionPolicy; | - | ||||||||||||||||||
| 591 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 592 | QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const | - | ||||||||||||||||||
| 593 | { | - | ||||||||||||||||||
| 594 | if(driver()
| 0-1 | ||||||||||||||||||
| 595 | return executed 1 time by 1 test: driver()->numericalPrecisionPolicy();return driver()->numericalPrecisionPolicy();Executed by:
executed 1 time by 1 test: return driver()->numericalPrecisionPolicy();Executed by:
| 1 | ||||||||||||||||||
| 596 | else | - | ||||||||||||||||||
| 597 | return never executed: d->precisionPolicy;return d->precisionPolicy;never executed: return d->precisionPolicy; | 0 | ||||||||||||||||||
| 598 | } | - | ||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | - | |||||||||||||||||||
| 602 | QDebug operator<<(QDebug dbg, const QSqlDatabase &d) | - | ||||||||||||||||||
| 603 | { | - | ||||||||||||||||||
| 604 | QDebugStateSaver saver(dbg); | - | ||||||||||||||||||
| 605 | dbg.nospace(); | - | ||||||||||||||||||
| 606 | dbg.noquote(); | - | ||||||||||||||||||
| 607 | if (!d.isValid()
| 0 | ||||||||||||||||||
| 608 | dbg << "QSqlDatabase(invalid)"; | - | ||||||||||||||||||
| 609 | return never executed: dbg;return 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: dbg;return dbg;never executed: return dbg; | 0 | ||||||||||||||||||
| 616 | } | - | ||||||||||||||||||
| 617 | - | |||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |