summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql/models/qsqltablemodel
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-01-16 09:54:01 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-23 20:07:09 +0000
commit461ef575bcf778ba24b0be6b775098d4b80ae5e1 (patch)
tree068c1896a908482ed8d0aa88712c82bcfb0e15b0 /tests/auto/sql/models/qsqltablemodel
parent7c69f6171ddc76d22e4f6e433be69c5cf365db8f (diff)
Always escape the table names when creating the SQL statement
Since some databases are case sensitive if part of the query is quoted, then we should ensure that all instances of the table name are escaped unless the test is delibrately testing the non-escaped case. As a result, this commit also removes some expected failures pertaining to PostgreSQL and also adds an entry to the list of tables being dropped when a test is finished. [ChangeLog][Sql][PostgreSQL] QSqlDatabase is now stricter about table names when used with record() and primaryIndex(). If the tablename was not quoted when it was created, then the table name passed to record() and primaryIndex() needs to be in lower case so that PostgreSQL is able to find it. Fixes: QTBUG-65788 Change-Id: Id1f54cb66b761c39edf858501b730ede7eec1fd3 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/sql/models/qsqltablemodel')
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index da31f437d9..b617151a36 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -383,8 +383,6 @@ void tst_QSqlTableModel::selectRow()
q.exec("UPDATE " + tbl + " SET a = 'Qt' WHERE id = 1");
QCOMPARE(model.data(idx).toString(), QString("b"));
model.selectRow(1);
- if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
- QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
// Check if selectRow() refreshes a changed row.
@@ -441,8 +439,6 @@ void tst_QSqlTableModel::selectRowOverride()
// both rows should have changed
QCOMPARE(model.data(idx).toString(), QString("Qt"));
idx = model.index(2, 1);
- if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
- QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
q.exec("DELETE FROM " + tbl);
@@ -854,8 +850,6 @@ void tst_QSqlTableModel::insertRowFailure()
// populate 1 row
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
- if (dbType == QSqlDriver::PostgreSQL && submitpolicy != QSqlTableModel::OnManualSubmit)
- QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, insertRecord(0, values));
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
@@ -899,8 +893,6 @@ void tst_QSqlTableModel::insertRowFailure()
// restore empty table
model.revertAll();
QVERIFY_SQL(model, removeRow(0));
- if (dbType == QSqlDriver::PostgreSQL)
- QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
QCOMPARE(model.rowCount(), 0);
@@ -2009,8 +2001,6 @@ void tst_QSqlTableModel::tableModifyWithBlank()
//Should be equivalent to QSqlQuery INSERT INTO... command)
QVERIFY_SQL(model, insertRow(0));
QVERIFY_SQL(model, setData(model.index(0,0),timeString));
- if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
- QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
//set a filter on the table so the only record we get is the one we just made