SQL tests: remove unused tests

They were leftovers from QTDS driver removed with Qt6

Change-Id: I34863912bd41e0b4ca54bf443001f1cb3f20511a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-02-14 20:07:53 +01:00
parent 34a0f2251a
commit 37032b1590
2 changed files with 0 additions and 174 deletions

View File

@ -50,8 +50,6 @@ private slots:
void eventNotification_data() { generic_data(); }
void eventNotification();
void addDatabase();
void errorReporting_data();
void errorReporting();
void cloneDatabase_data() { generic_data(); }
void cloneDatabase();
@ -62,8 +60,6 @@ private slots:
void recordPSQL();
void recordOCI_data() { generic_data("QOCI"); }
void recordOCI();
void recordTDS_data() { generic_data("QTDS"); }
void recordTDS();
void recordDB2_data() { generic_data("QDB2"); }
void recordDB2();
void recordSQLite_data() { generic_data("QSQLITE"); }
@ -433,36 +429,6 @@ void tst_QSqlDatabase::addDatabase()
QVERIFY(!QSqlDatabase::contains("INVALID_CONNECTION"));
}
void tst_QSqlDatabase::errorReporting_data()
{
QTest::addColumn<QString>("driver");
QTest::newRow("QTDS") << QString::fromLatin1("QTDS");
QTest::newRow("QTDS7") << QString::fromLatin1("QTDS7");
}
void tst_QSqlDatabase::errorReporting()
{
QFETCH(QString, driver);
if (!QSqlDatabase::drivers().contains(driver))
QSKIP(QString::fromLatin1("Database driver %1 not available").arg(driver).toLocal8Bit().constData());
const QString dbName = QLatin1String("errorReportingDb-") + driver;
QSqlDatabase db = QSqlDatabase::addDatabase(driver, dbName);
db.setHostName(QLatin1String("127.0.0.1"));
db.setDatabaseName(QLatin1String("NonExistantDatabase"));
db.setUserName(QLatin1String("InvalidUser"));
db.setPassword(QLatin1String("IncorrectPassword"));
QVERIFY(!db.open());
db = QSqlDatabase();
QSqlDatabase::removeDatabase(dbName);
}
void tst_QSqlDatabase::open()
{
QFETCH(QString, dbName);
@ -672,43 +638,6 @@ void tst_QSqlDatabase::commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase
QVERIFY_SQL(q, exec("select * from " + tableNames.at(0)));
}
void tst_QSqlDatabase::recordTDS()
{
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
static const FieldDef fieldDefs[] = {
FieldDef("tinyint", QMetaType::Int, 255),
FieldDef("smallint", QMetaType::Int, 32767),
FieldDef("int", QMetaType::Int, 2147483647),
FieldDef("numeric(10,9)", QMetaType::Double, 1.23456789),
FieldDef("decimal(10,9)", QMetaType::Double, 1.23456789),
FieldDef("float(4)", QMetaType::Double, 1.23456789),
FieldDef("double precision", QMetaType::Double, 1.23456789),
FieldDef("real", QMetaType::Double, 1.23456789),
FieldDef("smallmoney", QMetaType::Double, 100.42),
FieldDef("money", QMetaType::Double, 200.42),
// accuracy is that of a minute
FieldDef("smalldatetime", QMetaType::QDateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 0, 0))),
// accuracy is that of a second
FieldDef("datetime", QMetaType::QDateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 3, 0))),
FieldDef("char(20)", QMetaType::QString, "blah1"),
FieldDef("varchar(20)", QMetaType::QString, "blah2"),
FieldDef("nchar(20)", QMetaType::QString, "blah3"),
FieldDef("nvarchar(20)", QMetaType::QString, "blah4"),
FieldDef("text", QMetaType::QString, "blah5"),
FieldDef("bit", QMetaType::Int, 1, false),
FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
QVERIFY(fieldCount > 0);
commonFieldTest(fieldDefs, db, fieldCount);
}
void tst_QSqlDatabase::recordOCI()
{
bool hasTimeStamp = false;

View File

@ -58,8 +58,6 @@ private slots:
void last();
void seek_data() { generic_data(); }
void seek();
void transaction_data() { generic_data(); }
void transaction();
void record_data() { generic_data(); }
void record();
void record_sqlite_data() { generic_data("QSQLITE"); }
@ -80,8 +78,6 @@ private slots:
void psql_forwardOnlyQueryResultsLost();
// Bug-specific tests:
void tds_bitField_data() { generic_data("QTDS"); }
void tds_bitField();
void oci_nullBlob_data() { generic_data("QOCI"); }
void oci_nullBlob();
void blob_data() { generic_data(); }
@ -1869,27 +1865,6 @@ void tst_QSqlQuery::writeNull()
}
}
// TDS-specific BIT field test:
void tst_QSqlQuery::tds_bitField()
{
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QString tableName = qTableName("qtest_bittest", __FILE__, db);
QSqlQuery q(db);
QVERIFY_SQL(q, exec(QLatin1String("create table %1 (bitty bit)").arg(tableName)));
QVERIFY_SQL(q, exec(QLatin1String("insert into %1 values (0)").arg(tableName)));
QVERIFY_SQL(q, exec(QLatin1String("insert into %1 values (1)").arg(tableName)));
QVERIFY_SQL(q, exec("select bitty from " + tableName));
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 0);
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 1);
}
// Oracle-specific NULL BLOB test:
void tst_QSqlQuery::oci_nullBlob()
{
@ -2018,84 +1993,6 @@ void tst_QSqlQuery::nullResult()
QVERIFY(!q.seek(0));
}
// This test is just an experiment to see whether we can do query-based transactions.
// The real transaction test is in tst_QSqlDatabase.
void tst_QSqlQuery::transaction()
{
// Query-based transaction is not really possible with Qt:
QSKIP("only tested manually by trained staff");
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (!db.driver()->hasFeature(QSqlDriver::Transactions))
QSKIP("DBMS not transaction-capable");
// This is the standard SQL:
QString startTransactionStr("start transaction");
if (dbType == QSqlDriver::MySqlServer)
startTransactionStr = "begin work";
QSqlQuery q(db);
QSqlQuery q2(db);
// Test a working transaction:
q.exec(startTransactionStr);
QVERIFY_SQL(q, exec(QLatin1String("insert into%1 values (40, 'VarChar40', 'Char40')")
.arg(qtest)));
QVERIFY_SQL(q, exec(QLatin1String("select * from%1 where id = 40").arg(qtest)));
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 40);
QVERIFY_SQL(q, exec("commit"));
QVERIFY_SQL(q, exec(QLatin1String("select * from%1 where id = 40").arg(qtest)));
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 40);
// Test a rollback:
q.exec(startTransactionStr);
QVERIFY_SQL(q, exec(QLatin1String("insert into%1 values (41, 'VarChar41', 'Char41')")
.arg(qtest)));
QVERIFY_SQL(q, exec(QLatin1String("select * from%1 where id = 41").arg(qtest)));
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 41);
if (!q.exec("rollback")) {
if (dbType == QSqlDriver::MySqlServer) {
qDebug("MySQL: %s", qPrintable(tst_Databases::printError(q.lastError())));
QSKIP("MySQL transaction failed "); // non-fatal
} else {
QFAIL("Could not rollback transaction: " + tst_Databases::printError(q.lastError()));
}
}
QVERIFY_SQL(q, exec(QLatin1String("select * from%1 where id = 41").arg(qtest)));
QVERIFY(!q.next());
// Test concurrent access:
q.exec(startTransactionStr);
QVERIFY_SQL(q, exec(QLatin1String("insert into%1 values (42, 'VarChar42', 'Char42')")
.arg(qtest)));
QVERIFY_SQL(q, exec(QLatin1String("select * from%1 where id = 42").arg(qtest)));
QVERIFY(q.next());
QCOMPARE(q.value(0).toInt(), 42);
QVERIFY_SQL(q2, exec(QLatin1String("select * from%1 where id = 42").arg(qtest)));
if (q2.next())
qDebug("DBMS '%s' doesn't support query based transactions with concurrent access",
qPrintable(tst_Databases::dbToString(db)));
QVERIFY_SQL(q, exec("commit"));
QVERIFY_SQL(q2, exec(QLatin1String("select * from%1 where id = 42").arg(qtest)));
QVERIFY(q2.next());
QCOMPARE(q2.value(0).toInt(), 42);
}
void tst_QSqlQuery::joins()
{
QFETCH(QString, dbName);