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 exists (select 1
from acs_object_party_privilege_map m
where m.object_id = cr_items.item_id
and m.party_id = :user_id
and m.privilege = :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 left join cr_revisions cr on ci1.live_revision = cr.revision_id,
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 exists (select 1
from acs_object_party_privilege_map m
where m.object_id = ci1.item_id
and m.party_id = :user_id
and m.privilege = 'read')
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 exists (select 1
from acs_object_party_privilege_map m
where m.object_id = ci.item_id
and m.party_id = :user_id
and m.privilege = '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__rename (
:move_folder_id,
:new_name,
:new_name,
NULL
)
select content_item__move (
:item_id,
:new_parent_folder_id,
:new_name
)
select content_item__rename (
: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')