uploading.... :-)
On Sunday, 17 June 2012 10:40:51 UTC-5, howesc wrote: > > sorry if i confused you by submitting 2 non-inclusive patches. :( the > reference patch for > https://groups.google.com/forum/?fromgroups#!topic/web2py/mKgLFC5pxcY is > what you applied, and with your change still works for me. > > if the cursor patch in this thread looks ok can you add it as well? this > is the same patch file with updated line numbers for tip of tunk. > > thanks! > > christian > > On Saturday, June 16, 2012 3:04:00 PM UTC-7, Massimo Di Pierro wrote: >> >> In trunk with a minor change. Please make sure I did not break your patch. >> >> massimo >> >> On Saturday, 16 June 2012 13:59:34 UTC-5, howesc wrote: >>> >>> Hello again, >>> >>> I wanna use cursors on my GAE queries: >>> https://developers.google.com/appengine/docs/python/datastore/queries#Query_Cursors >>> >>> i have attached a patch that adds an optional parameter "reusecursor" to >>> select on GAE. If True, and the query has a limitby, it indicates that >>> db['_lastcursor'] will have the cursor (i didn't want to store it if you >>> are not gonna use it because i'm not sure of the cost of getting that >>> cursor). If a reusecursor is a string that string will be passed to the >>> GAE query as the cursor. Note that you must use limitby on all queries >>> that you want to return the cursor for, and that queries that use a cursor >>> must have the exact same filters. Keep in mind that limitby will be in >>> relation to the cursor, so in most cases you want offset of 0. >>> >>> my suggested patch is attached. i welcome comments. >>> >>> example: >>> >>> def test3(): >>> cursor = request.vars.cursor or True >>> >>> #say the manu_item has about a hundred rows.... >>> rows = db(db.menu_item.id>0).select(reusecursor=cursor, >>> limitby=(0,10)) >>> cursor = db['_lastcursor'] >>> next_link = A('next', _href=URL(r=request, vars={'cursor':cursor})) >>> >>> >>> # Use generic HTML views >>> response.generic_patterns = ['html'] >>> return dict( >>> rows=rows, >>> cursor=cursor, >>> next_link = next_link) >>> >>> thanks, >>> >>> christian >>> >>