summaryrefslogtreecommitdiffstats
path: root/src/sql/models
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-11-30 23:14:03 (GMT)
committerBill King <bill.king@nokia.com>2009-11-30 23:37:25 (GMT)
commite127806a53e445df165ef1021e9c3d9029fbcac2 (patch)
treeda8f2d8bdb65dae0346b70858ac99c33213973a0 /src/sql/models
parent61f2b450560887651b3350e63bdd75609e3b6752 (diff)
downloadQt-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 'src/sql/models')
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 5f0a35d..aec54d6 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -563,7 +563,7 @@ QString QSqlRelationalTableModel::selectStatement() const
// If there are duplicate field names they must be aliased
if (fieldNames.value(fieldList[i]) > 1) {
- QString relTableName = relation.tableName();
+ QString relTableName = relation.tableName().section(QChar::fromLatin1('.'), -1, -1);
if (d->db.driver()->isIdentifierEscaped(relTableName, QSqlDriver::TableName))
relTableName = d->db.driver()->stripDelimiters(relTableName, QSqlDriver::TableName);
QString displayColumn = relation.displayColumn();