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.
[email protected]
www.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 [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
-~----------~----~----~----~------~----~------~--~---