Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Collapse
Posted by Peter Marklund on
Tom,
I think my variable interference was that I had a set user_id [ad_conn user_id] and then I had possibly multiple db_multirows that selected user_id so that the value of user_id as the script progressed would change in undesired ways. At any point in the script the value of user_id would be fairly unpredictable and this broke my page.

I'm not sure I see the need for a namespace for db queries. I think it might be sufficient to have them be local variables. For one row queries I think arrays provide good namespace separation, selecting a single value can go into a local variable, if you are doing a db_multirow you should only be initializing the multirow data structure without clobbering the envrionment.

It *would* be nice if we could make the properties block of ad_page_contract actually do something though (strictly give the adp access only to vars listed in that block). That would have solved my interference problem in the adp, but not in the tcl script.