On 5/24/17, Thomas Flemming <t...@qvgps.com> wrote: > Hi Ron, > > > there is no system in existence that will do > I was working a lot with Valentina-DB and they have a cursor class: > > var cursor=database.SqlSelect( "SELECT... WHERE... ORDER..."); > > then you can just get any the ListView wants, forward and backwards, very > fast: >
What is happening behind the scenes is that the entire query is run and the results are stored in memory. Then the cursor can easily go forward or backwards in this memory buffer. That approach works great as long as your result set isn't too large. But if you do a huge query, you can blow out memory. SQLite only loads a single row of the result into memory at a time. This saves on memory usage, but has the disadvantage that you can't go backwards. You can write a wrapper class around the core SQLite APIs that works like that other DB and pulls the entire result set into memory, then lets you scroll forwards and backwards. Another work-around is to load the query results into a TEMP table like this: CREATE TEMP TABLE res AS SELECT ....; Then if you want to view (say) the 100th through the 110th rows of the result, run: SELECT * FROM res WHERE rowid BETWEN 100 AND 110; Remember to "DROP TABLE res" when you are done. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users