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