Qt is open-source so...

Qt Code:
  1. void QSqlDatabase::removeDatabase(const QString& connectionName)
  2. {
  3. QSqlDatabasePrivate::removeDatabase(connectionName);
  4. }
  5.  
  6. void QSqlDatabasePrivate::removeDatabase(const QString &name)
  7. {
  8. QConnectionDict *dict = dbDict();
  9. Q_ASSERT(dict);
  10. QWriteLocker locker(&dict->lock);
  11.  
  12. if (!dict->contains(name))
  13. return;
  14.  
  15. invalidateDb(dict->take(name), name);
  16. }
To copy to clipboard, switch view to plain text mode 

... and ...

Qt Code:
  1. void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name)
  2. {
  3. if (db.d->ref != 1) {
  4. qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "
  5. "all queries will cease to work.", name.toLocal8Bit().constData());
  6. db.d->disable();
  7. db.d->connName.clear();
  8. }
  9. }
To copy to clipboard, switch view to plain text mode