Forum OpenACS Development: Re: How OpenACS coding could get its groove back

Collapse
Posted by Jeff Davis on
I think most dml should have a tcl wrapper function (permission::grant for example) and for display queries the reuse should be via includable .tcl/.adp pairs. Of course, no rigid rules like that work in all circumstances...

A big advantage with having dml in tcl procs is that it is much simpler to write unit tests and in most cases the dml is for a single object anyway. I would agree that for things where you are operating on a collection of objects you probably will want to do it directly in sql rather than create a tcl wrapper function (although even there I think an api that takes a sql fragment or list would be useful and more easily tested).