select parent_id from cr_items where item_id = :photo_id
select
cr.title,
i.height as height,
i.width as width,
i.image_id as image_id
from cr_items ci,
cr_revisions cr,
cr_items ci2,
cr_child_rels ccr2,
images i
where ci.live_revision = cr.revision_id
and ci.item_id = ccr2.parent_id
and ccr2.child_id = ci2.item_id
and ccr2.relation_tag = 'thumb'
and ci2.live_revision = i.image_id
and ci.item_id = :photo_id
update cr_items
set parent_id = :new_album_id
where item_id = :photo_id
update cr_child_rels
set parent_id = :new_album_id
where parent_id = :old_album_id
and child_id = :photo_id
update acs_objects
set context_id = :new_album_id
where object_id = :photo_id
select name from cr_items where item_id = :photo_id
select count(*)
from cr_items
where name = :filename
and parent_id = :new_album_id