Details
-
Bug
-
Resolution: Done
-
P4: Low
-
6.0.2, 6.0.3
-
None
-
Win 10, Ubuntu 20.04
Python 3.8.5, Python 3.9.2
-
-
21b3b54193b9d90ee377fdfa306e21d2fdfe2837 (qt/qtbase/dev) a76017b56513ee125cd60cb981c974faffc3df7f (qt/qtbase/6.1) 79edc48c0dcd03a33abeb36c4b5b512a61339113 (qt/tqtc-qtbase/5.15)
Description
On SQLite DB
... model = QSqlTableModel() model.setTable('temp') ... table_view= QTableView(self.centralwidget) table_view.setModel(model) ...
Both
model.setSort(1, Qt.DescendingOrder) model.select() print(model.selectStatement()) ... table_view.sortByColumn(1, Qt.AscendingOrder) print(model.selectStatement())
return
SELECT "id", "full_name" FROM "temp" ORDER BY temp."full_name" ASC
Table name not quoted {ORDER BY temp."full_name" ASC} and that why
model.select()
return False
UPD:
on Ubuntu 20.04 table name not quoted too.
But with nonspace tablename select() return True (and fields).
With spaced names (like "full name") still not work.
print(model.selectStatement()) >>>SELECT "id", "full_name" FROM "spaced table name" ORDER BY spaced table name."full_name" ASC
Attachments
Issue Links
- relates to
-
QTBUG-91885 QSqlTableModel support column names with dots
- Closed
For Gerrit Dashboard: QTBUG-92584 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
342687,7 | QSqlTableModel::orderByClause(): Quote the table name | dev | qt/qtbase | Status: MERGED | +2 | 0 |
347035,2 | QSqlTableModel::orderByClause(): Quote the table name | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 |
347036,4 | QSqlTableModel::orderByClause(): Quote the table name | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |