
------------------------------------------------------------------------------
-- packages/acs-content/sql/upgrade/upgrade-4.1-4.1.1.sql
--
-- @author teeters@arsdigita.com
-- @creation-date 2000-03-06
-- @cvs-id $Id: upgrade-4.1-4.1.1.sql,v 1.1.1.1 2001/03/13 22:59:26 ben Exp $
--


-- upgrade script.  Reload package acs_content.  Function new changed to procedure.
--


create or replace package acs_content 
as
    procedure new (	
	content_id	in acs_contents.content_id%TYPE	    ,
	mime_type	in acs_contents.mime_type%TYPE	    default 'text/plain',
	nls_language 	in acs_contents.nls_language%TYPE   default null,
	searchable_p	in acs_contents.searchable_p%TYPE   default 'f',
	content		in acs_contents.content%TYPE	    default empty_blob()    
    );

    procedure delete (
	content_id 	in acs_contents.content_id%TYPE
    );

    procedure update_nls_language (
	content_id	in acs_contents.content_id%TYPE default null,
	nls_language	in acs_contents.nls_language%TYPE
    );

    procedure update_mime_type (
	content_id	in acs_contents.content_id%TYPE default null,
	mime_type	in acs_contents.mime_type%TYPE
    );

    procedure update_searchable_p (
	content_id	in acs_contents.content_id%TYPE default null,
	searchable_p	in acs_contents.searchable_p%TYPE
    );

end acs_content;
/

create or replace package body acs_content 
as
    procedure new (	
	content_id	in acs_contents.content_id%TYPE,
	mime_type	in acs_contents.mime_type%TYPE default null,
	nls_language 	in acs_contents.nls_language%TYPE default null,
	searchable_p	in acs_contents.searchable_p%TYPE default 't',
	content		in acs_contents.content%TYPE	default empty_blob()    
    ) 
    is
	v_content_id	acs_contents.content_id%TYPE;
    begin
	insert into acs_contents (
	    content_id,
	    mime_type,
	    nls_language,
	    searchable_p,
	    content
	) values (
	    acs_content.new.content_id,
	    acs_content.new.mime_type,
	    acs_content.new.nls_language,
	    acs_content.new.searchable_p,
	    content
	);
    end new;	    
			
    procedure delete (
	content_id 	in acs_contents.content_id%TYPE
    ) 
    is
    begin
	delete from acs_contents 
	where content_id = acs_content.delete.content_id;
    end delete;

    -- update language column
    procedure update_nls_language (
	content_id	in acs_contents.content_id%TYPE,
	nls_language	in acs_contents.nls_language%TYPE
    ) 
    is 
    begin
	update acs_contents
	set nls_language = acs_content.update_nls_language.nls_language
	where content_id = acs_content.update_nls_language.content_id;
    end update_nls_language;

    -- update mime type column
    procedure update_mime_type (
	content_id	in acs_contents.content_id%TYPE,
	mime_type	in acs_contents.mime_type%TYPE
    ) 
    is 
    begin
	update acs_contents
	set mime_type = acs_content.update_mime_type.mime_type
	where content_id = acs_content.update_mime_type.content_id;
    end update_mime_type;

    -- update searchable p column
    procedure update_searchable_p (
	content_id	in acs_contents.content_id%TYPE,
	searchable_p	in acs_contents.searchable_p%TYPE
    )
    is
    begin
	update acs_contents
	set searchable_p = acs_content.update_searchable_p.searchable_p
	where content_id = acs_content.update_searchable_p.content_id;
    end update_searchable_p;
end acs_content;
/	

