select i.storage_type, i.storage_area_key, r.mime_type, i.item_id, r.content_length from cr_items i, cr_revisions r where r.revision_id = :revision_id and i.item_id = r.item_id select content from cr_revisions where revision_id = :revision_id select content_type from cr_items where item_id = :item_id insert into cr_mime_types (mime_type) select :mime_type from dual where not exists (select 1 from cr_mime_types where mime_type = :mime_type) select content_type from cr_content_mime_type_map where mime_type = :mime_type select 1 from cr_content_mime_type_map where mime_type = :mime_type and content_type = 'content_revision' select mime_type from cr_extension_mime_type_map where extension = :extension select mime_type from cr_extension_mime_type_map where extension = :extension select 1 from cr_content_mime_type_map where mime_type = :mime_type and content_type = 'image'