tst_QSql*/sqlite: Don't use random output in the datatags

It makes it impossible to rerun it, bad for both CI and local test runs.

As a drive-by name the database file sqlite.db instead of foo.db

Pick-to: 6.2 6.4
Fixes: QTBUG-100245
Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Mårten Nordheim 2022-09-12 16:45:39 +02:00
parent 1bf3faa54b
commit 30077d462d

View File

@ -182,6 +182,14 @@ public:
if ( port > 0 )
cName += QLatin1Char(':') + QString::number( port );
if (driver == "QSQLITE") {
// Since the database for sqlite is generated at runtime it's always
// available, but we use QTempDir so it's always in a different
// location. Thus, let's ignore the path completely.
cName = "SQLite";
qInfo("SQLite will use the database located at %ls", qUtf16Printable(dbName));
}
db = QSqlDatabase::addDatabase( driver, cName );
if ( !db.isValid() ) {
@ -250,7 +258,7 @@ public:
}
QTemporaryDir *sqLiteDir = dbDir();
if (sqLiteDir) {
addDb(QStringLiteral("QSQLITE"), QDir::toNativeSeparators(sqLiteDir->path() + QStringLiteral("/foo.db")));
addDb(QStringLiteral("QSQLITE"), QDir::toNativeSeparators(sqLiteDir->path() + QStringLiteral("/sqlite.db")));
added = true;
}
return added;