category_tree::get_categories (public)

 category_tree::get_categories -tree_id tree_id [ -locale locale ]

Defined in packages/categories/tcl/category-trees-procs.tcl

Return root categories of a given tree

Switches:
-tree_id (required)
-locale (optional)
sort results by name in specified locale. If a translation in this locale is not available, the one in en_US will be used. When missing, will default to locale of the connection or en_US when we are outside a connection context.
Returns:
list of category ids

Partial Call Graph (max 5 caller/called nodes):
%3 test_category_tree_procs category_tree_procs (test categories) category_tree::get_categories category_tree::get_categories test_category_tree_procs->category_tree::get_categories ad_conn ad_conn (public) category_tree::get_categories->ad_conn db_list db_list (public) category_tree::get_categories->db_list

Testcases:
category_tree_procs
Source code:
        if {![info exists locale]} {
            set locale [expr {[ns_conn isconnected] ? [ad_conn locale] : "en_US"}]
        }
        return [db_list get_categories {
            select c.category_id
            from categories c
                 left join category_translations loct
                    on c.category_id = loct.category_id and loct.locale = :locale,
                 category_translations ent
            where c.category_id = ent.category_id
              and c.parent_id is null
              and c.tree_id = :tree_id
              and ent.locale = 'en_US'
            order by coalesce(loct.name, ent.name)
        }]
XQL Not present:
Generic
PostgreSQL XQL file:
packages/categories/tcl/category-trees-procs-postgresql.xql

Oracle XQL file:
packages/categories/tcl/category-trees-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: