[Qt-interest] QSql(Query|Table)Model without caching possible?
Davor J.
DavorJ at live.com
Thu Feb 25 11:43:12 CET 2010
Take this simple example:
-----------------------------------------------------------
QSqlTableModel m(0 /*, dbConnction*/);
m.setTable("test01");
QTableView v;
v.setModel(&m);
m.select();
v.show();
-----------------------------------------------------------
Problem here is that the model always caches the whole table. So, if you
have for example 100k rows, and a slow connection, you might wait a few
seconds, or a minute. To me, this seems to impede the model/view feature
which is the speed of visualization of the data. (i.e. the "view" only asks
the data that it needs, the model is the interface to it.)
My question is, is it possible to bypass the QSqlTableModel's (or
QSqlQueryModel's) cache? Currently I am thinking about playing with
fetchMore() and cursors, but if Qt already supports something similar, then
I don't have to. Btw, my db (Postgres) supports the QSqlDriver::QuerySize
feature which is mentioned on numerous occasions throughout the
documentation, and which also seems to be the prerequisite of "non-cached"
sql-models (...if I understand correctly.)
Regards,
Davor
More information about the Qt-interest-old
mailing list