postgresql7.1
select file_storage__new_root_folder (
:package_id,
:pretty_name, -- label
:name, -- name
:description
)
select file_storage__get_root_folder(:package_id);
select content_folder__edit_name(
:folder_id,
null,
:name,
null
);
select file_storage__get_folder_name(:folder_id);
select file_storage__get_title(:item_id)
select (case when file_storage__get_content_type(i.item_id) = 'content_folder'
then :folder_url || '?folder_id='
else :file_url || '?file_id='
end) || i.item_id || :extra_vars,
file_storage__get_title(i.item_id)
from (select tree_ancestor_keys(cr_items_get_tree_sortkey(:start_id)) as tree_sortkey) parents,
(select tree_sortkey from cr_items where item_id = :root_folder_id) root,
cr_items i
where i.tree_sortkey = parents.tree_sortkey
and i.tree_sortkey > root.tree_sortkey
order by i.tree_sortkey asc
select file_storage__new_file (
:name,
:parent_id,
:creation_user,
:creation_ip,
:indbp,
:item_id,
:package_id
)
select file_storage__delete_version(
:item_id,
:version_id
);
select file_storage__delete_file(
:item_id
);
select content_folder__del(:folder_id, :cascade_p)
With RECURSIVE items AS (
select cr.item_id from cr_items cr where cr.item_id = :folder_id
UNION ALL
select cr.parent_id from cr_items cr, items where items.item_id = cr.item_id
)
select r.package_id, r.folder_id as root_folder_id
from items i, fs_root_folders r
where r.folder_id = i.item_id
select file_storage__new_file (
:name,
:parent_id,
:creation_user,
:creation_ip,
:indbp,
:item_id,
:package_id
)