C++ (Qt)QString conn;{ QSqlDatabase db = QSqlDatabase::database(); conn = db.connectionName(); db.close();}QSqlDatabase::removeDatabase(conn);
C++ (Qt) QTemporaryFile f; f.open();// f.setAutoRemove(true); // by default is true qDebug() << "File name:" << f.fileName(); { QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(f.fileName()); qDebug() << "Db is open:" << db.open(); QSqlQuery q("create table t1(c1 int, c2 varchar(32));"); qDebug() << "exec:" << q.exec() << q.lastError(); db.close(); }