[Qt-interest] Using true database cursors with Qt
Linos
info at linos.es
Thu Nov 26 20:32:05 CET 2009
When i have this problem i use a thread where i begin populating and emiting in
signals the information i need with a configurable rows per batch number that i
use with "limit offset" of postgresql
http://www.postgresql.org/docs/8.3/interactive/queries-limit.html and the result
it is pretty good and responsive.
Regards,
Miguel Angel.
John Moran escribió:
> 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list