At some point GAE added support for the IN operator. I do not know
when but when I found out I added it (belongs maps to IN). Notice that
this is not the same as LIKE.

Massimo

On Dec 12, 6:19 pm, Richard <[email protected]> wrote:
> how did you add belongs support for GAE? I remember in a previous
> discussion this was considered not 
> possible/practical:http://code.google.com/p/web2py/issues/detail?id=56&can=1
>
> On Dec 12, 4:42 pm, mdipierro <[email protected]> wrote:
>
> > I have re-factored a lot of code in gluon/contrib/gql.py in order to
> > make it leaner, more readable and add new syntax. Now you can do mix
> > and match queries like:
>
> > q1=(db.table.id==1)
> > q2=(db.table.id>0)
> > q3=(db.table.field.belongs(('value1','value2','value3')))
>
> > in expressions like
>
> > db(q1)(q2)q3).select()
> > db(q1&q&q3).select()
> > db(...).update(...)
> > db(...).delete()
>
> > Before this patch, belongs was not supported by web2py on GAE, q1 and
> > q2 could not be mixed with other conditions.
>
> > Now you can do for example:
>
> >     d=datetime.date.today()
> >     db.define_table('person',Field('name'),Field('birthday','date'))
> >     db.person.insert(name='John',birthday=d)
> >     rows=db(db.person.id>0)(db.person.name.belongs(('John',))).count()
> >     rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
> >                   (birthday==d).update(name='Jim')
>
> > Moreover the db['_lastsql'] now contains a complete representation of
> > the last query on GAE and it can be used for debugging, and both db, db
> > (...) and can serialized as a string.
>
> > Please check it and report any problem.
>
> > Also please let me know if you find places in the online documentation
> > that have just become obsolete.
>
> > 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.


Reply via email to