postgresql7.2
select content_item__new (
:item_name, -- name
integer :parent_id, -- parent_id
-- for some reason PG gets confused on this param, explicit typecasting was needed
:item_id, -- item_id
null, -- locale
now(), -- creation_date
:creation_user, -- creation_user
:parent_id, -- context_id
:creation_ip, -- creation_ip
'content_revision', -- item_subtype
:content_type, -- content_type
null, -- title
null, -- description
null, -- mime_type
null, -- nls_language
null, -- data
:storage_type -- storage_type
)
select content_item__move(:item_id, :parent_id)
select i.item_id,
i.name,
i.live_revision,
i.latest_revision,
i.publish_status,
i.content_type,
i.storage_type,
i.tree_sortkey,
to_char(last_modified,'YYYY-MM-DD HH24:MM:SS') as last_modified
$addtnl_select
from cr_items i, cr_revisionsx r
$addtnl_from
where
i.parent_id = :parent_id
$addtnl_where
union
select i.item_id,
i.name,
i.live_revision,
i.latest_revision,
i.publish_status,
i.content_type,
i.storage_type,
i.tree_sortkey,
null as last_modified,
f.label as title,
f.description
$addtnl_select_folder
from cr_items i, cr_folders f
where
i.parent_id = :parent_id
and i.item_id = f.folder_id
$addtnl_where_folder
order by $orderby
select a.item_id, o.name, o.live_revision, o.latest_revision, o.publish_status,
o.content_type, o.storage_type,
tree_level(o.tree_sortkey) as level,
tree_level(parent_sortkey) as parent_level
$addtnl_select
from cr_items o,
(select tree_ancestor_keys(i.tree_sortkey) as tree_sortkey_trail, p.tree_sortkey as parent_sortkey, i.item_id, i.tree_sortkey
$addtnl_inner_select
from cr_items i,
(select tree_sortkey from cr_items where item_id = :parent_id) p
$addtnl_from
where
tree_ancestor_p(p.tree_sortkey, i.tree_sortkey)
$addtnl_where) a
where
o.tree_sortkey = tree_sortkey_trail
and tree_ancestor_p(parent_sortkey, o.tree_sortkey)
order by a.tree_sortkey
select i.item_id, i.name, i.live_revision, i.latest_revision, i.publish_status,
i.content_type, i.storage_type, ir.rel_id, ir.order_n,
content_item__get_path(i.item_id, ir.item_id) as path
$addtnl_select
from cr_items i, cr_item_rels ir
$addtnl_from
where ir.item_id = :item_id
and ir.related_object_id = i.item_id
and ir.relation_tag = :relation_tag
$addtnl_where
order by order_n
select content_item__delete(:item_id)
select content_revision__delete(revision_id)
from cr_revisions where item_id = :item_id
select content_symlink__new(
:name, -- name
:label, -- label
:target_id, -- target_id
:parent_id, -- parent_id
null, -- symlink_id
now(), -- creation_date
:creation_user, -- creation_user
:creation_ip -- creation_ip
)
select content_item__relate(
:item_id, -- item_id
:related_object_id, -- related_object_id
:relation_tag, -- relation_tag
:order_n, -- order_n
:relation_type -- relation_type
)
select content_item__unrelate(:rel_id)
select i.item_id, i.name, i.publish_status, i.content_type, i.storage_type $addtnl_select
from cr_items i
where i.parent_id = :parent_id
order by i.tree_sortkey
select content_item__get_id(:url, :root_id, :resolve_index);
select tree_sortkey as current_sortkey, parent_id from cr_items where item_id = :item_id
select i.tree_sortkey as next_sortkey
from cr_items i, (select tree_sortkey from cr_items where item_id = :item_id) c
where i.parent_id = :parent_id
and i.tree_sortkey > c.tree_sortkey
order by i.tree_sortkey
limit 1
select i.tree_sortkey as prev_sortkey
from cr_items i, (select tree_sortkey from cr_items where item_id = :item_id) c
where i.parent_id = :parent_id
and i.tree_sortkey < c.tree_sortkey
order by i.tree_sortkey desc
limit 1
(select i.item_id, :prepend_path as path,
coalesce(:root_title, case when i.content_type = 'content_folder' then content_folder__get_label(i.item_id) else bcms__get_title(i.item_id, 'latest') end) as title
from cr_items i where item_id = :root_id)
union
(select i.item_id, :prepend_path || content_item__get_path(i.item_id, r.item_id) as path,
case when i.content_type = 'content_folder' then content_folder__get_label(i.item_id) else bcms__get_title(i.item_id, 'latest') end as title
from cr_items i,
(select tree_sortkey, item_id from cr_items where item_id = :root_id) r,
(select tree_ancestor_keys(tree_sortkey) as tree_sortkey from cr_items where item_id = :item_id) p
where
i.tree_sortkey = p.tree_sortkey
and i.tree_sortkey > r.tree_sortkey
$addtnl_where
order by i.tree_sortkey)
select content_keyword__item_assign (:item_id,
:category_id,
null,
null,
null)
select content_keyword__item_unassign (:item_id,
:category_id)
select content_keyword__item_unassign (item_id, keyword_id)
from cr_item_keyword_map where item_id = :item_id;