select count(*) from cr_items where item_id = :photo_id select count(*) from cr_items where (item_id = :photo_id or name = :client_filename) and parent_id = :album_id