The point of the DAL i generate SQL so that queries are executed by the database. Are you saying that those operations should be executed by web2py instead on the returned items? Why?
On Sep 11, 7:06 pm, "mr.freeze" <[email protected]> wrote: > >>2) you can now do: > >>row = db(db.mytable.id>0).select().first() > >>row = db(db.mytable.id>0).select().last() > >>and row is None if no records are selected. > > Here is a list of other functions that may be of interest (I borrowed > these from .net extension methods). Some of these won't make sense > for web2py but others may be handy if implemented. Some may already > be implemented: > > all - returns True if all elements in a sequence match a condition > any - return True if the sequence contains any elements > average - returns the average of a sequence of elements > contains - returns True is the sequence contains a given element > distinct - returns unique elements for a sequence > intersect - produces the set of common elements between two sequences > min - returns the lowest element in a sequence > max - returns the highest element in a sequence > single - returns the only element of a sequence and throws an error if > there is not exactly one element. > skip - bypass a specified contiguous number of elements in a sequence > skip_while - bypass elements of a sequence that match a condition and > return the remaining elements > take - returns a contiguous number of elements in a sequence > take_while - returns a contiguous number of elements that match a > sequence > where - returns elements in a sequence that match a condition > except - produces the difference between two sequences > union - produces the union of two sequences > reverse - reverses the order of elements in a sequence > > On Sep 11, 12:12 am, mdipierro <[email protected]> wrote: > > > I have made some changes to the code in trunk: > > > 1) Since tonight I attended a presentation about how SQLAlchemy can do > > on delete cascade in SQLite even if SQLite does not support it, I > > implemented this feature in web2py too. There is nothing you have to > > do it now there by default. For example: > > > db=DAL('sqlite://test.db') > > db.define_table('a',Field('name')) > > db.define_table('b',Field('a',db.a,ondelete='CASCADE'),Field('name')) > > db.a.insert(name='xxx1') > > db.a.insert(name='xxx2') > > db.a.insert(name='xxx3') > > db.a.insert(name='xxx4') > > db.b.insert(a=2,name='yyy1') #(1) > > db.b.insert(a=2,name='yyy2') #(1) > > db.b.insert(a=3,name='yyy3') > > db(db.a.id==2).delete() > > for row in db(db.b.a==2).select(): print row # prints nothing as it > > should > > > Notice ondelete='CASCADE' is default. > > > 2) you can now do: > > > row = db(db.mytable.id>0).select().first() > > row = db(db.mytable.id>0).select().last() > > > and row is None if no records are selected. > > > 3) I fixed the problem with the memory leak reported by zahariash > > > 4) I refactored some code in main.py, compileapp.py and globals.py. > > This should make the code cleaner. Hopefully I did not break it. > > Please give it a try. > > > 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 -~----------~----~----~----~------~----~------~--~---

