postgresql7.1 select photo_album__get_root_folder(:package_id) select photo_album__new_root_folder(:package_id) select acs__magic_object_id('$party') select acs_permission__grant_permission ( :new_folder_id, -- object_id :grantee_id, -- grantee_id :privilege -- privilege ) select content_folder__get_label(:folder_id) select parent_id as start_id, content_item__get_title(item_id,'t') as final from cr_items where item_id = :item_id select case when content_item__get_content_type(i.item_id) = 'content_folder' then 'index?folder_id=' when content_item__get_content_type(i.item_id) = 'pa_album' then 'album?album_id=' else 'photo?photo_id=' end || i.item_id, content_item__get_title(i.item_id,'t') from cr_items i, (select tree_ancestor_keys(cr_items_get_tree_sortkey(:start_id)) as tree_sortkey) parents, (select tree_sortkey from cr_items where item_id = :root_folder_id) as root where i.tree_sortkey = parents.tree_sortkey and i.tree_sortkey > root.tree_sortkey order by i.tree_sortkey asc select exists (select 1 from cr_items i, cr_items i2 where i.item_id = :item_id and i.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) and i2.item_id = :root_folder ) and content_item__get_content_type(:item_id) = :content_type select acs_permission__grant_permission ( :object_id, -- object_id :user_id, -- grantee_id :privilege -- privilege ) select pa_photo__new ( :image_name, -- name :album_id, -- parent_id :photo_id, -- item_id :photo_rev_id, -- revision_id current_timestamp, -- creation_date :user_id, -- creation_user :peeraddr, -- creation_ip null, -- locale :album_id, -- context_id :client_filename, -- title :description, -- description 't', -- is_live current_timestamp, -- publish_date null, -- nls_lang :caption, -- caption :story -- story ) select image__new ( :name, -- name :photo_id, -- parent_id :item_id, -- item_id :rev_id, -- revision_id :mime_type, -- mime_type :user_id, -- creation_user :peeraddr, -- creation_ip :relation, -- relation_tag :title, -- title :description, -- description :is_live, -- is_live current_timestamp, -- publish_date :path, -- path :size, -- file_size :height, -- height :width -- width ) UPDATE pa_photos SET camera_model = :tmp_exif_Cameramodel, user_filename = :upload_name, date_taken = datetime(:tmp_exif_DateTime), flash = :tmp_exif_Flashused, aperture = :tmp_exif_Aperture, metering = :tmp_exif_MeteringMode, focal_length = :tmp_exif_Focallength, exposure_time = :tmp_exif_Exposuretime, focus_distance = :tmp_exif_FocusDist, sha256 = :base_sha256 WHERE pa_photo_id = :photo_rev_id select i.image_id, crr.content as filename, i.width, i.height from cr_items cri, cr_revisions crr, images i where cri.parent_id = :id and crr.revision_id = cri.latest_revision and i.image_id = cri.latest_revision order by crr.content_length desc