select enabled_p
from dav_site_node_folder_map
where folder_id=:folder_id
insert into dav_site_node_folder_map
(node_id, folder_id, enabled_p)
values
(:node_id, :folder_id, :enabled_p)
delete from dav_site_node_folder_map
where folder_id=:folder_id
and node_id=:node_id
select folder_id from dav_site_node_folder_map
where node_id=:node_id and enabled_p = 't'
update cr_items set live_revision=:revision_id
where item_id=(select item_id from cr_revisions
where revision_id=:revision_id)
select count(*) from dav_site_node_folder_map
where folder_id=:move_folder_id
update cr_folders
set label = :new_name
where folder_id=:move_folder_id
select item_id
from cr_items
where name = :new_name
and parent_id = :new_parent_folder_id
update cr_items set live_revision=latest_revision
where item_id=:item_id
update cr_revisions
set title = :new_name
where revision_id = (select latest_revision from cr_items
where item_id=:item_id)
update cr_items
set live_revision=latest_revision
where exists (
select 1
from
(select ci1.item_id as child_item_id
from cr_items ci1, cr_items ci2
where ci2.item_id=:new_folder_id
and ci1.tree_sortkey
between ci2.tree_sortkey and tree_right(ci2.tree_sortkey)
) children
where item_id=child_item_id
)