Forum OpenACS Development: Response to New implementation of tree_sortkey

Collapse
Posted by David Walker on
Please let me know if I'm not on the right track. I'm trying to add ideas but I haven't been actively messing with the OpenACS4 code.

I'm wondering if dynamically generating a query in tcl would decrease or enhance speed. The query plan would not be cached but the tree is handled easily (assuming I understand tree_sortkey).
set path "/tr/ee/so/rt/ke/y"

set path_list [split $path /]
set x [expr [llength $path_list] -1]
while {$x > 0} {
 ns_write "select * from permissions where tree_sort = '[join 
[lrange $path_list 0 $x] /]'
" incr x -1 if {$x > 0} { ns_write "union
" } }