Forum OpenACS Q&A: Response to Breakthrough on bookmarks module

Collapse
Posted by Bob Fuller on

Query change in index.tcl

In index.tcl, comment out the following query:

#set bookmark_query " # select bookmark_id, # bm_list.url_id, # coalesce(local_title, url_title) as bookmark_title, # hidden_p, # complete_url, # last_live_date, # last_checked_date, # folder_p, # closed_p, # length(parent_sort_key)*8 as indent_width # from bm_list, bm_urls # where owner_id = $user_id # and in_closed_p = 'f' # and bm_list.url_id = bm_urls.url_id(+) # order by parent_sort_key || local_sort_key"
and do the following query instead (to replace the outer join, plus a couple of other fixes):
set bookmark_query " select bookmark_id, bm_list.url_id, coalesce(local_title, url_title) as bookmark_title, hidden_p, complete_url, last_live_date, last_checked_date, folder_p, closed_p, case when parent_sort_key is null then 0 else length(parent_sort_key)*8 end as indent_width from bm_list, bm_urls where owner_id = $user_id and in_closed_p = 'f' and bm_list.url_id = bm_urls.url_id union select bookmark_id, '' as url_id, local_title as bookmark_title, hidden_p, '' as complete_url, NULL as last_live_date, NULL as last_checked_date, folder_p, closed_p, case when parent_sort_key is null then 0 else length(parent_sort_key)*8 end as indent_width from bm_list where owner_id = $user_id and in_closed_p = 'f' and not exists (select 1 from bm_urls where url_id = bm_list.url_id) order by case when parent_sort_key is null then '!' else '!' || parent_sort_key end || cast(local_sort_key as varchar(3))"