Forum OpenACS Q&A: Re: Bind variable from array

Collapse
Posted by Christian Brechbuehler on
Thanks for a comprehensive answer, Gustaf!

I wasn't aware of TCL dicts, will have al look.

I have used ns_set to pass bind variables, and it works with Oracle. After all, that seems to be what the "normal" invocation uses; it just creates an ns_set with the necessary variables for you on the fly. The drawback is that this use of the "-bind" flag masks ordinary TCL variables in the caller's scope, i.e., I can no longer write :varname in the query. As a work-around, I make a copy of the ns_set, splice all needed variables of interest into the copy, and pass that to the db_* call. I need a copy so I don't mess up the original ns_set. All in all, not very elegant.

Thanks again,
/Christian