Forum OpenACS Q&A: Response to need some brilliant curmudgeons.

Collapse
Posted by Todd Gillespie on
Yes, Tom, I have run a few million rows through the ns_set structure. And as an extension programmer I admire its small footprint, I have never liked its interface to tcl programmers.

If it is a list, then what, you still have to write code to figure out if it is a list or not. I don't think there is a magic solution. It isn't even right to assume that a single key query should return all matches, because that destroys the order that you put them in. Ns_set preserves the order, which could be important.

In reverse:

  1. There is no reason a ns_set get_all should destroy the order of the subset.
  2. You don't need to test for list existence if you are writing in a functional iterator style. Take something simple, like pulling multiple form args into a SQL query to be executed:
    url_query = conn.query
    url_query.get_all('orderby').each { |value|  append sql_query ",$value" }
    
  3. I'm a big fan of data modeling at all levels of the application. If you have to wonder if the result is a list, as opposed to 'the form vars can have 0 to N values', then the data is not specified enough.

David, thanks for the suggestion. Maybe that is sufficient to make me shut up. :)