[Qt-interest] Using true database cursors with Qt
John Moran
johnfrederickmoran at gmail.com
Thu Nov 26 15:14:06 CET 2009
Hello,
Once again, the issue is *impedance mismatch*; I do not want to
transfer the entire result set from the database to the application in
one go, because it's too large. I want to fetch it in smaller
increments (a subset *at a time*), updating the GUI between
increments. The thing that blocks isn't the updating of the UI after
we have the big result set object, the QSqlQuery. It's the transfer of
the result set in one foul swoop - it tends to be a lengthy network
round trip, with inefficient reading of binary data ( I know this
happens in the real world with my application because I've seen it
first hand). Therefore, doing anything with threads won't help - the
thread where I collect results will block in exactly the same way,
waiting for that massive result set to transfer, gaining me nothing. I
want to update the UI in increments, so that the first few items are
near instantly visible, and additional items gradually appear until
the QTreeView is completely populated after a few seconds. This is a
much better alternative to just blocking for a few seconds, which
gives the impression that my app is broken.
This is a problem that is solved by the use of database cursors:
http://en.wikipedia.org/wiki/Cursor_(databases) . This isn't some
esoteric proprietary feature of some RDBMS - it's in the SQL standard,
and has been for some time. This is a common, well understood problem.
Regards,
John Moran
More information about the Qt-interest-old
mailing list