xo::db::CrClass proc get_child_item_ids (public)
xo::db::CrClass get_child_item_ids -item_id item_id
Defined in /var/www/openacs.org/packages/xotcl-core/tcl/cr-procs.tcl
Return a list of content items having the provided item_id as direct or indirect parent. The method returns recursively all item_ids.
- Switches:
- -item_id (required)
- Returns:
- list of item_ids
- Testcases:
- xowiki_test_cases
Source code: # # The following construct (commented out) is fully PostgreSQL and # Oracle compliant. However, all newer Oracle installations # should as well support the recursive query below as well, which # requires less DB interactions. # # set items [list] # foreach item_id [::xo::dc list -prepare integer get_child_items # "select item_id from cr_items where parent_id = :item_id"] { # lappend items $item_id {*}[my [self proc] -item_id $item_id] # } # return $items return [::xo::dc list -prepare integer get_child_items { WITH RECURSIVE child_items AS ( select item_id from cr_items where parent_id = :item_id UNION ALL select i.item_id from cr_items i, child_items where i.parent_id = child_items.item_id ) select * from child_items }]XQL Not present: Generic, PostgreSQL, Oracle