On Sat, Mar 15, 2008 at 01:36:49AM -0400, dcharno scratched on the wall: > Jay A. Kreibich wrote: > > You quoted the backward example, but I'm going to use the forward version. > > > > In addition to the "last seen title", remember the RowID for every row > > with the same "last seen title". > > > > For the forward query use "AND title>=:firsttitle" and pitch rows > > that match any of the remembered RowIDs. (Backwards use "<=".) > > > > You'll also need to increase your LIMIT by the number of RowIDs you > > remembered. If you don't end up pitching rows and get a full set of > > data before the LIMIT is hit, you can just call _finalize on the > > statement. > > Thanks. > > It seems remembering the rowids would be a bit cumbersome and > potentially error prone esp when you change from scroll down to scroll > up. I think you might get the same result by remembering the last seen > title and its rowid.
The big thing to remember is that the rowids aren't going to be ordered in any way. Their main useful property, in this context, is that they're unique and allow you to re-identify a specific record. > In the next query, dump any rows where (title = > last_seen_title) and (rowid != last_seen_rowid). Up until you hit the last seen rowid, yes. That was my first idea as well. The problem with this is that if that row happens to be deleted between queries, you'll throw out all the titles with the last seen title, both new and old. That may or may not be an issue with your application, but I generally like to design things to be as robust as the database itself, and assume any possible combination of operations upon the data. Of course, that solution is easier and uses a known, set amount of memory. My own solution has issues if the list of like-titles goes across more than one scrolling "window." -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "'People who live in bamboo houses should not throw pandas.' Jesus said that." - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006" _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users