Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Collapse
Posted by Tom Jackson on

The old ACS used to have a function that processed a select, and prepended a string to the column names so as to avoid clobbering local vars. One variant allowed you to set the value of the prepended string.

Although we can speculate as to what the correct behavior should have been for db_multirow, it seems to be a few years too late to change the default.

If instead of -unclobber, you used something like -prepend, you would never have to unclobber the vars, also allowing local vars to be available to the tcl code block for the db_multirow. The default to -prepend would be the empty string, allowing the current behavior. db_1row would also benefit from a -prepend switch.

db_multirow is also useful when you know only one row will be returned, and you want to use array/multiple syntax for handling the result.