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