Index: openacs-4/packages/download/sql/postgresql/download-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/download/sql/postgresql/download-create.sql 14 May 2001 20:31:08 -0000 1.2 +++ openacs-4/packages/download/sql/postgresql/download-create.sql 16 May 2001 09:41:05 -0000 1.3 @@ -215,6 +215,11 @@ -- vendor (via metadata) -- owner (via metadata) +-- not sure where most of the above stuff is, +-- but I added file_size, cuz the oracle version +-- keeps content in blobs and thus can easily +-- get file_size from the database +-- vinodk 2001-05-16 create table download_archive_revisions ( revision_id integer constraint download_ar_id_fk @@ -226,10 +231,29 @@ approved_user integer constraint download_ar_usr_fk references users, - approved_comment varchar(1000) + approved_comment varchar(1000), + file_size integer + constraint download_ar_file_size_nn + not null ); +-- added table download_archive_descs - vinodk +-- Normally this table is created during content_type__create_type +-- but it only contains the primary key +-- I want it to also contain file_size, since the oracle version +-- calculates file_size in the database. +--create table download_archive_descs ( +-- archive_desc_id integer +-- constraint download_ar_desc_id_fk +-- references cr_items (item_id) on delete cascade +-- constraint download_ar_desc_id_pk +-- primary key, +-- file_size integer +-- constraint download_ar_desc_fs_nn +-- not null +--); + -- Storage of the metadata per archive -- Long skinny table. create table download_revision_data ( 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.3 -r1.4 --- openacs-4/packages/download/sql/postgresql/download-drop.sql 14 May 2001 20:31:08 -0000 1.3 +++ openacs-4/packages/download/sql/postgresql/download-drop.sql 16 May 2001 09:41:05 -0000 1.4 @@ -2,6 +2,27 @@ -- Drop the data model and the PL/SQL packages. -- +-- Views -- +drop view download_repository_obj; +drop view download_archives_obj; +drop view download_arch_revisions_obj; +drop view download_downloads_repository; + +-- Sequences -- +drop sequence download_archive_type_seq; +drop view download_archive_type_sequence; +drop sequence download_reasons_seq; +drop view download_reasons_sequence; +drop sequence download_md_choice_id_seq; +drop view download_md_choice_id_sequence; +drop sequence download_downloads_seq; +drop view download_downloads_sequence; + +-- Functions -- +drop function download_rep__new (integer,varchar,varchar,varchar,timestamp,integer,integer,integer,varchar); +drop function download_rep__edit (integer,varchar,varchar,varchar,timestamp,integer,varchar); +drop function download_rep__delete (integer); + /* Drop all content items */ create function inline_0 () @@ -14,9 +35,9 @@ where content_type in ( ''cr_download_archive_desc'', ''cr_download_archive'', ''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; +-- 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; PERFORM content_item__delete( archive_rec.item_id ); end loop; @@ -51,22 +72,6 @@ --end; --/ -/* Sequences */ -drop sequence download_archive_type_seq; -drop view download_archive_type_sequence; -drop sequence download_reasons_seq; -drop view download_reasons_sequence; -drop sequence download_md_choice_id_seq; -drop view download_md_choice_id_sequence; -drop sequence download_downloads_seq; -drop view download_downloads_sequence; - -/* Views */ -drop view download_repository_obj; -drop view download_archives_obj; -drop view download_arch_revisions_obj; -drop view download_downloads_repository; - /* Tables */ drop table download_downloads; drop table download_revision_data; @@ -165,8 +170,4 @@ --show errors -- -drop function download_rep__new (integer,varchar,varchar,varchar,timestamp,integer,integer,integer,varchar); -drop function download_rep__edit (integer,varchar,varchar,varchar,timestamp,integer,varchar); -drop function download_rep__delete (integer); - --drop package download_rep; 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.3 -r1.4 --- openacs-4/packages/download/tcl/download-procs-postgresql.xql 14 May 2001 20:31:42 -0000 1.3 +++ openacs-4/packages/download/tcl/download-procs-postgresql.xql 16 May 2001 09:41:05 -0000 1.4 @@ -61,8 +61,8 @@ :creation_ip ); - insert into download_archive_revisions (revision_id, approved_p) values - (v_revision_id, :approved_p); + insert into download_archive_revisions (revision_id, approved_p, file_size) values + (v_revision_id, :approved_p, :file_size); return v_revision_id; end; 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.2 -r1.3 --- openacs-4/packages/download/tcl/download-procs.tcl 11 May 2001 05:20:45 -0000 1.2 +++ openacs-4/packages/download/tcl/download-procs.tcl 16 May 2001 09:41:05 -0000 1.3 @@ -336,6 +336,9 @@ set filename $upload_file } + # get the file_size for the postgres version + set file_size [file size $upload_file] + set mime_type [download_maybe_create_new_mime_type $upload_file] db_exec_plsql revision_new { declare Index: openacs-4/packages/download/www/download-verify-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/download-verify-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/download/www/download-verify-oracle.xql 10 May 2001 20:51:30 -0000 1.1 +++ openacs-4/packages/download/www/download-verify-oracle.xql 16 May 2001 09:41:05 -0000 1.2 @@ -13,7 +13,7 @@ dar.revision_id, dar.file_name, dar.version_name, - dbms_lob.getlength(dar.content) as file_size + round(dbms_lob.getlength(dar.content)/1024) as file_size from download_archives_obj da, download_arch_revisions_obj dar where da.archive_id = dar.archive_id and Index: openacs-4/packages/download/www/download-verify-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/download-verify-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/download/www/download-verify-postgresql.xql 11 May 2001 05:20:45 -0000 1.2 +++ openacs-4/packages/download/www/download-verify-postgresql.xql 16 May 2001 09:41:05 -0000 1.3 @@ -13,7 +13,7 @@ dar.revision_id, dar.file_name, dar.version_name, - dar.content as content_path + dar.file_size / 1024 as file_size from download_archives_obj da, download_arch_revisions_obj dar where da.archive_id = dar.archive_id and Index: openacs-4/packages/download/www/download-verify.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/download-verify.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/download/www/download-verify.adp 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/download/www/download-verify.adp 16 May 2001 09:41:05 -0000 1.2 @@ -6,7 +6,7 @@
File Size: | -<%= [expr $file_size / 1024]%>k | +@file_size@k |