postgresql7.1
select file_storage__new_root_folder(
:package_id,
:pretty_name,
:description
);
select file_storage__get_root_folder(:package_id);
select file_storage__new_folder(
:name,
:pretty_name,
:parent_id,
:creation_user,
:creation_ip
);
select content_folder__rename(
:folder_id,
null,
:name,
null
);
-- we use $n_past-days instead of :n_past_days becasuse he pgdriver
-- bind variable emulation puts single-quotes around the n_past_days
-- integer. Postgresql tries to turn '-1' into a date datatype
-- so now()-'-1' fails but now()- -1 works fine.
select fc.*
from (select fs_objects.object_id,
fs_objects.name,
fs_objects.live_revision,
fs_objects.type,
to_char(fs_objects.last_modified, 'Month DD YYYY HH24:MI') as last_modified,
fs_objects.content_size,
fs_objects.url,
fs_objects.key,
fs_objects.sort_key,
case when fs_objects.last_modified >= (now() - $n_past_days) then 1 else 0 end as new_p,
acs_permission__permission_p(fs_objects.object_id, :user_id, 'admin') as admin_p,
acs_permission__permission_p(fs_objects.object_id, :user_id, 'delete') as delete_p,
acs_permission__permission_p(fs_objects.object_id, :user_id, 'write') as write_p
from fs_objects
where fs_objects.parent_id = :folder_id) fc
where 't' = (select acs_permission__permission_p(fc.object_id, :user_id, 'read') from dual)
order by fc.sort_key,
fc.name
select file_storage__get_folder_name(:folder_id);
select count(*)
from cr_items c1, cr_items c2
where c2.item_id = :item_id
and c1.tree_sortkey between c2.tree_sortkey and tree_right(c2.tree_sortkey)
and not acs_permission__permission_p(c1.item_id, :user_id, :privilege)
select c1.item_id as child_item_id
from cr_items c1, cr_items c2
where c2.item_id = :item_id
and c1.tree_sortkey between c2.tree_sortkey and tree_right(c2.tree_sortkey)
order by c1.tree_sortkey
select count(*)
from cr_revisions
where item_id = :child_item_id
and acs_permission__permission_p(revision_id, :user_id, :privilege) = 'f'
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,
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