postgresql7.1
select content_item__get_id(:item_name,:parent_id,'f')
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
coalesce (cr.content_length,0) as content_length,
coalesce(cr.mime_type,'*/*') as mime_type,
to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date,
to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified,
ci1.item_id,
case when ci1.item_id=ci2.item_id then '' else ci1.name end as name,
content_item__get_path(ci1.item_id,:folder_id) as item_uri,
case when o.object_type='content_folder' then 1 else 0 end
as collection_p
from
cr_items ci1,
cr_revisions cr,
cr_items ci2,
acs_objects o
where
ci1.live_revision = cr.revision_id
and ci1.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey)
and ci2.item_id=:folder_id
and ci1.item_id = o.object_id
and (tree_level(ci1.tree_sortkey) - tree_level(ci2.tree_sortkey)) <= :depth ::integer
and acs_permission__permission_p(ci1.item_id, :user_id, 'read')
union
select 0 as content_length,
'*/*' as mime_type,
to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date,
to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified,
ci1.item_id,
case when ci1.item_id=ci2.item_id then '' else ci1.name end as name,
content_item__get_path(ci1.item_id,:folder_id) as item_uri,
case when o.object_type='content_folder' then 1 else 0 end
as collection_p
from
cr_items ci1,
cr_items ci2,
acs_objects o
where
ci1.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey)
and ci2.item_id = :folder_id
and ci1.item_id = o.object_id
and (tree_level(ci1.tree_sortkey) - tree_level(ci2.tree_sortkey)) <= :depth ::integer
and acs_permission__permission_p(ci1.item_id, :user_id, 'read')
and not exists (select 1
from cr_revisions cr
where cr.revision_id = ci1.live_revision)
select
ci.item_id,
ci.name,
content_item__get_path(ci.item_id,:folder_id) as item_uri,
coalesce(cr.mime_type,'*/*') as mime_type,
coalesce(cr.content_length,0) as content_length,
to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date,
to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified
from cr_items ci,
acs_objects o,
cr_revisions cr
where
ci.item_id=:item_id
and ci.item_id = o.object_id
and cr.revision_id = ci.live_revision
and acs_permission__permission_p(ci.item_id, :user_id, 'read')
select content_folder__new(
:new_folder_name,
:label,
:description,
:parent_id,
:parent_id,
NULL,
current_timestamp,
:user_id,
:peer_addr
)
select content_folder__copy (
:copy_folder_id,
:new_parent_folder_id,
:user_id,
:peer_addr,
:new_name
)
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=children.child_item_id
)
select content_folder__move (
:move_folder_id,
:new_parent_folder_id,
:new_name
)
select content_folder__edit_name (
:move_folder_id,
:new_name,
:new_name,
NULL
)
select content_item__move (
:item_id,
:new_parent_folder_id,
:new_name
)
select content_item__edit_name (
:item_id,
:new_name
)
select content_item__copy (
:copy_item_id,
:new_parent_folder_id,
:user_id,
:peer_addr,
:new_name
)
select content_item__delete(:dest_item_id)
select content_item__delete(:dest_item_id)
select content_item__delete (
:item_id
)
select content_folder__delete (
:item_id,
't'
)
select content_item__get_id(:parent_name,:root_folder_id,'f')
select content_item__get_id(:new_name,:new_parent_folder_id,'f')
select content_item__get_id(:new_name,:new_parent_folder_id,'f')
select content_folder__delete(:dest_item_id,'t');
select content_folder__delete(:dest_item_id,'t');
select content_item__get_id(:new_name,:new_parent_folder_id,'f')
select content_item__get_id(:new_name,:new_parent_folder_id,'f')
select count(*)
from cr_revisions
where item_id = :item_id
and not acs_permission__permission_p(revision_id, :user_id, 'delete')