Qt is open-source so...
void QSqlDatabase::removeDatabase(const QString
& connectionName
) {
QSqlDatabasePrivate::removeDatabase(connectionName);
}
void QSqlDatabasePrivate
::removeDatabase(const QString &name
) {
QConnectionDict *dict = dbDict();
Q_ASSERT(dict);
if (!dict->contains(name))
return;
invalidateDb(dict->take(name), name);
}
void QSqlDatabase::removeDatabase(const QString& connectionName)
{
QSqlDatabasePrivate::removeDatabase(connectionName);
}
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);
}
To copy to clipboard, switch view to plain text mode
... and ...
{
if (db.d->ref != 1) {
qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "
"all queries will cease to work.", name.toLocal8Bit().constData());
db.d->disable();
db.d->connName.clear();
}
}
void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name)
{
if (db.d->ref != 1) {
qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, "
"all queries will cease to work.", name.toLocal8Bit().constData());
db.d->disable();
db.d->connName.clear();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks