Forum OpenACS Development: Re: Code duplication?

Collapse
2: Re: Code duplication? (response to 1)
Posted by Nick Carroll on
Friedrich,

Queries should be separated out of the TCL files and placed in XQL files. Generic SQL code that works on both Oracle and PostgreSQL can be placed in file.xql, whereas database specific SQL should be placed in file-dbname.xql (where dbname is either oracle or postgresql).

OpenACS first looks for a query in file-dbname.xql, if that file doesn't exist, then it looks for file.xql. If that doesn't exist, it will then run the query in the TCL file. Again it is preferable for queries to be placed in the XQL files. This makes the TCL code look cleaner, and makes maintaining queries and TCL code simpler.

Cheers,
Nick.