Index: openacs-4/packages/download/sql/postgresql/download-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-drop.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/download/sql/postgresql/download-drop.sql 16 May 2001 09:41:05 -0000 1.4 +++ openacs-4/packages/download/sql/postgresql/download-drop.sql 22 May 2001 04:18:16 -0000 1.5 @@ -23,6 +23,18 @@ drop function download_rep__edit (integer,varchar,varchar,varchar,timestamp,integer,varchar); drop function download_rep__delete (integer); +-- Tables -- +drop table download_downloads; +drop table download_revision_data; +drop table download_archive_revisions; +--drop table download_archives; +drop table download_metadata_choices; +drop table download_archive_metadata; +drop table download_reasons; +drop table download_archive_types; +--drop table download_repository; +--drop table download_archive_descs; + /* Drop all content items */ create function inline_0 () @@ -32,12 +44,13 @@ archive_child_rec acs_object_context_index%ROWTYPE; begin for archive_rec in select * from cr_items - where content_type in ( ''cr_download_archive_desc'', - ''cr_download_archive'', + where content_type in ( ''cr_download_archive'', + ''cr_download_archive_desc'', ''cr_download_rep'' ) loop -- for archive_child_rec in select * from acs_object_context_index where ancestor_id = archive_rec.item_id loop -- PERFORM content_item__delete( archive_child_rec.object_id ); -- end loop; + update cr_items set live_revision=null, latest_revision=null where item_id=archive_rec.item_id; PERFORM content_item__delete( archive_rec.item_id ); end loop; @@ -72,18 +85,6 @@ --end; --/ -/* Tables */ -drop table download_downloads; -drop table download_revision_data; -drop table download_archive_revisions; ---drop table download_archives; -drop table download_metadata_choices; -drop table download_archive_metadata; -drop table download_reasons; -drop table download_archive_types; ---drop table download_repository; ---drop table download_archive_descs; - /* acs_object_type */ create function inline_1 () Index: openacs-4/packages/download/tcl/download-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/tcl/download-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/download/tcl/download-procs-postgresql.xql 16 May 2001 09:41:05 -0000 1.4 +++ openacs-4/packages/download/tcl/download-procs-postgresql.xql 22 May 2001 04:18:16 -0000 1.5 @@ -4,90 +4,100 @@ postgresql7.1 - - - insert into download_downloads ( - download_id, - user_id, - revision_id, - download_date, - download_ip, - download_hostname, - user_agent, - reason_id, - reason) - values - (:download_id, - :user_id, - :revision_id, - current_timestamp, - :download_ip, - :download_hostname, - :user_agent, - :reason_id, - :reason_other) + + +insert into download_downloads ( + download_id, + user_id, + revision_id, + download_date, + download_ip, + download_hostname, + user_agent, + reason_id, + reason) +values ( + :download_id, + :user_id, + :revision_id, + current_timestamp, + :download_ip, + :download_hostname, + :user_agent, + :reason_id, + :reason_other) - + + - + + select '[cr_fs_path]' || content as content, storage_type - from cr_revisions r, cr_items i - where r.revision_id = :revision_id and - r.item_id = i.item_id - +from cr_revisions r, cr_items i +where r.revision_id = :revision_id and + r.item_id = i.item_id + + + - + - 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 - ); +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; + insert into download_archive_revisions + (revision_id, approved_p, file_size) + values + (v_revision_id, :approved_p, :file_size); + + return v_revision_id; +end; - + + - + - update cr_revisions - set content = '[cr_create_content_file $archive_id $revision_id $tmpfile]' - where revision_id = :revision_id +update cr_revisions +set content = '[cr_create_content_file $archive_id $revision_id $tmpfile]' +where revision_id = :revision_id - + + - + - select content_item__set_live_revision(:revision_id); +select content_item__set_live_revision( :revision_id ); - + + Index: openacs-4/packages/download/tcl/download-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/tcl/download-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/download/tcl/download-procs.tcl 16 May 2001 09:41:05 -0000 1.3 +++ openacs-4/packages/download/tcl/download-procs.tcl 22 May 2001 04:18:16 -0000 1.4 @@ -337,7 +337,7 @@ } # get the file_size for the postgres version - set file_size [file size $upload_file] + set file_size [file size $tmpfile] set mime_type [download_maybe_create_new_mime_type $upload_file] db_exec_plsql revision_new { Index: openacs-4/packages/download/tcl/download-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/tcl/download-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/download/tcl/download-procs.xql 10 May 2001 20:51:30 -0000 1.1 +++ openacs-4/packages/download/tcl/download-procs.xql 22 May 2001 04:18:16 -0000 1.2 @@ -1,115 +1,140 @@ - - - - select repository_id, title, description, help_text from download_repository_obj where parent_id = :package_id - - + + + + +select repository_id, title, description, help_text +from download_repository_obj +where parent_id = :package_id + + - - - - select count(*) from download_archive_types where repository_id = :repository_id + + + + +select count(*) from download_archive_types +where repository_id = :repository_id - + - - - select choice_id, label - from download_metadata_choices - where metadata_id = :metadata_id - order by sort_order - + + + + +select choice_id, label +from download_metadata_choices +where metadata_id = :metadata_id +order by sort_order + + - - - select count(*) from download_downloads where download_id = :download_id - + + + + +select count(*) from download_downloads +where download_id = :download_id + + + - - + + - select mime_type - from cr_revisions - where revision_id = :revision_id - +select mime_type +from cr_revisions +where revision_id = :revision_id + + + - - + + - select count(*) from cr_mime_types - where mime_type = :mime_type - +select count(*) from cr_mime_types +where mime_type = :mime_type + + + - + - insert into cr_mime_types - (mime_type, file_extension) - values - (:mime_type, :extension) - +insert into cr_mime_types +(mime_type, file_extension) +values +(:mime_type, :extension) + + + - + - select - dam.metadata_id, - dam.pretty_name, - dam.data_type, - dam.required_p - from download_archive_metadata dam - where dam.repository_id = :repository_id and - dam.computed_p = 'f' and - (dam.archive_type_id = :archive_type_id or - dam.archive_type_id is null) - order by sort_key +select + dam.metadata_id, + dam.pretty_name, + dam.data_type, + dam.required_p +from download_archive_metadata dam +where dam.repository_id = :repository_id and + dam.computed_p = 'f' and + (dam.archive_type_id = :archive_type_id or + dam.archive_type_id is null) +order by sort_key - + + - + - select - dam.metadata_id, - dam.data_type - from download_archive_metadata dam - where dam.repository_id = :repository_id and - dam.computed_p = 'f' and - (dam.archive_type_id = :archive_type_id or - dam.archive_type_id is null) - order by sort_key +select + dam.metadata_id, + dam.data_type +from download_archive_metadata dam +where dam.repository_id = :repository_id and + dam.computed_p = 'f' and + (dam.archive_type_id = :archive_type_id or + dam.archive_type_id is null) +order by sort_key - + + - + - insert into download_revision_data(revision_id, metadata_id, $answer_column) - values ( :revision_id, :metadata_id, :response ) +insert into download_revision_data +(revision_id, metadata_id, $answer_column) +values +( :revision_id, :metadata_id, :response ) - + + +