insert into acs_data_links (rel_id, object_id_one, object_id_two) values (:forward_rel_id, :object_id, :to_object_id) insert into acs_data_links (rel_id, object_id_one, object_id_two) values (:backward_rel_id, :from_object_id, :object_id) select rel_id from acs_data_links where (object_id_one = :object_id or object_id_two = :object_id) delete from acs_data_links where rel_id = :rel_id select object_id_two from acs_data_links where object_id_one = :object_id order by object_id_two select o.object_id from acs_data_links r, acs_objects o where r.object_id_one = :from_object_id and r.object_id_two = o.object_id and o.object_type = :to_object_type order by r.object_id_two select i.item_id from acs_data_links r, cr_items i where r.object_id_one = :from_object_id and r.object_id_two = i.item_id and i.content_type = :to_content_type order by r.object_id_two 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 $to_type_where_clause and object_type = :to_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]) select 1 from acs_data_links where object_id_one = :from_object_id and object_id_two = :to_object_id