i think this is a great idea. i'm currently trying to implement a search that would ordinarily use LIKE and have had two problems: 1) i can't use LIKE, so your new suggestion would be wonderful. i was planning to write it on my own, so having syntax for it would be wonderful. 2) i would like my search to be able to look through different fields, like a single search box that looks in first name and last name. being able to pull those two (or more) queries and then sort them as a single result set would be great.
matt On Oct 26, 12:56 pm, mdipierro <[email protected]> wrote: > On Oct 26, 10:54 am, Thadeus Burgess <[email protected]> wrote: > > > If you perform > > > rows1 = db(db.a.b<10).select() | db(db.a.b>5).select() > > > This is all on the python level? > > Yes > > > Strictly to allow for joins on gae? > > It is not a join. It just merges two sets of records. The main purpose > is to bypass the GAE limitation but it can have uses on relational > databases too. > > > > > -Thadeus > > > On Mon, Oct 26, 2009 at 10:34 AM, mdipierro <[email protected]> wrote: > > > > 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 -~----------~----~----~----~------~----~------~--~---

