Forum OpenACS Development: Re: Referencing postgresql array in XQL file

Collapse
Posted by Gustaf Neumann on
OpenACS uses at least since 2003 "subst -nobackslashes" in .xql files [1], probably since it was the the intention to leave backslash substitution to SQL. Since OpenACS 5.8 the necessity for backslash substitution in SQL was greatly reduced by using $$ instead of single quotes around the definition of SQL functions/procedures. AFAIK, there are still a few cases, where OpenACS sends backslashes to SQL for escaping.

The easiest quick solution is probably to set in the Tcl code a Tcl variable with the name of the SQL array
set array_cname {array[c.name]}
and to use in the .xql-file something like
...level,$array_cname as path....
Same with other SQL-chunks that need square brackets.

Another solution is to write the .sql-query without .xql (i.e. in the tcl file).

Hope this helps
-g

[1] https://github.com/openacs/openacs-core/blame/oacs-5-9/packages/acs-tcl/tcl/00-database-procs.tcl#L788