Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Collapse
Posted by Jarkko Laine on
I can see your point about the cutoff point, Jonathan.

However, I don't think comparing db_1row et al which return just one row to these multirow procs is worthwhile. It's obvious what you get from db_1row, but it's definitely not that intuitive that you get the values of last db row in local variables when you use db_multirow or db_foreach. Like Peter, I wouldn't assume to get local variables overwritten.

I don't think this would be "Forcing developers into that for the sake of some misguided purity". Now we are forcing developers to save their local variables always when they use db_multirow or db_foreach if they aren't sure there's no columns in the query with the same name. I think that instead of misguided purity we are talking about which way would be more useful. I would take Peter's side but it's just my opinion.

Maybe there could be an additional code block for the last row of db_foreach for this, if it's really needed. Or a -clobber parameter in the spirit Lars mentioned.