Forum OpenACS Development: Response to porting a db_dml transaction

Collapse
Posted by Don Baccus on
The second one is easy - get rid of the set sql2 statement and move the SQL query into your generic .xql file (it's not db-specific so it only needs to appear in the generic queryfile). The first (undelete_mp3) isn't much more difficult. The static part, i.e. the update prefix, can go into your queryfile. Then build the dynamic part into a Tcl variable as is being done (you might want to choose a name like "extra_vars" instead of "sql" since it's s snippet that will be built, not the entire query). Reference the Tcl variable directly in the queryfile. The query, in other words, will look something like:
update mp3_mp3s
set deleted = 'f'
$extra_vars
where mp3_id = :mp3_id
The Query Dispatcher will substitute the Tcl variable before the driver is called with the query.