Here is more on the new DAL features: http://www.web2pyslices.com/main/slices/take_slice/16
On Oct 28, 10:29 am, Alex Fanjul <alex.fan...@gmail.com> wrote: > We will have to document this 'database stuffs' very well because I'm > lost with so many new features. The best documentation for me is finally > an example like this (maybe in more real context). > Thanks for new features Massimo, > Alex F > > El 28/10/2009 16:08, mdipierro escribió: > > > > > ### given: > > db=DAL('sqlite://storage') > > db.define_table('a',Field('b')) > > db.a.insert(b='aaa') > > db.a.insert(b='aab') > > db.a.insert(b='abb') > > db.a.insert(b='bbb') > > row=db(db.a.id>0).select().first() > > > ### you can do, as before > > print row.b > > row.update_record(b='yyy') > > > ### or as you used to do in Django (NEW to web2py) > > row.b='xxx' > > row.save > > () > > print row,b > > > ### you can now also filter and sort at the web2py level searsh > > results (thanks Mr. Freeze) (NEW) > > rows=db(db.a.id>0).select().filter(lambda row: row.b>0).sort(lambda > > row: row.b.upper()) > > for row in rows: print row.b > > -- > Alejandro Fanjul Fdez. > alex.fan...@gmail.comwww.mhproject.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---