summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-04-01 04:09:00 (GMT)
committerBill King <bill.king@nokia.com>2009-04-01 04:09:00 (GMT)
commit831d2742b7c41924f052acd81620e8bfc58afde7 (patch)
treef85e0b0749f934ba0955a85ec89eebfa37a345e9 /tests/auto
parentba8c15b71b006ddb5c74f0c97288d98541221328 (diff)
downloadQt-831d2742b7c41924f052acd81620e8bfc58afde7.zip
Qt-831d2742b7c41924f052acd81620e8bfc58afde7.tar.gz
Qt-831d2742b7c41924f052acd81620e8bfc58afde7.tar.bz2
DB Autotest cleanup
Make db autotest data set generation more consistent, slightly faster. Also, add ability to easily generate a set of a single databases entries worth of criteria to test.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp20
-rw-r--r--tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp12
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp158
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp95
-rw-r--r--tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp12
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp167
-rw-r--r--tests/auto/qsqlthread/tst_qsqlthread.cpp10
7 files changed, 182 insertions, 292 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index c06485d..2d91186 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -89,7 +89,7 @@ private slots:
void unicode();
void precision_data() { generic_data(); }
void precision();
- void insertORA_data();
+ void insertORA_data() { generic_data("QOCI"); }
void insertORA();
void batchInsert_data() { generic_data(); }
void batchInsert();
@@ -101,7 +101,7 @@ private slots:
void insertFieldNameContainsWS(); // For task 117996
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void createTestTables( QSqlDatabase db );
void dropTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -117,10 +117,14 @@ tst_Q3SqlCursor::~tst_Q3SqlCursor()
{
}
-void tst_Q3SqlCursor::generic_data()
+void tst_Q3SqlCursor::generic_data(const QString &engine)
{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
@@ -429,12 +433,6 @@ static QString dumpUtf8( const QString& str )
return res;
}
-void tst_Q3SqlCursor::insertORA_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_Q3SqlCursor::insertORA()
{
QFETCH( QString, dbName );
diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
index a8c5940..9ab74f0 100644
--- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
+++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
@@ -76,7 +76,7 @@ private slots:
void _exec();
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void createTestTables( QSqlDatabase db );
void dropTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -92,10 +92,14 @@ tst_Q3SqlSelectCursor::~tst_Q3SqlSelectCursor()
{
}
-void tst_Q3SqlSelectCursor::generic_data()
+void tst_Q3SqlSelectCursor::generic_data(const QString& engine)
{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db )
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index d8ad15a..e10a0ca 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -93,28 +93,28 @@ private slots:
void addDatabase();
//database specific tests
- void recordMySQL_data();
+ void recordMySQL_data() { generic_data("QMYSQL"); }
void recordMySQL();
- void recordPSQL_data();
+ void recordPSQL_data() { generic_data("QPSQL"); }
void recordPSQL();
- void recordOCI_data();
+ void recordOCI_data() { generic_data("QOCI"); }
void recordOCI();
- void recordTDS_data();
+ void recordTDS_data() { generic_data("QTDS"); }
void recordTDS();
- void recordDB2_data();
+ void recordDB2_data() { generic_data("QDB2"); }
void recordDB2();
- void recordSQLite_data();
+ void recordSQLite_data() { generic_data("QSQLITE"); }
void recordSQLite();
- void recordAccess_data();
+ void recordAccess_data() { generic_data("QODBC"); }
void recordAccess();
- void recordSQLServer_data();
+ void recordSQLServer_data() { generic_data("QODBC"); }
void recordSQLServer();
- void recordIBase_data();
+ void recordIBase_data() {generic_data("QIBASE"); }
void recordIBase();
- void eventNotificationIBase_data() { generic_data(); }
+ void eventNotificationIBase_data() { generic_data("QIBASE"); }
void eventNotificationIBase();
- void eventNotificationPSQL_data() { generic_data(); }
+ void eventNotificationPSQL_data() { generic_data("QPSQL"); }
void eventNotificationPSQL();
//database specific 64 bit integer test
@@ -141,61 +141,61 @@ private slots:
void precisionPolicy_data() { generic_data(); }
void precisionPolicy();
- void db2_valueCacheUpdate_data() { generic_data(); }
+ void db2_valueCacheUpdate_data() { generic_data("QDB2"); }
void db2_valueCacheUpdate();
- void psql_schemas_data();
+ void psql_schemas_data() { generic_data("QPSQL"); }
void psql_schemas();
- void psql_escapedIdentifiers_data(){ psql_schemas_data(); }
+ void psql_escapedIdentifiers_data() { generic_data("QPSQL"); }
void psql_escapedIdentifiers();
- void psql_escapeBytea_data() { psql_schemas_data(); }
+ void psql_escapeBytea_data() { generic_data("QPSQL"); }
void psql_escapeBytea();
- void bug_249059_data() { psql_schemas_data(); }
+ void bug_249059_data() { generic_data("QPSQL"); }
void bug_249059();
void mysqlOdbc_unsignedIntegers_data() { generic_data(); }
void mysqlOdbc_unsignedIntegers();
- void mysql_multiselect_data() { generic_data(); }
+ void mysql_multiselect_data() { generic_data("QMYSQL"); }
void mysql_multiselect(); // For task 144331
void accessOdbc_strings_data() { generic_data(); }
void accessOdbc_strings();
- void ibase_numericFields_data() { generic_data(); }
+ void ibase_numericFields_data() { generic_data("QIBASE"); }
void ibase_numericFields(); // For task 125053
- void ibase_fetchBlobs_data() { generic_data(); }
+ void ibase_fetchBlobs_data() { generic_data("QIBASE"); }
void ibase_fetchBlobs(); // For task 143471
- void ibase_useCustomCharset_data() { generic_data(); }
+ void ibase_useCustomCharset_data() { generic_data("QIBASE"); }
void ibase_useCustomCharset(); // For task 134608
- void ibase_procWithoutReturnValues_data() { generic_data(); } // For task 165423
+ void ibase_procWithoutReturnValues_data() { generic_data("QIBASE"); } // For task 165423
void ibase_procWithoutReturnValues();
- void ibase_procWithReturnValues_data() { generic_data(); } // For task 177530
+ void ibase_procWithReturnValues_data() { generic_data("QIBASE"); } // For task 177530
void ibase_procWithReturnValues();
- void odbc_reopenDatabase_data() { generic_data(); }
+ void odbc_reopenDatabase_data() { generic_data("QODBC"); }
void odbc_reopenDatabase();
- void odbc_uniqueidentifier_data() { generic_data(); }
+ void odbc_uniqueidentifier_data() { generic_data("QODBC"); }
void odbc_uniqueidentifier(); // For task 141822
- void odbc_uintfield_data() { generic_data(); }
+ void odbc_uintfield_data() { generic_data("QODBC"); }
void odbc_uintfield();
- void odbc_bindBoolean_data() { generic_data(); }
+ void odbc_bindBoolean_data() { generic_data("QODBC"); }
void odbc_bindBoolean();
- void oci_serverDetach_data() { generic_data(); }
+ void oci_serverDetach_data() { generic_data("QOCI"); }
void oci_serverDetach(); // For task 154518
- void oci_xmltypeSupport_data() { generic_data(); }
+ void oci_xmltypeSupport_data() { generic_data("QOCI"); }
void oci_xmltypeSupport();
- void oci_fieldLength_data() { generic_data(); }
+ void oci_fieldLength_data() { generic_data("QOCI"); }
void oci_fieldLength();
- void sqlite_bindAndFetchUInt_data() { generic_data(); }
+ void sqlite_bindAndFetchUInt_data() { generic_data("QSQLITE3"); }
void sqlite_bindAndFetchUInt();
private:
void createTestTables(QSqlDatabase db);
void dropTestTables(QSqlDatabase db);
void populateTestTables(QSqlDatabase db);
- void generic_data();
+ void generic_data(const QString &engine=QString());
#ifdef QT3_SUPPORT
void testRecordInfo(const FieldDef fieldDefs[], const Q3SqlRecordInfo& inf);
@@ -397,70 +397,14 @@ void tst_QSqlDatabase::cleanup()
{
}
-void tst_QSqlDatabase::recordOCI_data()
+void tst_QSqlDatabase::generic_data(const QString& engine)
{
- if (dbs.fillTestTable("QOCI") == 0)
- QSKIP("No Oracle database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordPSQL_data()
-{
- if (dbs.fillTestTable("QPSQL") == 0)
- QSKIP("No PostgreSQL database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordMySQL_data()
-{
- if (dbs.fillTestTable("QMYSQL") == 0)
- QSKIP("No MySQL database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordTDS_data()
-{
- if (dbs.fillTestTable("QTDS") == 0)
- QSKIP("No TDS database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordDB2_data()
-{
- if (dbs.fillTestTable("QDB2") == 0)
- QSKIP("No DB2 database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordSQLite_data()
-{
- if (dbs.fillTestTable("QSQLITE") == 0)
- QSKIP("No SQLite database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordAccess_data()
-{
- if (dbs.fillTestTable("QODBC") == 0)
- QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordSQLServer_data()
-{
- if (dbs.fillTestTable("QODBC") == 0)
- QSKIP("No ODBC database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::recordIBase_data()
-{
- if (dbs.fillTestTable("QIBASE") == 0)
- QSKIP("No Interbase database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::psql_schemas_data()
-{
- if (dbs.fillTestTable("QPSQL") == 0)
- QSKIP("No Postgres database drivers are available in this Qt configuration", SkipAll);
-}
-
-void tst_QSqlDatabase::generic_data()
-{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlDatabase::addDatabase()
@@ -888,7 +832,6 @@ void tst_QSqlDatabase::recordTDS()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QTDS");
static const FieldDef fieldDefs[] = {
FieldDef("tinyint", QVariant::Int, 255),
@@ -937,7 +880,6 @@ void tst_QSqlDatabase::recordOCI()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
// runtime check for Oracle version since V8 doesn't support TIMESTAMPs
if (tst_Databases::getOraVersion(db) >= 9) {
@@ -1013,7 +955,6 @@ void tst_QSqlDatabase::recordPSQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
FieldDef byteadef;
if (db.driver()->hasFeature(QSqlDriver::BLOB))
@@ -1098,7 +1039,6 @@ void tst_QSqlDatabase::recordMySQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QMYSQL");
FieldDef bin10, varbin10;
int major = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt();
@@ -1177,7 +1117,6 @@ void tst_QSqlDatabase::recordDB2()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QDB2");
static const FieldDef fieldDefs[] = {
FieldDef("char(20)", QVariant::String, QString("Blah1")),
@@ -1223,7 +1162,6 @@ void tst_QSqlDatabase::recordIBase()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
static const FieldDef fieldDefs[] = {
FieldDef("char(20)", QVariant::String, QString("Blah1"), false),
@@ -1254,7 +1192,6 @@ void tst_QSqlDatabase::recordSQLite()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
static const FieldDef fieldDefs[] = {
// The affinity of these fields are TEXT so SQLite should give us strings, not ints or doubles.
@@ -1801,7 +1738,6 @@ void tst_QSqlDatabase::ibase_numericFields()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QSqlQuery q(db);
QString tableName = qTableName("numericfields");
@@ -1875,7 +1811,6 @@ void tst_QSqlDatabase::ibase_fetchBlobs()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString tableName = qTableName("qtest_ibaseblobs");
QSqlQuery q(db);
@@ -1908,7 +1843,6 @@ void tst_QSqlDatabase::ibase_procWithoutReturnValues()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QSqlQuery q(db);
QString procName = qTableName("qtest_proc1");
@@ -1989,11 +1923,6 @@ void tst_QSqlDatabase::odbc_reopenDatabase()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- if (!tst_Databases::isSqlServer(db)) {
- QSKIP("SQL Server (ODBC) specific test", SkipSingle);
- return;
- }
-
QSqlQuery q(db);
QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest")));
QVERIFY_SQL(q, next());
@@ -2008,7 +1937,6 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QODBC");
QSqlQuery q(db);
QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)"));
@@ -2037,7 +1965,6 @@ void tst_QSqlDatabase::mysql_multiselect()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QMYSQL");
QSqlQuery q(db);
QVERIFY_SQL(q, exec("select version()"));
@@ -2059,7 +1986,6 @@ void tst_QSqlDatabase::ibase_useCustomCharset()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString nonlatin1string("��");
db.close();
@@ -2083,7 +2009,6 @@ void tst_QSqlDatabase::oci_serverDetach()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
for (int i = 0; i < 2; i++) {
db.close();
@@ -2104,7 +2029,6 @@ void tst_QSqlDatabase::oci_xmltypeSupport()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
QString tableName = qTableName("qtest_xmltype");
QString xml("<?xml version=\"1.0\"?><TABLE_NAME>MY_TABLE</TABLE_NAME>");
@@ -2133,7 +2057,6 @@ void tst_QSqlDatabase::oci_fieldLength()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QOCI");
QString tableName = qTableName("qtest");
QSqlQuery q(db);
@@ -2198,7 +2121,6 @@ void tst_QSqlDatabase::odbc_uintfield()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QODBC");
QString tableName = qTableName("uint_table");
unsigned int val = 4294967295U;
@@ -2260,7 +2182,6 @@ void tst_QSqlDatabase::eventNotificationIBase()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QIBASE");
QString procedureName = qTableName("posteventProc");
QSqlDriver *driver=db.driver();
@@ -2290,7 +2211,6 @@ void tst_QSqlDatabase::eventNotificationPSQL()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
QSqlQuery query(db);
QString procedureName = qTableName("posteventProc");
@@ -2311,7 +2231,6 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE3");
QSqlQuery q(db);
QString tableName = qTableName("uint_test");
@@ -2333,7 +2252,6 @@ void tst_QSqlDatabase::db2_valueCacheUpdate()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QDB2");
QString tableName = qTableName("qtest");
QSqlQuery q(db);
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 684d6ac..8d77589 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -93,7 +93,7 @@ private slots:
void transaction();
void record_data() { generic_data(); }
void record();
- void record_sqlite_data() { generic_data(); }
+ void record_sqlite_data() { generic_data("QSQLITE"); }
void record_sqlite();
void finish_data() { generic_data(); }
void finish();
@@ -107,13 +107,13 @@ private slots:
void forwardOnly();
// bug specific tests
- void bitField_data();
+ void bitField_data() {generic_data("QTDS"); }
void bitField();
- void nullBlob_data();
+ void nullBlob_data() { generic_data("QOCI"); }
void nullBlob();
void blob_data() { generic_data(); }
void blob();
- void rawField_data();
+ void rawField_data() { generic_data("QOCI"); }
void rawField();
void precision_data() { generic_data(); }
void precision();
@@ -129,19 +129,19 @@ private slots:
void char1SelectUnicode();
void synonyms_data() { generic_data(); }
void synonyms();
- void oraOutValues_data();
+ void oraOutValues_data() { generic_data("QOCI"); }
void oraOutValues();
- void mysqlOutValues_data();
+ void mysqlOutValues_data() { generic_data("QMYSQL"); }
void mysqlOutValues();
- void oraClob_data() { oraOutValues_data(); }
+ void oraClob_data() { generic_data("QOCI"); }
void oraClob();
- void oraLong_data() { oraOutValues_data(); }
+ void oraLong_data() { generic_data("QOCI"); }
void oraLong();
- void outValuesDB2_data();
+ void outValuesDB2_data() { generic_data("QDB2"); }
void outValuesDB2();
- void storedProceduresIBase_data();
+ void storedProceduresIBase_data() {generic_data("QIBASE"); }
void storedProceduresIBase();
- void oraRowId_data();
+ void oraRowId_data() { generic_data("QOCI"); }
void oraRowId();
void prepare_bind_exec_data() { generic_data(); }
void prepare_bind_exec();
@@ -175,13 +175,13 @@ private slots:
void emptyTableNavigate();
#ifdef NOT_READY_YET
- void bug217003_data() { generic_data(); }
- void bug217003();
+ void task_217003_data() { generic_data(); }
+ void task_217003();
#endif
private:
// returns all database connections
- void generic_data();
+ void generic_data(const QString &engine=QString());
void dropTestTables( QSqlDatabase db );
void createTestTables( QSqlDatabase db );
void populateTestTables( QSqlDatabase db );
@@ -247,28 +247,14 @@ void tst_QSqlQuery::cleanup()
}
}
-void tst_QSqlQuery::bitField_data()
+void tst_QSqlQuery::generic_data(const QString& engine)
{
- if ( dbs.fillTestTable( "QTDS" ) == 0 )
- QSKIP( "No TDS database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::nullBlob_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::rawField_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
-void tst_QSqlQuery::generic_data()
-{
- if ( dbs.fillTestTable() == 0 )
- QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
@@ -421,12 +407,6 @@ void tst_QSqlQuery::char1SelectUnicode()
QSKIP( "Database not unicode capable", SkipSingle );
}
-void tst_QSqlQuery::oraRowId_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::oraRowId()
{
QFETCH( QString, dbName );
@@ -461,12 +441,6 @@ void tst_QSqlQuery::oraRowId()
QCOMPARE( q.value( 0 ).toString(), QString( "b" ) );
}
-void tst_QSqlQuery::mysqlOutValues_data()
-{
- if ( dbs.fillTestTable( "QMYSQL" ) == 0 )
- QSKIP( "No MySQL database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::mysqlOutValues()
{
QFETCH( QString, dbName );
@@ -517,12 +491,6 @@ void tst_QSqlQuery::mysqlOutValues()
QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) );
}
-void tst_QSqlQuery::oraOutValues_data()
-{
- if ( dbs.fillTestTable( "QOCI" ) == 0 )
- QSKIP( "No Oracle database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::oraOutValues()
{
QFETCH( QString, dbName );
@@ -670,18 +638,11 @@ void tst_QSqlQuery::oraClob()
QVERIFY( q.value( 1 ).toByteArray() == loong.toLatin1() );
}
-void tst_QSqlQuery::storedProceduresIBase_data()
-{
- if ( dbs.fillTestTable( "QIBASE" ) == 0 )
- QSKIP( "No Interbase database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::storedProceduresIBase()
{
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QIBASE" );
QSqlQuery q( db );
q.exec( "drop procedure " + qTableName( "TESTPROC" ) );
@@ -713,12 +674,6 @@ void tst_QSqlQuery::storedProceduresIBase()
q.exec( "drop procedure " + qTableName( "TestProc" ) );
}
-void tst_QSqlQuery::outValuesDB2_data()
-{
- if ( dbs.fillTestTable( "QDB2" ) == 0 )
- QSKIP( "No DB2 database drivers are available in this Qt configuration", SkipAll );
-}
-
void tst_QSqlQuery::outValuesDB2()
{
QFETCH( QString, dbName );
@@ -1355,7 +1310,6 @@ void tst_QSqlQuery::nullBlob()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_nullblob" ) + " (id int primary key, bb blob)" ) );
@@ -1385,7 +1339,6 @@ void tst_QSqlQuery::rawField()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
q.setForwardOnly( true );
@@ -2103,7 +2056,6 @@ void tst_QSqlQuery::record_sqlite()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QSQLITE" );
QSqlQuery q( db );
@@ -2131,7 +2083,6 @@ void tst_QSqlQuery::oraLong()
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- DBMS_SPECIFIC( db, "QOCI" );
QSqlQuery q( db );
@@ -2158,7 +2109,7 @@ void tst_QSqlQuery::execErrorRecovery()
QSqlQuery q( db );
- QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int primary key)" ) );
+ QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int not null primary key)" ) );
QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_exerr" ) + " values (?)" ) );
q.addBindValue( 1 );
@@ -2698,7 +2649,7 @@ void tst_QSqlQuery::emptyTableNavigate()
}
#ifdef NOT_READY_YET
-void tst_QSqlQuery::bug217003()
+void tst_QSqlQuery::task_217003()
{
QFETCH( QString, dbName );
QSqlDatabase db = QSqlDatabase::database( dbName );
diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
index 63202f8..88b5770 100644
--- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -95,7 +95,7 @@ private slots:
void setQueryWithNoRowsInResultSet();
private:
- void generic_data();
+ void generic_data(const QString &engine=QString());
void dropTestTables(QSqlDatabase db);
void createTestTables(QSqlDatabase db);
void populateTestTables(QSqlDatabase db);
@@ -202,10 +202,14 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db)
tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp") << qTableName("test3tmp"));
}
-void tst_QSqlQueryModel::generic_data()
+void tst_QSqlQueryModel::generic_data(const QString& engine)
{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlQueryModel::init()
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index 6015d1c..d4affe4 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -66,38 +66,59 @@ public:
tst_Databases dbs;
public slots:
- void initTestCase_data();
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
+ void select_data() { generic_data(); }
void select();
+ void submitAll_data() { generic_data(); }
void submitAll();
- void setRecord_data();
+ void setRecord_data() { generic_data(); }
void setRecord();
+ void insertRow_data() { generic_data(); }
void insertRow();
+ void insertRecord_data() { generic_data(); }
void insertRecord();
+ void insertMultiRecords_data() { generic_data(); }
void insertMultiRecords();
+ void removeRow_data() { generic_data(); }
void removeRow();
+ void removeRows_data() { generic_data(); }
void removeRows();
+ void removeInsertedRow_data() { generic_data(); }
void removeInsertedRow();
+ void setFilter_data() { generic_data(); }
void setFilter();
+ void setInvalidFilter_data() { generic_data(); }
void setInvalidFilter();
+ void emptyTable_data() { generic_data(); }
void emptyTable();
+ void tablesAndSchemas_data() { generic_data("QPSQL"); }
void tablesAndSchemas();
+ void whitespaceInIdentifiers_data() { generic_data(); }
void whitespaceInIdentifiers();
+ void primaryKeyOrder_data() { generic_data("QSQLITE"); }
void primaryKeyOrder();
+ void sqlite_bigTable_data() { generic_data("QSQLITE"); }
void sqlite_bigTable();
// bug specific tests
+ void insertRecordBeforeSelect_data() { generic_data(); }
void insertRecordBeforeSelect();
+ void submitAllOnInvalidTable_data() { generic_data(); }
void submitAllOnInvalidTable();
+ void insertRecordsInLoop_data() { generic_data(); }
void insertRecordsInLoop();
+ void sqlite_attachedDatabase_data() { generic_data("QSQLITE"); }
void sqlite_attachedDatabase(); // For task 130799
+
+private:
+ void generic_data(const QString& engine=QString());
};
tst_QSqlTableModel::tst_QSqlTableModel()
@@ -121,7 +142,8 @@ void tst_QSqlTableModel::dropTestTables()
<< qTableName("test2")
<< qTableName("test3")
<< qTableName("emptytable")
- << qTableName("bigtable");
+ << qTableName("bigtable")
+ << qTableName("foo");
if (testWhiteSpaceNames(db.driverName()))
tableNames << qTableName("qtestw hitespace");
@@ -160,16 +182,16 @@ void tst_QSqlTableModel::repopulateTestTables()
QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i));
QSqlQuery q(db);
- QVERIFY_SQL( q, exec("delete from " + qTableName("test")));
+ q.exec("delete from " + qTableName("test"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(3, 'vohi', 3)"));
- QVERIFY_SQL( q, exec("delete from " + qTableName("test2")));
+ q.exec("delete from " + qTableName("test2"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(1, 'herr')"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(2, 'mister')"));
- QVERIFY_SQL( q, exec("delete from " + qTableName("test3")));
+ q.exec("delete from " + qTableName("test3"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(1, 'foo', 'bar')"));
QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(2, 'baz', 'joe')"));
}
@@ -182,11 +204,13 @@ void tst_QSqlTableModel::recreateTestTables()
repopulateTestTables();
}
-void tst_QSqlTableModel::initTestCase_data()
+void tst_QSqlTableModel::generic_data(const QString &engine)
{
- if (dbs.fillTestTable() == 0) {
- qWarning("NO DATABASES");
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
}
}
@@ -212,7 +236,7 @@ void tst_QSqlTableModel::cleanup()
void tst_QSqlTableModel::select()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -245,58 +269,51 @@ void tst_QSqlTableModel::select()
QCOMPARE(model.data(model.index(3, 3)), QVariant());
}
-void tst_QSqlTableModel::setRecord_data()
-{
- QTest::addColumn<uint>("submitpolicy");
- QTest::newRow("OnFieldChange") << (uint)QSqlTableModel::OnFieldChange;
- QTest::newRow("OnRowChange") << (uint)QSqlTableModel::OnRowChange;
- QTest::newRow("OnManualSubmit") << (uint)QSqlTableModel::OnManualSubmit;
-}
-
void tst_QSqlTableModel::setRecord()
{
- // This needs to be tested with ODBC, which requires a manual change to qsqldatabase\tst_databases.h
- // to ensure an ODBC db is added
-
- QFETCH_GLOBAL(QString, dbName);
- QFETCH(uint, submitpolicy);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- QSqlTableModel model(0, db);
- model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy);
- model.setTable(qTableName("test3"));
- model.setSort(0, Qt::AscendingOrder);
- QVERIFY_SQL(model, select());
+ QList<QSqlTableModel::EditStrategy> policies = QList<QSqlTableModel::EditStrategy>() << QSqlTableModel::OnFieldChange << QSqlTableModel::OnRowChange << QSqlTableModel::OnManualSubmit;
+
+ foreach( QSqlTableModel::EditStrategy submitpolicy, policies) {
+
+ QSqlTableModel model(0, db);
+ model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy);
+ model.setTable(qTableName("test3"));
+ model.setSort(0, Qt::AscendingOrder);
+ QVERIFY_SQL(model, select());
- for (int i = 0; i < model.rowCount(); ++i) {
- QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
-
- QSqlRecord rec = model.record(i);
- rec.setValue(1, rec.value(1).toString() + 'X');
- rec.setValue(2, rec.value(2).toString() + 'X');
- QVERIFY(model.setRecord(i, rec));
-
- if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit)
- QVERIFY(model.submitAll());
- else {
- // dataChanged() is not emitted when submitAll() is called
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(0).count(), 2);
- QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
- QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+
+ QSqlRecord rec = model.record(i);
+ rec.setValue(1, rec.value(1).toString() + 'X');
+ rec.setValue(2, rec.value(2).toString() + 'X');
+ QVERIFY(model.setRecord(i, rec));
+
+ if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit)
+ QVERIFY(model.submitAll());
+ else {
+ // dataChanged() is not emitted when submitAll() is called
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(0).count(), 2);
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 1));
+ QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, 1));
+ }
}
- }
- QCOMPARE(model.data(model.index(0, 1)).toString(), QString("fooX"));
- QCOMPARE(model.data(model.index(0, 2)).toString(), QString("barX"));
- QCOMPARE(model.data(model.index(1, 1)).toString(), QString("bazX"));
- QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joeX"));
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("fooX"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("barX"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("bazX"));
+ QCOMPARE(model.data(model.index(1, 2)).toString(), QString("joeX"));
+ }
}
void tst_QSqlTableModel::insertRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -321,7 +338,7 @@ void tst_QSqlTableModel::insertRow()
void tst_QSqlTableModel::insertRecord()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -354,7 +371,7 @@ void tst_QSqlTableModel::insertRecord()
void tst_QSqlTableModel::insertMultiRecords()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -403,7 +420,7 @@ void tst_QSqlTableModel::insertMultiRecords()
void tst_QSqlTableModel::submitAll()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -438,7 +455,7 @@ void tst_QSqlTableModel::submitAll()
void tst_QSqlTableModel::removeRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -484,7 +501,7 @@ void tst_QSqlTableModel::removeRow()
void tst_QSqlTableModel::removeRows()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -533,7 +550,7 @@ void tst_QSqlTableModel::removeRows()
void tst_QSqlTableModel::removeInsertedRow()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -565,7 +582,7 @@ void tst_QSqlTableModel::removeInsertedRow()
void tst_QSqlTableModel::emptyTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -584,12 +601,10 @@ void tst_QSqlTableModel::emptyTable()
void tst_QSqlTableModel::tablesAndSchemas()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QPSQL");
-
QSqlQuery q(db);
q.exec("DROP SCHEMA " + qTableName("testschema") + " CASCADE");
QVERIFY_SQL( q, exec("create schema " + qTableName("testschema")));
@@ -607,7 +622,7 @@ void tst_QSqlTableModel::tablesAndSchemas()
void tst_QSqlTableModel::whitespaceInIdentifiers()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -623,16 +638,16 @@ void tst_QSqlTableModel::whitespaceInIdentifiers()
void tst_QSqlTableModel::primaryKeyOrder()
{
- QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "primaryKeyOrderTest");
- db.setDatabaseName(":memory:");
- QVERIFY_SQL(db, open());
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
QSqlQuery q(db);
- QVERIFY_SQL( q, exec("create table foo(a varchar(20), id int primary key, b varchar(20))"));
+ QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))"));
QSqlTableModel model(0, db);
- model.setTable("foo");
+ model.setTable(qTableName("foo"));
QSqlIndex pk = model.primaryKey();
QCOMPARE(pk.count(), 1);
@@ -652,7 +667,7 @@ void tst_QSqlTableModel::primaryKeyOrder()
void tst_QSqlTableModel::setInvalidFilter()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -671,7 +686,7 @@ void tst_QSqlTableModel::setInvalidFilter()
void tst_QSqlTableModel::setFilter()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -724,12 +739,10 @@ void tst_QSqlTableModel::setFilter()
void tst_QSqlTableModel::sqlite_bigTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
-
bool hasTransactions = db.driver()->hasFeature(QSqlDriver::Transactions);
if (hasTransactions) QVERIFY(db.transaction());
QSqlQuery q(db);
@@ -763,7 +776,7 @@ void tst_QSqlTableModel::sqlite_bigTable()
// had first been called.
void tst_QSqlTableModel::insertRecordBeforeSelect()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -796,7 +809,7 @@ void tst_QSqlTableModel::insertRecordBeforeSelect()
// are inserted and submitted on a non-existing table.
void tst_QSqlTableModel::submitAllOnInvalidTable()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -828,7 +841,7 @@ void tst_QSqlTableModel::submitAllOnInvalidTable()
// For task 147575: the rowsRemoved signal emitted from the model was lying
void tst_QSqlTableModel::insertRecordsInLoop()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
@@ -866,12 +879,10 @@ void tst_QSqlTableModel::insertRecordsInLoop()
void tst_QSqlTableModel::sqlite_attachedDatabase()
{
- QFETCH_GLOBAL(QString, dbName);
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- DBMS_SPECIFIC(db, "QSQLITE");
-
QSqlDatabase attachedDb = QSqlDatabase::cloneDatabase(db, db.driverName() + QLatin1String("attached"));
attachedDb.setDatabaseName(db.databaseName()+QLatin1String("attached.dat"));
QVERIFY_SQL(attachedDb, open());
diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/qsqlthread/tst_qsqlthread.cpp
index 94e0f98..d871be4 100644
--- a/tests/auto/qsqlthread/tst_qsqlthread.cpp
+++ b/tests/auto/qsqlthread/tst_qsqlthread.cpp
@@ -286,10 +286,14 @@ tst_QSqlThread::~tst_QSqlThread()
{
}
-void tst_QSqlThread::generic_data()
+void tst_QSqlThread::generic_data(const QString& engine)
{
- if (dbs.fillTestTable() == 0)
- QSKIP("No database drivers are available in this Qt configuration", SkipAll);
+ if ( dbs.fillTestTable(engine) == 0 ) {
+ if(engine.isEmpty())
+ QSKIP( "No database drivers are available in this Qt configuration", SkipAll );
+ else
+ QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll );
+ }
}
void tst_QSqlThread::dropTestTables()