Forum OpenACS Development: Re: Can someone explain why nested queries such as db_foreach are not recommended?
6: Re: Can someone explain why nested queries such as db_foreach are not recommended? (response to 4)
Posted by Antonio Pisano on 10/28/19 03:42 PM
db_foreach is mostly convenient when one has a query returning some big number of columns. In such case, when using e.g. db_list_of_lists, one would have to "peel" the results with a cumbersome lassign.
Using db_list_of_ns_sets would be a nicer replacement in this case, as it maintains a notion of which columns have been extracted in the ns_set. In fact, latest db_foreach implementation is just a wrapper around this api.