select 1
from attachments_fs_root_folder_map
where package_id = :package_id
select folder_id
from attachments_fs_root_folder_map
where package_id = :package_id
insert
into attachments_fs_root_folder_map
(package_id, folder_id)
values
(:package_id, :folder_id)
delete
from attachments_fs_root_folder_map
where package_id = :package_id and
folder_id = :folder_id
insert
into attachments
(object_id, item_id, approved_p)
values
(:object_id, :attachment_id, :approved_p)
delete
from attachments
where object_id = :object_id
and item_id = :attachment_id
select approved_p
from attachments
where object_id = :object_id
and item_id = :item_id
update attachments
set approved_p = :approved_p
where object_id = :object_id
and item_id = :item_id