diff options
author | Bill King <bill.king@nokia.com> | 2009-11-30 23:14:03 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-11-30 23:37:25 (GMT) |
commit | e127806a53e445df165ef1021e9c3d9029fbcac2 (patch) | |
tree | da8f2d8bdb65dae0346b70858ac99c33213973a0 /tests/auto | |
parent | 61f2b450560887651b3350e63bdd75609e3b6752 (diff) | |
download | Qt-e127806a53e445df165ef1021e9c3d9029fbcac2.zip Qt-e127806a53e445df165ef1021e9c3d9029fbcac2.tar.gz Qt-e127806a53e445df165ef1021e9c3d9029fbcac2.tar.bz2 |
Fixed QSqlRelationalTableModel doesn't correctly work with relation in other database schema
PSQL doesn't like having schema scoping in "AS" aliasing of fields,
so use everything after the last "." separator for generating the alias.
Task-number: QTBUG-5373
Reviewed-by: Justin McPherson
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 8c840cd..4ae5000 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -1212,10 +1212,11 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() QSqlQuery q(db); QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373"))); QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2"))); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("user")+"(userid int primary key, relatingid int)")); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user2")+"(userid2 int primary key, username2 char(40))")); - model.setTable(qTableName("QTBUG_5373")+"."+qTableName("user")); - model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user2"), "userid2", "username2")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("document")+"(document_id int primary key, relatingid int, userid int)")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user")+"(userid int primary key, username char(40))")); + model.setTable(qTableName("QTBUG_5373")+"."+qTableName("document")); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); + model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); QVERIFY_SQL(model, select()); } |