As you know assuming:
db.define_table('a',Field('b','integer'))
the following expressions do not work on gae:
rows1 = db((db.a.b<10)|(db.a.b>5)).select()
rows2 = db(db.a.b.belongs(2,3,4)).select()
So with the latest code in trunk you can now do:
rows1 = db(db.a.b<10).select() | db(db.a.b>5).select()
rows2 = db(db.a.b==2).select() & db(db.a.b==3).select() & db
(db.a.b==4).select()
(the | will prevent duplicate records, the & will not and therefore is
faster)
of course this also works with relational databases although it is
less efficient than the original expressions.
I am also considering something like (not yet in trunk)
rows2 = (db(db.a.b==2).select() & db(db.a.b==3).select()).filter
(query=..., orderby=...)
To allow web2py level searching and re-sorting results from the
database. It should be easy to implement as a method of class Rows in
sql.py.
Comments? Any help with this will be appreciated.
Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---