postgresql7.1 select content_item__new( :name, null, null, null, now(), null, null, :creation_ip, 'content_item', 'content_revision', null, null, 'text/plain', null, null, 'file' ) declare v_revision_id integer; begin v_revision_id := content_revision__new( :title, 'gzipped tarfile', now(), 'text/plain', null, 'not_important', :item_id, null, now(), :user_id, :creation_ip ); update cr_items set live_revision = v_revision_id where item_id = :item_id; return v_revision_id; end; update cr_revisions set content = '[set content_file [cr_create_content_file $item_id $revision_id $tmpfile]]' where revision_id = :revision_id update apm_package_versions set content_length = [cr_file_size $content_file] where version_id = :version_id select '[cr_fs_path]' || r.content as content, i.storage_type from cr_revisions r, cr_items i where r.item_id = i.item_id and r.revision_id = (select content_item__get_latest_revision(item_id) from apm_package_versions where version_id = :version_id) select apm_package_version__add_file( :file_id, :version_id, :path, :file_type, :db_type ) select apm_package_version__remove_file( :path, :version_id )