select rl_resource__new_item (
null,
:resource_name,
:description,
now(),
:user_id,
:peeraddr,
:package_id
);
select rl_resource__new_revision (
:resource_item_id,
:resource_name,
:description,
now(),
:user_id,
:peeraddr,
:package_id
);
select
item_id as resource_item_id,
title as resource_name,
description
FROM
rl_resources_revisionsx
where resource_revision_id = :resource_revision_id
select
item_id as resource_item_id
FROM
rl_resources_revisionsx
where resource_revision_id = :resource_revision_id
select
category_id as category_type_id,
short_name as type_short_name
FROM
rl_resource_category_type
ORDER BY
ordering
select
short_name,
category_id
FROM
rl_resource_category
WHERE
category_type = :category_type_id
ORDER BY
short_name
insert into
rl_resource_category_map
(resource_item_id, category_id)
values
(:resource_item_id, :category_to_insert)
select
c.category_id
FROM
rl_resource_category c,
rl_resource_category_map m,
rl_resources_revisionsx r
WHERE
m.resource_item_id = r.item_id and
c.category_id = m.category_id and
r.resource_revision_id = :resource_revision_id
delete from rl_resource_category_map where resource_item_id = :resource_item_id