Index: openacs-4/contrib/obsolete-packages/acs-workflow/acs-workflow.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/acs-workflow.info,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/obsolete-packages/acs-workflow/acs-workflow.info 29 Apr 2001 02:18:33 -0000 1.5 +++ openacs-4/contrib/obsolete-packages/acs-workflow/acs-workflow.info 3 May 2001 04:00:49 -0000 1.6 @@ -42,23 +42,19 @@ - - - - @@ -73,21 +69,37 @@ + + + + + + + + + + + + + + + + @@ -96,70 +108,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -186,22 +246,38 @@ + + + + + + + + + + + + + + + + @@ -288,14 +364,14 @@ - - - - - - - + + + + + + + Index: openacs-4/packages/acs-content-repository/acs-content-repository.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/acs-content-repository.info 27 Apr 2001 02:27:09 -0000 1.3 +++ openacs-4/packages/acs-content-repository/acs-content-repository.info 3 May 2001 04:00:49 -0000 1.4 @@ -83,15 +83,16 @@ - + + - - + - + + Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 1 May 2001 04:37:49 -0000 1.14 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 3 May 2001 04:00:49 -0000 1.15 @@ -397,7 +397,7 @@ nls_language varchar(50), storage_type varchar(10) not null, -- lob_id if storage_type = lob. - lob integer, + lob integer references lobs, -- content holds the file name if storage type = file -- otherwise it holds the text data if storage_type = text. content text, @@ -415,10 +415,7 @@ from cr_items where item_id = new.item_id; - if (v_storage_type <> new.storage_type) or - (v_storage_type = ''lob'' and new.lob is null) or - ((v_storage_type = ''text'' or v_storage_type = ''file'') and - new.content is null) then + if v_storage_type <> new.storage_type then raise EXCEPTION ''Invalid storage type: % for revision_id = %'', new.storage_type, new.revision_id; Index: openacs-4/packages/acs-content-repository/tcl/content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-content-repository/tcl/content-procs.tcl 1 May 2001 04:37:49 -0000 1.2 +++ openacs-4/packages/acs-content-repository/tcl/content-procs.tcl 3 May 2001 04:00:49 -0000 1.3 @@ -49,13 +49,15 @@ return $content_file } -proc cr_create_content_lob { client_filename } { +proc cr_create_content_lob { lob_id client_filename } { - set lob_id [db_string new_lob_id "select empty_lob()"] - db_with_handle db { - ns_pg blob_dml_file $db $lob_id $client_filename + db_transaction { + + db_with_handle db { + ns_pg blob_dml_file $db $lob_id $client_filename + } } - return $lob_id + return 0 } Index: openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 27 Apr 2001 02:27:09 -0000 1.1 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 3 May 2001 04:00:49 -0000 1.2 @@ -19,14 +19,12 @@ - FIXME: need to handle this blob update cr_revisions set - content = empty_lob() + content = '[cr_create_content_file $item_id $revision_id $path]' where revision_id = :revision_id - returning content into :1 Index: openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 27 Apr 2001 02:27:09 -0000 1.2 +++ openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 3 May 2001 04:00:49 -0000 1.3 @@ -8,7 +8,7 @@ v_content => null); end;"] - dml_file dml_revision_from_file "update + db_dml dml_revision_from_file "update cr_revisions set content = empty_blob() Index: openacs-4/packages/acs-subsite/www/shared/portrait-bits-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/Attic/portrait-bits-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/shared/portrait-bits-postgresql.xql 1 May 2001 04:37:49 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/shared/portrait-bits-postgresql.xql 3 May 2001 04:00:49 -0000 1.3 @@ -5,7 +5,7 @@ - select '[cr_fs_path]' || content + select lob from cr_revisions where revision_id = :revision_id Index: openacs-4/packages/acs-subsite/www/user/portrait/upload-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/Attic/upload-2-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/user/portrait/upload-2-postgresql.xql 30 Apr 2001 05:33:14 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/user/portrait/upload-2-postgresql.xql 3 May 2001 04:00:49 -0000 1.2 @@ -20,8 +20,7 @@ null, 'text/plain', null, - null, - 'file' + null ) @@ -45,6 +44,7 @@ + @@ -58,7 +58,7 @@ now(), :guessed_file_type, null, - 'not_important', + null, :item_id, null, now(), @@ -81,7 +81,7 @@ update cr_revisions - set content = '[cr_create_content_file $item_id $revision_id $tmp_filename]' + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] where revision_id = :revision_id Index: openacs-4/packages/acs-subsite/www/user/portrait/upload-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/Attic/upload-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/user/portrait/upload-2.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/user/portrait/upload-2.tcl 3 May 2001 04:00:49 -0000 1.2 @@ -163,18 +163,20 @@ } } else { # it's merely an update - db_dml update_photo $update_photo -blob_files [list $tmp_filename] - db_dml update_image_info " - update images - set width = :original_width, height = :original_height - where image_id = :revision_id" - db_dml update_photo_info " - update cr_revisions - set description = :portrait_comment, - publish_date = sysdate, - mime_type = :guessed_file_type, - title = :title - where revision_id = :revision_id" + db_transaction { + db_dml update_photo $update_photo -blob_files [list $tmp_filename] + db_dml update_image_info " + update images + set width = :original_width, height = :original_height + where image_id = :revision_id" + db_dml update_photo_info " + update cr_revisions + set description = :portrait_comment, + publish_date = sysdate, + mime_type = :guessed_file_type, + title = :title + where revision_id = :revision_id" + } } } Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs-postgresql.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 1 May 2001 04:37:49 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl 3 May 2001 04:00:49 -0000 1.8 @@ -246,8 +246,21 @@ # Query Dispatcher (OpenACS - ben) set full_statement_name [db_qd_get_fullname $statement_name] - db_with_handle db { - db_exec dml $db $full_statement_name $sql + if {[info exists blob_files]} { + + db_with_handle db { + db_exec dml $db $full_statement_name $sql + if {[uplevel {info exists __lob_id}]} { + ns_pg blob_dml_file $db [uplevel {set __lob_id}] $blob_files + uplevel {unset __lob_id} + } + } + + } else { + + db_with_handle db { + db_exec dml $db $full_statement_name $sql + } } } @@ -283,16 +296,20 @@ ad_proc db_write_blob { statement_name sql args } { ad_arg_parser { bind } $args + set full_statement_name [db_qd_get_fullname $statement_name] + db_with_handle db { - db_exec_lob write_blob $db $statement_name $sql + db_exec_lob write_blob $db $full_statement_name $sql } } ad_proc db_blob_get_file { statement_name sql args } { ad_arg_parser { bind file args } $args + set full_statement_name [db_qd_get_fullname $statement_name] + db_with_handle db { - db_exec_lob blob_select_file $db $statement_name $sql $file + db_exec_lob blob_select_file $db $full_statement_name $sql $file } } @@ -347,6 +364,7 @@ switch $type { blob_select_file { + if {[regexp {^[0-9]+$} $val match]} { ns_pg blob_select_file $db $val $file } else { @@ -359,14 +377,14 @@ # this is an ugly hack, but it allows content to be written # to the connection if it is stored as a lob or if it is # stored in the content-repository as a file. (DanW - Openacs) - if {[file exists [cr_fs_path]$val]} { - set ofp [open [cr_fs_path]$val r] + if {[file exists $val]} { + set ofp [open $val r] ns_writefp $ofp close $ofp } elseif {[regexp {^[0-9]+$} $val match]} { ns_pg blob_write $db $val } else { - error "file: [cr_fs_path]$val doesn't exist" + error "file: $val doesn't exist" } } }