check trunk as soon as the Pull Request gets merged

def test3(dbset, request_vars):
    ##you can retrieve the current query with
    ##dbset._select(), i.e. dbset is a "db(query)" object
    
    ##request_vars are the current request.vars
    ###so you can check for keywods etc etc etc
    ###checking for groupby, distinct, etc is up to you!
    
    ##given that is a callable you may cache it "externally"
    ## with a return dbset.count(cache=(cache.ram, 60))
    ## and do all your crazy things
    
    ## method that works on postgresql only for a full-table-count
    result = db.executesql("SELECT reltuples::integer FROM pg_class WHERE 
oid = 'public.awesome'::regclass;")
    return result[0][0]

def test2():
    #mode1
    cache_count = 127
    #mode2
    cache_count = (cache.ram, 60)
    #mode3
    cache_count = test3
    grid = SQLFORM.grid(db.awesome, cache_count=cache_count)
    return dict(grid=grid)


Can I leave documentation up to someone willing to test it and report back 
? :P


PS: <self_confidence mode="on">fixed 8 hours later.....web2py is 
awesome</self_confidence>

PS2: on a test table with 4M rows, two 'string' fields, postgresql 9.2 
takes 1.9sec to do a "standard" count(*). 
Things definitely improved (although it remains a heavy operation for MVCC 
databases) on the count(*) since previous versions.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to