void QSqlDatabasePrivate::removeDatabase(const QString &name) { QConnectionDict *dict = dbDict(); Q_ASSERT(dict); QWriteLocker locker(&dict->lock); if (!dict->contains(name)) return; invalidateDb(dict->take(name), name); }
void QSqlDatabasePrivate::cleanConnections() { QConnectionDict *dict = dbDict(); Q_ASSERT(dict); QWriteLocker locker(&dict->lock); QConnectionDict::iterator it = dict->begin(); while (it != dict->end()) { invalidateDb(it.value(), it.key(), false); ++it; } dict->clear(); }
void QSqlDatabasePrivate::addDatabase(const QSqlDatabase &db, const QString &name) { QConnectionDict *dict = dbDict(); Q_ASSERT(dict); QWriteLocker locker(&dict->lock); if (dict->contains(name)) { invalidateDb(dict->take(name), name); qWarning("QSqlDatabasePrivate::addDatabase: duplicate connection name '%s', old " "connection removed.", name.toLocal8Bit().data()); } dict->insert(name, db); }