Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Collapse
Posted by Tom Jackson on

It seems to me the on the fly renaming of the query var is the way to go, since that is already supported, and everyone knows what you are doing, and probably why. The name of the var in @foo.bar@ never appears on the rendered page, but the programmer still has to see it. I can see that it might be annoying to have longer names for the vars, when you think you are just creating an array.

I think the array variable should be thought of more as a convenience for iterating over the rows, actually a quite inconvenient 'convenience' when you think about it. The vars could just have easily been named foo.bar.1, foo.baz.1, etc. which would have made some things easier to do on the adp page. But there should not be a difference in how things act based on selecting one row or mulitple rows. The data has the same meaning regardless. If there is a naming conflict with one row, it should also exist with multiple rows.

-unclobber might still be a good idea, but it might be nice to be able to specify a list of vars to unclobber. Does your code somehow parse the query to figure out what to unclobber?