Forum OpenACS Q&A: Referencing Queries in arbitray XQL files

The query dispatcher does let you reference a query with the fully qualified name. The systax is like this:

dbqd.packages.notes.tcl.notes-procs.get_note

This will try to find the query "get_note" under /packages/notes/tcl/notes-procs.xql (or use a database specific query if it exists.)

There is a . for each / in the path to the query file relative to the openacs install root.

Collapse
Posted by Dave Bauer on
Oops, I forgot to mention how to reference a query that is called from inside a tcl procedure.

Its the same syntax. The element before the query name is the proc name.

dbqd.notes.tcl.notes-procs.proc_name.get_note

If the proc has a namespace definied, the full proc name is used.

dbqd.notes.tcl.notes-procs.ns::proc_name.get_note

I also made an error. If a query file is under the www page root the query path is dbqd.www.filename.queryname

If the query is under a package the path is dbqd.package-key.package-key-procs.proc_name.query_name

Sorry about the mixup!

Collapse
Posted by Randy O'Meara on
Thank you, Dave. This will come in very handy.