Forum OpenACS Development: What does using acs-templating give me?

Clickthrough uses the acs-templating database api instead of the
standard db_* api. It seems that all the modules that use the
standard db_* api still work the same.

I am wonderng what benefits there are to using acs-templating and how
to port it to work with the query extractor.

Collapse
Posted by Dan Wickstrom on
The templating db api as released from aD was a non-starter for openacs, since it did not support named queries, and it had its own transaction control and handle allocation mechanisms.  Not having named queries was a big problem, because this did not give us any hooks for tying into the query dispatcher.

For openacs, we rewired the template::query api to use the standard db api for its internal implementation, and the template::query api was changed to include a statement name so that it could be hooked into the QD.

When porting template queries, you need to first modify all of the template::query calls and add a statement name(look at the content-repository code for examples).  You also need to delete any references to passed in db handles and eliminate the code for allocating handles, as it is not needed any more.  template:queries that make use of the templating transaction mechanism, need to be converted to use the standard db api transaction method (e.g. db_transaction { ...}).

Don had mentioned adding support to the query extractor for supporting the templating db interface, but I'm not sure if that work is done yet.

Collapse
Posted by Dave Bauer on
Great, that helps alot. Now I know how to proceed with porting.
Collapse
Posted by Don Baccus on
No, I haven't had time, I'll try to grab some time in the next few days.  Dan ... if you have a moment, would you be interested in writing up your explanation of the necessary changes in a more permanent place, i.e. the wp presentation perhaps?
Collapse
Posted by Dan Wickstrom on
Sure, no problem.
Collapse
Posted by Dan Wickstrom on
Ok, I've added a section to the wimpypoint presentation that illustrates how to port templating db queries.