category::relation::add_meta_category (public)
category::relation::add_meta_category -category_id_one category_id_one \ -category_id_two category_id_two [ -user_id user_id ]
Defined in packages/categories/tcl/category-relation-procs.tcl
Creates a new meta category by creating a relation between category_id_one and category_id_two. This relation is also related to the user_id.
- Switches:
- Options:
- -category_id_one (required)
- -category_id_two (required)
- -user_id (optional)
- -user_id
- user that will be related to the meta category.
- -category_id_one
- one of the two category_id's to be related.
- -category_id_two
- the other category_id to be related.
- Authors:
- Miguel Marin <miguelmarin@viaro.net>
- Viaro Networks www.viaro.net
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- category_tree_procs
Source code: if { $user_id eq "" } { set user_id [ad_conn user_id] } # First we check if the relation exist, if it does, we don't create a new one set meta_category_id [db_string get_meta_relation_id {} -default ""] if { $meta_category_id eq "" } { set meta_category_id [db_exec_plsql add_meta_relation {}] } # Now we check if the user already has the meta category associated, # if it does, we don't create a new one set user_meta_category_id [db_string get_user_meta_relation_id {} -default ""] if { $user_meta_category_id eq "" } { return [db_exec_plsql add_user_meta_relation {}] } else { return $user_meta_category_id }XQL Not present: Oracle Generic XQL file: <fullquery name="category::relation::add_meta_category.get_meta_relation_id"> <querytext> select rel_id from acs_rels where rel_type = 'meta_category_rel' and object_id_one = :category_id_one and object_id_two = :category_id_two </querytext> </fullquery> <fullquery name="category::relation::add_meta_category.get_user_meta_relation_id"> <querytext> select rel_id from acs_rels where rel_type = 'user_meta_category_rel' and object_id_one = :meta_category_id and object_id_two = :user_id </querytext> </fullquery>packages/categories/tcl/category-relation-procs.xql
PostgreSQL XQL file: <fullquery name="category::relation::add_meta_category.add_meta_relation"> <querytext> select acs_rel__new ( null, 'meta_category_rel', :category_id_one, :category_id_two, null, null, null ) </querytext> </fullquery> <fullquery name="category::relation::add_meta_category.add_user_meta_relation"> <querytext> select acs_rel__new ( null, 'user_meta_category_rel', :meta_category_id, :user_id, null, null, null ) </querytext> </fullquery>packages/categories/tcl/category-relation-procs-postgresql.xql