insert into acs_data_links (rel_id, object_id_one, object_id_two, relation_tag) values (:forward_rel_id, :object_id, :to_object_id, :relation_tag) insert into acs_data_links (rel_id, object_id_one, object_id_two, relation_tag) values (:backward_rel_id, :from_object_id, :object_id, :relation_tag) select rel_id from acs_data_links where (object_id_one = :object_id or object_id_two = :object_id) [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] delete from acs_data_links where rel_id = :rel_id select object_id_two from acs_data_links where object_id_one = :object_id [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] order by object_id_two select o.object_id from acs_objects o where o.object_type = :to_object_type and o.object_id in (select object_id_two from acs_data_links where object_id_one = :from_object_id [application_data_link::relation_tag_where_clause -relation_tag $relation_tag]) order by o.object_id select i.item_id from cr_items i where i.content_type = :to_content_type and i.item_id in (select object_id_two from acs_data_links where object_id_one = :from_object_id [application_data_link::relation_tag_where_clause -relation_tag $relation_tag]) order by i.item_id select object_id_two from acs_data_links, acs_objects $content_type_from_clause where object_id_one = :object_id and object_id = object_id_two [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] $to_type_where_clause and object_type = :to_type , cr_items and content_type = :object_type select object_id_one from acs_data_links, acs_objects $content_type_from_clause where object_id_two = :object_id and object_id = object_id_one [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] $from_type_where_clause and object_type = :from_type , cr_items and content_type = :object_type delete from acs_data_links where object_id_one=:object_id and object_id_two in ([template::util::tcl_to_sql_list $link_object_id_list]) [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] select 1 from acs_data_links where object_id_one = :from_object_id and object_id_two = :to_object_id [application_data_link::relation_tag_where_clause -relation_tag $relation_tag] select object_id from acs_objects where object_id in ([template::util::tcl_to_sql_list $refs]) and relation_tag = :relation_tag