download_insert_revision (public)
download_insert_revision upload_file tmpfile repository_id \ archive_type_id archive_id version_name revision_id user_id \ creation_ip approved_p metadata_array
Defined in packages/download/tcl/download-procs.tcl
Dummy comment.
- Parameters:
- upload_file (required)
- tmpfile (required)
- repository_id (required)
- archive_type_id (required)
- archive_id (required)
- version_name (required)
- revision_id (required)
- user_id (required)
- creation_ip (required)
- approved_p (required)
- metadata_array (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # get the filename part of the upload file if {![regexp {[^//\\]+$} $upload_file filename]} { # no match set filename $upload_file } # get the file_size for the postgres version set file_size [file size $tmpfile] set mime_type [cr_filename_to_mime_type -create $upload_file] db_exec_plsql revision_new { declare v_revision_id integer; begin v_revision_id := content_revision.new( item_id => :archive_id, title => :filename, description => :version_name, revision_id => :revision_id, mime_type => :mime_type, creation_user => :user_id, creation_ip => :creation_ip ); insert into download_archive_revisions (revision_id, approved_p) values (v_revision_id, :approved_p); end; } db_dml content_add { update cr_revisions set content = empty_blob() where revision_id = :revision_id returning content into :1 } -blob_files [list $tmpfile] db_exec_plsql make_live { begin content_item.set_live_revision(:revision_id); end; } download_insert_metadata $repository_id $archive_type_id $revision_id $metadata_arrayGeneric XQL file: packages/download/tcl/download-procs.xql
PostgreSQL XQL file: <fullquery name="download_insert_revision.revision_new"> <querytext> declare v_revision_id integer; begin v_revision_id := content_revision__new( :filename, :version_name, now(), :mime_type, null, ' ', :archive_id, :revision_id, now(), :user_id, :creation_ip ); insert into download_archive_revisions (revision_id, approved_p, file_size) values (v_revision_id, :approved_p, :file_size); return v_revision_id; end; </querytext> </fullquery> <fullquery name="download_insert_revision.content_add"> <querytext> update cr_revisions set content = '[cr_create_content_file $archive_id $revision_id $tmpfile]' where revision_id = :revision_id </querytext> </fullquery> <fullquery name="download_insert_revision.make_live"> <querytext> select content_item__set_live_revision( :revision_id ); </querytext> </fullquery>packages/download/tcl/download-procs-postgresql.xql
Oracle XQL file: <fullquery name="download_insert_revision.revision_new"> <querytext> declare v_revision_id integer; begin v_revision_id := content_revision.new( item_id => :archive_id, title => :filename, description => :version_name, revision_id => :revision_id, mime_type => :mime_type, creation_user => :user_id, creation_ip => :creation_ip ); insert into download_archive_revisions (revision_id, approved_p) values (v_revision_id, :approved_p); end; </querytext> </fullquery> <fullquery name="download_insert_revision.content_add"> <querytext> update cr_revisions set content = empty_blob() where revision_id = :revision_id returning content into :1 </querytext> </fullquery> <fullquery name="download_insert_revision.make_live"> <querytext> begin content_item.set_live_revision(:revision_id); end; </querytext> </fullquery>packages/download/tcl/download-procs-oracle.xql