Index: openacs-4/packages/acs-subsite/acs-subsite.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/acs-subsite.info,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-subsite/acs-subsite.info 3 May 2001 01:03:50 -0000 1.7 +++ openacs-4/packages/acs-subsite/acs-subsite.info 6 May 2001 21:39:13 -0000 1.8 @@ -57,17 +57,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,146 @@ + + + + oracle8.1.6 + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and element_id = :party_id + union all + select 1 + from application_groups + where package_id = :package_id + and group_id = :party_id + ) then 1 else 0 end + from dual + + + + + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and element_id = :party_id + union all + select 1 + from application_groups + where package_id = :package_id + and group_id = :party_id + ) then 1 else 0 end + from dual + + + + + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and rel_id = :rel_id + ) then 1 else 0 end + from dual + + + + + + + + + select case when exists ( + select 1 + from application_group_segments + where package_id = :package_id + and segment_id = :segment_id + ) then 1 else 0 end + from dual + + + + + + + + + begin + :1 := application_group.group_id_from_package_id ( + package_id => :package_id, + no_complain_p => :no_complain_p + ); + end; + + + + + + + + + select ag.group_id as parent_group_id + from application_groups ag, + apm_packages, + (select object_id, rownum as tree_rownum + from site_nodes + start with node_id = :node_id + connect by node_id = prior parent_id) nodes + where nodes.object_id = apm_packages.package_id + and apm_packages.package_id = ag.package_id + and rownum=1 + + + + + + + + + begin + :1 := application_group.new ( + group_id => :group_id, + object_type => :group_type, + group_name => :group_name, + package_id => :package_id, + context_id => :context_id, + creation_user => :creation_user, + creation_ip => :creation_ip, + email => :email, + url => :url + ); + end; + + + + + + + + + begin + :1 := composition_rel.new ( + rel_type => 'composition_rel', + object_id_one => :parent_group_id, + object_id_two => :group_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,146 @@ + + + + postgresql7.1 + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and element_id = :party_id + union all + select 1 + from application_groups + where package_id = :package_id + and group_id = :party_id + ) then 1 else 0 end + + + + + + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and element_id = :party_id + union all + select 1 + from application_groups + where package_id = :package_id + and group_id = :party_id + ) then 1 else 0 end + + + + + + + + + + select case when exists ( + select 1 + from application_group_element_map + where package_id = :package_id + and rel_id = :rel_id + ) then 1 else 0 end + + + + + + + + + + select case when exists ( + select 1 + from application_group_segments + where package_id = :package_id + and segment_id = :segment_id + ) then 1 else 0 end + + + + + + + + +-- FIX ME PLSQL +-- begin + select application_group__group_id_from_package_id ( + :package_id, -- package_id + :no_complain_p -- no_complain_p + ); +-- end; + + + + + + + +-- FIX ME ROWNUM + select ag__group_id as parent_group_id + from application_groups ag, + apm_packages, + (select object_id, rownum as tree_rownum + from site_nodes + start with node_id = :node_id + connect by node_id = prior parent_id) nodes + where nodes__object_id = apm_packages.package_id + and apm_packages.package_id = ag.package_id + limit 1 + + + + + + + +-- FIX ME PLSQL +-- begin + select application_group_new ( + :group_id, -- group_id + :group_type, -- object_type + :group_name, -- group_name + :package_id, -- package_id + :context_id, -- context_id + :creation_user, -- creation_user + :creation_ip, -- creation_ip + :email, -- email + :url -- url + ); +-- end; + + + + + + + +-- FIX ME PLSQL +-- begin + select composition_rel__new ( + 'composition_rel', -- rel_type + :parent_group_id, -- object_id_one + :group_id, -- object_id_two + :creation_user, -- creation_user + :creation_ip -- creation_ip + ); +-- end; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/application-group-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/application-group-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + + select substr(instance_name from 1 for 90) + from apm_packages + where package_id = :package_id + + + + + + Index: openacs-4/packages/acs-subsite/tcl/attribute-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,38 @@ + + + + oracle8.1.6 + + + + + select case when exists (select 1 + from acs_attributes a, acs_object_types t + where t.dynamic_p = 't' + and a.object_type = t.object_type + and a.attribute_id = :value) + then 1 else 0 end + from dual + + + + + + + + + select case when exists (select 1 + from acs_attributes a + where (a.attribute_name = :attribute + or a.column_name = :attribute) + and a.object_type = :object_type) + then 1 + else 0 + end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/attribute-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,38 @@ + + + + postgresql7.1 + + + + + select case when exists (select 1 + from acs_attributes a, acs_object_types t + where t.dynamic_p = 't' + and a.object_type = t.object_type + and a.attribute_id = :value) + then 1 else 0 end + + + + + + + + + + select case when exists (select 1 + from acs_attributes a + where (a.attribute_name = :attribute + or a.column_name = :attribute) + and a.object_type = :object_type) + then 1 + else 0 + end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/attribute-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,129 @@ + + + + + + + select t.table_name + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select a.attribute_id + from acs_attributes a + where a.object_type = :object_type + and a.attribute_name = :attribute_name + + + + + + + +-- FIX ME DECODE (USE SQL92 CASE) + select a.object_type, a.attribute_name, + decode(a.storage,'type_specific',t.table_name,a.table_name) as table_name, + coalesce(a.column_name, a.attribute_name) as column_name + from acs_attributes a, acs_object_types t + where a.attribute_id = :attribute_id + and t.object_type = a.object_type + + + + + + + + + select v.sort_order as old_sort_order + from acs_enum_values v + where v.attribute_id = :attribute_id + and v.enum_value = :enum_value + + + + + + + + + delete from acs_enum_values v + where v.attribute_id = :attribute_id + and v.enum_value = :enum_value + + + + + + + + + update acs_enum_values v + set v.sort_order = v.sort_order - 1 + where v.attribute_id = :attribute_id + and v.sort_order > :old_sort_order + + + + + + + + FIX ME OUTER JOIN + select coalesce(a.column_name, a.attribute_name) as name, + a.pretty_name, a.attribute_id, a.datatype, + v.enum_value, v.pretty_name as value_pretty_name + from acs_object_type_attributes a, + acs_enum_values v, + (select t.object_type, level as type_level + from acs_object_types t + start with t.object_type = :start_with + connect by prior t.object_type = t.supertype) t + where a.object_type = :object_type + and a.attribute_id = v.attribute_id(+) + and t.object_type = a.ancestor_type $storage_clause + order by type_level, a.sort_order + + + + + + + + + select object_type from acs_objects where object_id = :object_id + + + + + + + + + select * + from ($package_object_view) + where object_id = :object_id + + + + + + + + + select enum.pretty_name, enum.enum_value + from acs_enum_values enum + where enum.attribute_id = :attribute_id + order by enum.sort_order + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,42 @@ + + + + oracle8.1.6 + + + + + begin + :1 := ${group_type}.new (group_name => 'Editor'); + end; + + + + + + + + + BEGIN + -- the acs_group package takes care of segments referred + -- to by rel_constraints.rel_segment. We delete the ones + -- references by rel_constraints.required_rel_segment here. + + for row in (select cons.constraint_id + from rel_constraints cons, rel_segments segs + where segs.segment_id = cons.required_rel_segment + and segs.group_id = :group_id) loop + + rel_segment.delete(row.constraint_id); + + end loop; + + -- delete the actual group + ${package_name}.delete(:group_id); + END; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,44 @@ + + + + postgresql7.1 + + + +-- FIX ME PLSQL +-- begin + select ${group_type}__new ( + 'Editor' -- group_name + ); +-- end; + + + + + + + +-- FIX ME PLSQL +-- BEGIN + -- the acs_group package takes care of segments referred + -- to by rel_constraints.rel_segment. We delete the ones + -- references by rel_constraints.required_rel_segment here. + + for row in (select cons.constraint_id + from rel_constraints cons, rel_segments segs + where segs.segment_id = cons.required_rel_segment + and segs.group_id = :group_id) loop + + rel_segment.delete(row.constraint_id); + + end loop; + + -- delete the actual group + ${package_name}.delete(:group_id); +-- END; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/group-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,35 @@ + + + + + + + select t.package_name, lower(t.id_column) as id_column + from acs_object_types t + where t.object_type = :group_type + + + + + + + + + select t.package_name, lower(t.id_column) as id_column + from acs_object_types t + where t.object_type = :group_type + + + + + + + + + select join_policy from groups where group_id = :group_id + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-type-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-type-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-type-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + + select case when exists (select 1 + from acs_objects o + where acs_permission.permission_p(o.object_id, :user_id, 'delete') = 'f' + and o.object_type = :group_type) + then 0 else 1 end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-type-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-type-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-type-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + + select case when exists (select 1 + from acs_objects o + where acs_permission__permission_p(o.object_id, :user_id, 'delete') = 'f' + and o.object_type = :group_type) + then 0 else 1 end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/group-type-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-type-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/group-type-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,25 @@ + + + + + + + select upper(id_column) from acs_object_types where object_type='group' + + + + + + + + + select t.table_name as references_table, + t.id_column as references_column + from acs_object_types t + where t.object_type = :supertype + + + + + + Index: openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,72 @@ + + + + oracle8.1.6 + + + + + select case when exists (select 1 + from acs_object_types t + where t.dynamic_p = 't' + and t.object_type = :object_type) + then 1 else 0 end + from dual + + + + + + + + + select case when exists (select 1 + from user_objects + where status = 'INVALID' + and object_name = upper(:package_name) + and object_type = upper(:type)) + then 0 else 1 end + from dual + + + + + + + + + select acs_object.name(:user_id) as author, + sysdate as creation_date + from dual + + + + + + + + + select acs_object.name(:user_id) as author, + sysdate as creation_date + from dual + + + + + + + + + BEGIN + :1 := ${package_name}.new([plsql_utility::generate_attribute_parameter_call \ + -prepend ":" \ + -indent [expr [string length $package_name] + 29] \ + $pieces] + ); + END; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,72 @@ + + + + postgresql7.1 + + + + + select case when exists (select 1 + from acs_object_types t + where t.dynamic_p = 't' + and t.object_type = :object_type) + then 1 else 0 end + + + + + + + + + + select case when exists (select 1 + from user_objects + where status = 'INVALID' + and object_name = upper(:package_name) + and object_type = upper(:type)) + then 0 else 1 end + + + + + + + + + + select acs_object.name(:user_id) as author, + current_time as creation_date + + + + + + + + + + select acs_object.name(:user_id) as author, + current_time as creation_date + + + + + + + + +-- FIX ME PLSQL +-- BEGIN + select ${package_name}__new([plsql_utility::generate_attribute_parameter_call \ + -prepend ":" \ + -indent [expr [string length $package_name] + 29] \ + $pieces] + ); +-- END; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/package-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/package-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,205 @@ + + + + + + + select t.table_name as table, t.id_column as column + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select upper(coalesce(attr.table_name,t.table_name)) as attr_table_name, + upper(coalesce(attr.column_name, attr.attribute_name)) as attr_column_name, + attr.ancestor_type, attr.min_n_values, attr.default_value + from acs_object_type_attributes attr, + (select t.object_type, t.table_name, level as type_level + from acs_object_types t + start with t.object_type = :object_type + connect by prior t.supertype = t.object_type) t + where attr.ancestor_type = t.object_type + and attr.object_type = :object_type + order by t.type_level + + + + + + + + + select t.object_type + from acs_object_types t + where t.dynamic_p = 't' + start with t.object_type = :object_type + connect by prior t.object_type = t.supertype + + + + + + + + + select t.package_name + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select t.table_name, t.id_column, lower(t.package_name) as package_name, t.supertype + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select t.table_name, t.id_column, lower(t.package_name) as package_name, t.supertype + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select t.table_name, t.id_column, lower(t.package_name) as package_name, t.supertype + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select args.argument_name + from user_arguments args + where args.package_name =upper(:supertype_package_name) + and args.object_name='NEW' + + + + + + + + + select t.object_type as ancestor_type + from acs_object_types t + start with t.object_type = :object_type + connect by prior t.supertype = t.object_type + + + + + + + + + select t.object_type as sub_type + from acs_object_types t + start with t.object_type = :object_type + connect by prior t.object_type = t.supertype + + + + + + + + + select t.table_name, t.id_column, lower(t.package_name) as package_name, t.supertype + from acs_object_types t + where t.object_type = :object_type + + + + + + + +-- FIX ME DECODE (USE SQL92 CASE) + select a.attribute_id, + coalesce(a.table_name, t.table_name) as table_name, + coalesce(a.column_name, a.attribute_name) as attribute_name, + a.pretty_name, + a.datatype, + decode(a.min_n_values,0,'f','t') as required_p, + a.default_value, + t.table_name as object_type_table_name, + t.id_column as object_type_id_column + from acs_object_type_attributes a, + (select t.object_type, t.table_name, t.id_column, level as type_level + from acs_object_types t + start with t.object_type=:start_with + connect by prior t.object_type = t.supertype) t + where a.object_type = :object_type + and t.object_type = a.ancestor_type $storage_clause + order by type_level + + + + + + + + select t.table_name, t.id_column, lower(t.package_name) as package_name, t.supertype + from acs_object_types t + where t.object_type = :object_type + + + + + + + + + select cols.table_name, cols.column_name + from user_tab_columns cols, + (select upper(t.table_name) as table_name + from acs_object_types t + start with t.object_type = :object_type + connect by prior t.supertype = t.object_type) t + where cols.column_name in + (select args.argument_name + from user_arguments args + where args.position > 0 + and args.object_name = upper(:object_name) + and args.package_name = upper(:package_name)) + and cols.table_name = t.table_name + + + + + + + + + select t.package_name + from acs_object_types t + where t.object_type = :object_type + + + + + + Index: openacs-4/packages/acs-subsite/tcl/party-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/party-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/party-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + begin + :1 := ${party_type}.new (email => 'joe@foo.com'); + end; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/party-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/party-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/party-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,19 @@ + + + + postgresql7.1 + + + +-- FIX ME PLSQL +-- begin + select ${party_type}__new ( + 'joe@foo.com' -- email + ); +-- end; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/party-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/party-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/party-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,50 @@ + + + + + + + select t.package_name, lower(t.id_column) as id_column + from acs_object_types t + where t.object_type = :party_type + + + + + + + +-- FIX ME DECODE (USE SQL92 CASE) + select + types.pretty_name, + types.object_type, + types.tree_level, + types.indent, + decode(valid_types.object_type, null, 0, 1) as valid_p + from + (select + t.pretty_name, t.object_type, level as tree_level, + replace(lpad(' ', (level - 1) * 4), + ' ', ' ') as indent, + rownum as tree_rownum + from + acs_object_types t + connect by + prior t.object_type = t.supertype + start with + $start_with_clause ) types, + (select + object_type + from + rel_types_valid_obj_two_types + where + rel_type = :rel_type ) valid_types + where + types.object_type = valid_types.object_type(+) + order by tree_rownum + + + + + + Index: openacs-4/packages/acs-subsite/tcl/plsql-utility-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/plsql-utility-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/plsql-utility-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,19 @@ + + + + oracle8.1.6 + + + + + select case when exists (select 1 from acs_object_types where object_type=:object_type) + then 1 + else 0 + end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/plsql-utility-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/plsql-utility-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/plsql-utility-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,19 @@ + + + + postgresql7.1 + + + + + select case when exists (select 1 from acs_object_types where object_type=:object_type) + then 1 + else 0 + end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,42 @@ + + + + oracle8.1.6 + + + + + declare + begin + :1 := rel_segment.new(segment_name => :segment_name, + group_id => :group_id, + context_id => :context_id, + rel_type => :rel_type, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + + + + begin rel_segment.delete(:constraint_id); end; + + + + + + + + + begin rel_segment.delete(:segment_id); end; + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,43 @@ + + + + postgresql7.1 + + + +-- FIX ME PLSQL +-- declare +-- begin + select rel_segment__new( + :segment_name, -- segment_name + :group_id, -- group_id + :context_id, -- context_id + :rel_type, -- rel_type + :creation_user, -- creation_user + :creation_ip -- creation_ip + ); +-- end; + + + + + + + +-- FIX ME PLSQL + select rel_segment__delete(:constraint_id); + + + + + + + +-- FIX ME PLSQL + select rel_segment__delete(:segment_id); + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + + select c.constraint_id + from rel_constraints c + where c.required_rel_segment = :segment_id + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + + select case when exists (select 1 + from acs_object_types t + where t.dynamic_p = 't' + and t.object_type = :value) + then 1 else 0 end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + + select case when exists (select 1 + from acs_object_types t + where t.dynamic_p = 't' + and t.object_type = :value) + then 1 else 0 end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/rel-types-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + + select table_name as references_table, + id_column as references_column + from acs_object_types + where object_type=:supertype + + + + + + Index: openacs-4/packages/acs-subsite/tcl/relation-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/relation-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,41 @@ + + + + oracle8.1.6 + + + + + select rel_constraint.violation(:rel_id) from dual + + + + + + + + + select case when exists + (select 1 from rc_violations_by_removing_rel r where r.rel_id = :rel_id) + then 1 else 0 end + from dual + + + + + + + + + select case when exists + (select 1 from rc_valid_rel_types r + where r.group_id = :group_id + and r.rel_type = :rel_type) + then 1 else 0 end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,41 @@ + + + + postgresql7.1 + + + + + select rel_constraint__violation(:rel_id) + + + + + + + + + select case when exists + (select 1 from rc_violations_by_removing_rel r where r.rel_id = :rel_id) + then 1 else 0 end + + + + + + + + + + select case when exists + (select 1 from rc_valid_rel_types r + where r.group_id = :group_id + and r.rel_type = :rel_type) + then 1 else 0 end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/relation-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/relation-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,101 @@ + + + + + + FIX ME OUTER JOIN + select s.segment_id, r.object_id_two as party_id, t.package_name + from rel_segments s, acs_rels r, acs_object_types t + where r.object_id_one = s.group_id(+) + and r.rel_type = s.rel_type(+) + and r.rel_type = t.object_type + and r.rel_id = :rel_id + + + + + + + +-- FIX ME + select ${package_name}__delete(:rel_id); + + + + + + + FIX ME OUTER JOIN + select s.segment_id, r.object_id_two as party_id, t.package_name + from rel_segments s, acs_rels r, acs_object_types t + where r.object_id_one = s.group_id(+) + and r.rel_type = s.rel_type(+) + and r.rel_type = t.object_type + and r.rel_id = :rel_id + + + + + + + +-- FIX ME DECODE (USE SQL92 CASE) + select + pretty_name, object_type, level, indent, + decode(valid_types.rel_type, null, 0, 1) as valid_p + from + (select + t.pretty_name, t.object_type, level, + replace(lpad(' ', (level - 1) * 4), + ' ', ' ') as indent, + rownum as tree_rownum + from + acs_object_types t + connect by + prior t.object_type = t.supertype + start with + t.object_type = :start_with ) types, + (select + rel_type + from + rc_valid_rel_types + where + group_id = :group_id ) valid_types + where + types.object_type = valid_types.rel_type(+) + order by tree_rownum + + + + + + + + FIX ME OUTER JOIN + select distinct s.segment_id, s.group_id, s.rel_type, + g.group_name, g.join_policy, t.pretty_name as rel_type_pretty_name, + coalesce(dl.dependency_level, 0) + from rc_all_constraints c, + (select rel_segment, required_rel_segment + from rc_segment_required_seg_map + where rel_side = 'two' + UNION ALL + select segment_id, segment_id + from rel_segments) map, + rel_segments s, + rc_segment_dependency_levels dl, + groups g, acs_object_types t + where c.group_id = :group_id + and c.rel_type = :rel_type + and c.required_rel_segment = map.rel_segment + and map.required_rel_segment = s.segment_id + and s.segment_id = dl.segment_id(+) + and g.group_id = s.group_id + and t.object_type = s.rel_type + order by coalesce(dl.dependency_level, 0) + + + + + + Index: openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/subsite-callback-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,30 @@ + + + + + + + select object_type + from acs_objects + where object_id = :object_id + + + + + + + + + select distinct callback, callback_type + from subsite_callbacks + where object_type in (select t.object_type + from acs_object_types t + connect by prior t.supertype = t.object_type + start with t.object_type = :object_type) + and event_type = :event_type + + + + + + Index: openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,39 @@ + + + + oracle8.1.6 + + + + + BEGIN + :1 := rel_constraint.new( + constraint_name => :constraint_name, + rel_segment => :segment_id, + rel_side => 'two', + required_rel_segment => rel_segment.get(:supersite_group_id, 'membership_rel'), + creation_user => :user_id, + creation_ip => :creation_ip + ); + END; + + + + + + + + + select case + when exists (select 1 from acs_object_types + where supertype = :object_type) + then 1 + else 0 + end + from dual + + + + + + Index: openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,39 @@ + + + + postgresql7.1 + + + +-- FIX ME PLSQL +-- BEGIN + select rel_constraint__new( + :constraint_name, -- constraint_name + :segment_id, -- rel_segment + 'two', -- rel_side + rel_segment.get(:supersite_group_id, 'membership_rel'), -- required_rel_segment + :user_id, -- creation_user + :creation_ip -- creation_ip + ); +-- END; + + + + + + + + + select case + when exists (select 1 from acs_object_types + where supertype = :object_type) + then 1 + else 0 + end + + + + + + + Index: openacs-4/packages/acs-subsite/tcl/subsite-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/subsite-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 6 May 2001 21:40:21 -0000 1.1 @@ -0,0 +1,77 @@ + + + + + + + select instance_name + from apm_packages + where package_id = :package_id + + + + + + + + + select m.group_id as supersite_group_id, + p.instance_name as supersite_name + from application_group_element_map m, + apm_packages p + where p.package_id = m.package_id + and container_id = group_id + and element_id = :subsite_group_id + and rel_type = 'composition_rel' + + + + + + + + + select count(*) + from site_nodes + where parent_id = :node_id + and name = :instance_name + + + + + + + +-- FIX ME should be in oracle and postgresql + select t.pretty_name as package_name, acs_object__name(s.object_id) as object_name + from site_nodes s, apm_package_types t + where s.node_id = :node_id + and t.package_key = :package_key + + + + + + + + + select object_type + from acs_object_types + start with object_type = :object_type + connect by object_type = prior supertype + + + + + + + + + select pretty_name from acs_object_types + where object_type = :object_type + + + + + +