Index: openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 1 Dec 2001 15:41:50 -0000 1.7 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 4 Apr 2002 03:00:11 -0000 1.8 @@ -1680,13 +1680,32 @@ return null; end get_parent_folder; +procedure update_last_modified ( + item_id in cr_items.item_id%TYPE, + last_modified in acs_objects.last_modified%TYPE default sysdate +) +is + v_parent_id cr_items.parent_id%TYPE; +begin + update acs_objects + set acs_objects.last_modified = content_item.update_last_modified.last_modified + where acs_objects.object_id = content_item.update_last_modified.item_id; + select cr_items.parent_id + into v_parent_id + from cr_items + where cr_items.item_id = content_item.update_last_modified.item_id; + content_item.update_last_modified(v_parent_id, content_item.update_last_modified.last_modified); + + exception when NO_DATA_FOUND then + null; +end update_last_modified; + end content_item; / show errors - -- Trigger to maintain context_id in acs_objects create or replace trigger cr_items_update_tr after update of parent_id on cr_items for each row Index: openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql 15 Nov 2001 01:47:13 -0000 1.4 +++ openacs-4/packages/acs-content-repository/sql/oracle/packages-create.sql 4 Apr 2002 03:00:11 -0000 1.5 @@ -798,6 +798,10 @@ item_id in cr_items.item_id%TYPE ) return cr_folders.folder_id%TYPE; +procedure update_last_modified ( + item_id in cr_items.item_id%TYPE, + last_modified in acs_objects.last_modified%TYPE default sysdate +); end content_item; / Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v diff -u -r1.37 -r1.38 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 10 Feb 2002 22:11:31 -0000 1.37 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 4 Apr 2002 03:00:11 -0000 1.38 @@ -931,7 +931,6 @@ return 0; end;' language 'plpgsql'; - -- function get_id create function content_item__get_id (varchar,integer,boolean) returns integer as ' @@ -2218,6 +2217,33 @@ end;' language 'plpgsql'; +-- procedure update_last_modified +create function content_item__update_last_modified (integer, timestamp) +returns integer as ' +declare + update_last_modified__item_id alias for $1; + update_last_modified__last_modified alias for $2; + v_parent_id cr_items.parent_id%TYPE; + v_last_modified acs_objects.last_modified%TYPE default now(); +begin + if update_last_modified__last_modified is not null then + v_last_modified = update_last_modified__last_modified; + end if; + + update acs_objects + set acs_objects.last_modified = v_last_modified + where acs_objects.object_id = update_last_modified__item_id; + + select cr_items.parent_id + into v_parent_id + from cr_items + where cr_items.item_id = update_last_modified__item_id; + + content_item__update_last_modified(v_parent_id, v_last_modified); + + return 0; +end;' language 'plpgsql'; + -- show errors Index: openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql 30 Mar 2001 05:31:33 -0000 1.2 +++ openacs-4/packages/acs-content-repository/sql/postgresql/packages-create.sql 4 Apr 2002 03:00:11 -0000 1.3 @@ -795,6 +795,10 @@ -- item_id in cr_items.item_id%TYPE -- ) return cr_folders.folder_id%TYPE; -- +-- procedure update_last_modified ( +-- item_id in cr_items.item_id%TYPE, +-- last_modified in acs_objects.last_modified%TYPE default sysdate +-- ); -- -- end content_item;