Index: openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql,v diff -u -r1.49 -r1.50 --- openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql 23 Mar 2010 16:21:05 -0000 1.49 +++ openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql 23 Mar 2010 21:53:49 -0000 1.50 @@ -972,6 +972,8 @@ default 'instance', description in apm_parameters.description%TYPE default null, + scope in apm_parameters.scope%TYPE + default 'instance', datatype in apm_parameters.datatype%TYPE default 'string', default_value in apm_parameters.default_value%TYPE @@ -1547,10 +1549,10 @@ default null, package_key in apm_parameters.package_key%TYPE, parameter_name in apm_parameters.parameter_name%TYPE, - scope in apm_parameters.scope%TYPE - default 'instance', description in apm_parameters.description%TYPE default null, + scope in apm_parameters.scope%TYPE + default 'instance', datatype in apm_parameters.datatype%TYPE default 'string', default_value in apm_parameters.default_value%TYPE @@ -1574,13 +1576,13 @@ ); insert into apm_parameters - (parameter_id, parameter_name, description, package_key, datatype, + (parameter_id, parameter_name, description, package_key, datatype, scope, default_value, section_name, min_n_values, max_n_values) values (v_parameter_id, register_parameter.parameter_name, register_parameter.description, - register_parameter.package_key, register_parameter.datatype, + register_parameter.package_key, register_parameter.datatype, register_parameter.scope, register_parameter.default_value, register_parameter.section_name, - register_parameter.min_n_values, register_parameter.max_n_values); + register_parameter.min_n_values, register_parameter.max_n_values); -- Propagate parameter to new instances. if register_parameter.scope = 'instance' then for pkg in (select package_id from apm_packages where package_key = register_parameter.package_key) Index: openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.6.0d6-5.6.0d7.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.6.0d6-5.6.0d7.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.6.0d6-5.6.0d7.sql 22 Mar 2010 23:17:31 -0000 1.2 +++ openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.6.0d6-5.6.0d7.sql 23 Mar 2010 21:53:49 -0000 1.3 @@ -118,6 +118,8 @@ default 'instance', description in apm_parameters.description%TYPE default null, + scope in apm_parameters.scope%TYPE + default 'instance', datatype in apm_parameters.datatype%TYPE default 'string', default_value in apm_parameters.default_value%TYPE @@ -195,7 +197,6 @@ / show errors - create or replace package body apm as procedure register_package ( @@ -400,10 +401,10 @@ default null, package_key in apm_parameters.package_key%TYPE, parameter_name in apm_parameters.parameter_name%TYPE, - scope in apm_parameters.scope%TYPE - default 'instance', description in apm_parameters.description%TYPE default null, + scope in apm_parameters.scope%TYPE + default 'instance', datatype in apm_parameters.datatype%TYPE default 'string', default_value in apm_parameters.default_value%TYPE @@ -427,13 +428,13 @@ ); insert into apm_parameters - (parameter_id, parameter_name, description, package_key, datatype, + (parameter_id, parameter_name, description, package_key, datatype, scope, default_value, section_name, min_n_values, max_n_values) values (v_parameter_id, register_parameter.parameter_name, register_parameter.description, - register_parameter.package_key, register_parameter.datatype, + register_parameter.package_key, register_parameter.datatype, register_parameter.scope, register_parameter.default_value, register_parameter.section_name, - register_parameter.min_n_values, register_parameter.max_n_values); + register_parameter.min_n_values, register_parameter.max_n_values); -- Propagate parameter to new instances. if register_parameter.scope = 'instance' then for pkg in (select package_id from apm_packages where package_key = register_parameter.package_key) @@ -612,6 +613,7 @@ where parameter_id = set_value.parameter_id and package_id = null; + exception when NO_DATA_FOUND then @@ -643,6 +645,7 @@ where parameter_id = set_value.parameter_id and package_id = set_value.package_id; + exception when NO_DATA_FOUND then Index: openacs-4/packages/acs-kernel/sql/postgresql/apm-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/apm-create.sql,v diff -u -r1.70 -r1.71 --- openacs-4/packages/acs-kernel/sql/postgresql/apm-create.sql 10 Mar 2010 00:44:03 -0000 1.70 +++ openacs-4/packages/acs-kernel/sql/postgresql/apm-create.sql 23 Mar 2010 21:53:49 -0000 1.71 @@ -1339,8 +1339,8 @@ register_parameter__parameter_id alias for $1; -- default null register_parameter__package_key alias for $2; register_parameter__parameter_name alias for $3; - register_parameter__scope alias for $4; - register_parameter__description alias for $5; -- default null + register_parameter__description alias for $4; -- default null + register_parameter__scope alias for $5; register_parameter__datatype alias for $6; -- default ''string'' register_parameter__default_value alias for $7; -- default null register_parameter__section_name alias for $8; -- default null @@ -1376,18 +1376,20 @@ register_parameter__max_n_values); -- Propagate parameter to new instances. - for v_pkg in - select package_id - from apm_packages - where package_key = register_parameter__package_key - loop - v_value_id := apm_parameter_value__new( - null, - v_pkg.package_id, - v_parameter_id, - register_parameter__default_value - ); - end loop; + if register_parameter__scope = ''instance'' then + for v_pkg in + select package_id + from apm_packages + where package_key = register_parameter__package_key + loop + v_value_id := apm_parameter_value__new( + null, + v_pkg.package_id, + v_parameter_id, + register_parameter__default_value + ); + end loop; + end if; return v_parameter_id; @@ -1411,8 +1413,8 @@ begin return apm__register_parameter(register_parameter__parameter_id, register_parameter__package_key, - register_parameter__parameter_name, ''instance'', - register_parameter__description, register_parameter__datatype, + register_parameter__parameter_name, register_parameter__description, + ''instance'', register_parameter__datatype, register_parameter__default_value, register_parameter__section_name, register_parameter__min_n_values, register_parameter__max_n_values); end;' language 'plpgsql'; @@ -1484,41 +1486,6 @@ return 0; end;' language 'plpgsql'; - --- function id_for_name -create or replace function apm__id_for_name (varchar,varchar) -returns integer as ' -declare - id_for_name__parameter_name alias for $1; - id_for_name__package_key alias for $2; - a_parameter_id apm_parameters.parameter_id%TYPE; -begin - select parameter_id into a_parameter_id - from apm_parameters p - where p.parameter_name = id_for_name__parameter_name and - p.package_key = id_for_name__package_key; - - return a_parameter_id; - -end;' language 'plpgsql' stable strict; - - --- function get_value -create or replace function apm__get_value (integer,integer) -returns varchar as ' -declare - get_value__parameter_id alias for $1; - get_value__package_id alias for $2; - value apm_parameter_values.attr_value%TYPE; -begin - select attr_value into value from apm_parameter_values v - where v.package_id = get_value__package_id - and parameter_id = get_value__parameter_id; - - return value; - -end;' language 'plpgsql' stable strict; - create or replace function apm__id_for_name (integer,varchar) returns integer as ' declare Index: openacs-4/packages/acs-kernel/sql/postgresql/apm-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/apm-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-kernel/sql/postgresql/apm-drop.sql 17 May 2003 01:47:10 -0000 1.3 +++ openacs-4/packages/acs-kernel/sql/postgresql/apm-drop.sql 23 Mar 2010 21:53:49 -0000 1.4 @@ -74,11 +74,12 @@ drop function apm__update_parameter (integer,varchar,varchar,varchar,varchar,varchar,integer,integer); drop function apm__parameter_p (varchar,varchar); drop function apm__unregister_parameter (integer); +drop function apm__id_for_name (integer,varchar); drop function apm__id_for_name (varchar,varchar); -drop function apm__get_value (integer,integer); +drop function apm__get_value (varchar,varchar); drop function apm__get_value (integer,varchar); -drop function apm__set_value (integer,integer,varchar); drop function apm__set_value (integer,varchar,varchar); +drop function apm__set_value (varchar,varchar,varchar); drop function apm_package__initialize_parameters (integer,varchar); drop function apm_package__new (integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer); drop function apm_package__delete (integer);