Index: openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql 13 Mar 2002 22:50:53 -0000 1.4 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-objects-create.sql 25 May 2002 14:00:34 -0000 1.5 @@ -409,6 +409,11 @@ object_id in acs_objects.object_id%TYPE ) return char; + procedure update_last_modified ( + object_id in acs_objects.object_id%TYPE, + last_modified in acs_objects.last_modified%TYPE default sysdate + ); + end acs_object; / show errors @@ -1011,6 +1016,24 @@ return result; end check_representation; + procedure update_last_modified ( + object_id in acs_objects.object_id%TYPE, + last_modified in acs_objects.last_modified%TYPE default sysdate + ) + is + v_parent_id acs_objects.context_id%TYPE; + begin + update acs_objects + set acs_objects.last_modified = acs_object.update_last_modified.last_modified + where acs_objects.object_id = acs_object.update_last_modified.object_id + returning acs_objects.context_id + into v_parent_id; + + if v_parent_id is not null and v_parent_id != 0 then + acs_object.update_last_modified(v_parent_id, acs_object.update_last_modified.last_modified); + end if; + end update_last_modified; + end acs_object; / show errors Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql,v diff -u -N -r1.30 -r1.31 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql 13 Mar 2002 22:50:53 -0000 1.30 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql 25 May 2002 14:00:34 -0000 1.31 @@ -1333,8 +1333,36 @@ end;' language 'plpgsql'; +create function acs_object__update_last_modified (integer, timestamp) +returns integer as ' +declare + acs_object__update_last_modified__object_id alias for $1; + acs_object__update_last_modified__last_modified alias for $2; -- default now() + v_parent_id acs_objects.context_id%TYPE; + v_last_modified timestamp; +begin + if acs_object__update_last_modified__last_modified is null then + v_last_modified := now(); + else + v_last_modified := acs_object__update_last_modified__last_modified; + end if; + update acs_objects + set acs_objects.last_modified = v_last_modified + where acs_objects.object_id = acs_object__update_last_modified__object_id; + select acs_objects.context_id + into v_parent_id + from acs_objects + where acs_objects.object_id = acs_object__update_last_modified__object_id; + + if v_parent_id is not null and v_parent_id != 0 then + select acs_object__update_last_modified(v_parent_id); + end if; + + return acs_object__update_last_modified__object_id; +end;' language 'plpgsql'; + -- show errors -------------------