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.12 -r1.13
--- openacs-4/packages/acs-subsite/acs-subsite.info 22 Jul 2001 17:31:29 -0000 1.12
+++ openacs-4/packages/acs-subsite/acs-subsite.info 3 Aug 2001 21:09:20 -0000 1.13
@@ -607,30 +607,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/tcl/group-procs-postgresql.xql 15 May 2001 16:59:00 -0000 1.2
+++ openacs-4/packages/acs-subsite/tcl/group-procs-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.3
@@ -15,26 +15,28 @@
-
+
- FIX ME PLSQL
-
+ DECLARE
+ row record;
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
+ 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
+ and segs.group_id = :group_id loop
- rel_segment__delete(row.constraint_id);
+ perform rel_segment__delete(row.constraint_id);
end loop;
-- delete the actual group
- ${package_name}.delete(:group_id);
+ perform ${package_name}__delete(:group_id);
+
+ return 1;
END;
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 -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/tcl/group-type-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1
+++ openacs-4/packages/acs-subsite/tcl/group-type-procs-oracle.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -17,4 +17,54 @@
+
+
+
+begin acs_object_type.drop_type('$group_type'); end;
+
+
+
+
+
+
+
+
+BEGIN
+ acs_object_type.create_type (
+ supertype => :supertype,
+ object_type => :group_type,
+ pretty_name => :pretty_name,
+ pretty_plural => :pretty_plural,
+ table_name => :table_name,
+ id_column => :id_column,
+ package_name => :package_name
+ );
+END;
+
+
+
+
+
+
+
+
+update acs_object_types set dynamic_p='t' where object_type = :group_type
+
+
+
+
+
+
+
+
+ insert into group_type_rels
+ (group_rel_type_id, rel_type, group_type)
+ select acs_object_id_seq.nextval, r.rel_type, :group_type
+ from group_type_rels r
+ where r.group_type = :supertype
+
+
+
+
+
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 -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/tcl/group-type-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1
+++ openacs-4/packages/acs-subsite/tcl/group-type-procs-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -3,7 +3,7 @@
postgresql7.1
-
+
select case when exists (select 1
@@ -17,4 +17,78 @@
+
+
+
+ select acs_object_type__drop_type('$group_type', 'f');
+
+
+
+
+
+
+
+
+ select acs_object_type__create_type (
+ :group_type,
+ :pretty_name,
+ :pretty_plural,
+ :supertype,
+ :table_name,
+ :id_column,
+ :package_name,
+ 'f',
+ null,
+ null
+ )
+
+
+
+
+
+
+
+
+ begin
+ update acs_object_types set dynamic_p='t' where object_type = :group_type;
+ return null;
+ end;
+
+
+
+
+
+
+
+
+ begin
+ insert into group_type_rels
+ (group_rel_type_id, rel_type, group_type)
+ select acs_object_id_seq.nextval, r.rel_type, :group_type
+ from group_type_rels r
+ where r.group_type = :supertype;
+ return null;
+ end;
+
+
+
+
+
+
+
+
+begin
+ create table $table_name (
+ $id_column integer
+ constraint $constraint(pk) primary key
+ constraint $constraint(fk)
+ references $references_table ($references_column)
+ );
+ return null;
+end;
+
+
+
+
+
Index: openacs-4/packages/acs-subsite/tcl/group-type-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-type-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/tcl/group-type-procs.tcl 13 Mar 2001 22:59:26 -0000 1.1
+++ openacs-4/packages/acs-subsite/tcl/group-type-procs.tcl 3 Aug 2001 21:09:20 -0000 1.2
@@ -126,31 +126,15 @@
}
# Create the table if it doesn't exist.
- lappend plsql_drop [list drop_type "begin acs_object_type.drop_type('$group_type'); end;"]
- lappend plsql [list "create_type" "
-BEGIN
- acs_object_type.create_type (
- supertype => :supertype,
- object_type => :group_type,
- pretty_name => :pretty_name,
- pretty_plural => :pretty_plural,
- table_name => :table_name,
- id_column => :id_column,
- package_name => :package_name
- );
-END;"]
+ lappend plsql_drop [list drop_type [db_map drop_type]]
+ lappend plsql [list "create_type" [db_map create_type]]
# Mark the type as dynamic
- lappend plsql [list update_type "update acs_object_types set dynamic_p='t' where object_type = :group_type"]
+ lappend plsql [list update_type [db_map update_type]]
# Now, copy the allowable relation types from the super type
lappend plsql_drop [list remove_rel_types "delete from group_type_rels where group_type = :group_type"]
- lappend plsql [list copy_rel_types \
- "insert into group_type_rels
- (group_rel_type_id, rel_type, group_type)
- select acs_object_id_seq.nextval, r.rel_type, :group_type
- from group_type_rels r
- where r.group_type = :supertype"]
+ lappend plsql [list copy_rel_types [db_map copy_rel_types]]
if { $execute_p == "f" } {
set text "-- Create script"
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 -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql 15 May 2001 16:59:00 -0000 1.2
+++ openacs-4/packages/acs-subsite/tcl/package-procs-oracle.xql 3 Aug 2001 21:09:20 -0000 1.3
@@ -170,4 +170,81 @@
+
+
+
+create or replace package body ${package_name}
+as
+[package_insert_default_comment]
+ function new (
+ [plsql_utility::generate_attribute_parameters $attribute_list]
+ ) return ${table_name}.${id_column}%TYPE
+ is
+ v_$id_column ${table_name}.${id_column}%TYPE;
+ begin
+
+ v_$id_column := ${supertype_package_name}.new (
+ [plsql_utility::generate_attribute_parameter_call_from_attributes \
+ -prepend "new." \
+ -indent 21 \
+ $supertype_attr_list]
+ );
+
+ insert into ${table_name}
+ ($id_column[plsql_utility::generate_attribute_dml -ignore [list $id_column] $table_name $attribute_list])
+ values
+ (v_$id_column[plsql_utility::generate_attribute_dml -prepend "new." -ignore [list $id_column] $table_name $attribute_list]);
+
+ return v_$id_column;
+
+ end new;
+
+ procedure delete (
+ $id_column in ${table_name}.${id_column}%TYPE
+ )
+ is
+ begin
+
+ ${supertype_package_name}.delete( $package_name.delete.$id_column );
+
+ end delete;
+
+end ${package_name};
+
+
+
+
+
+
+
+
+create or replace package $package_name as
+[package_insert_default_comment]
+ function new (
+ [plsql_utility::generate_attribute_parameters [package_create_attribute_list \
+ -supertype $supertype \
+ -object_name "NEW" \
+ -table $table_name \
+ -column $id_column \
+ $object_type]]
+ ) return ${table_name}.${id_column}%TYPE;
+
+ procedure delete (
+ $id_column in ${table_name}.${id_column}%TYPE
+ );
+END ${package_name};
+
+
+
+
+
+
+ sysdate
+
+
+
+ sysdate
+
+
+
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 -r1.3 -r1.4
--- openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql 22 Jul 2001 17:28:57 -0000 1.3
+++ openacs-4/packages/acs-subsite/tcl/package-procs-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.4
@@ -19,16 +19,16 @@
- FIX ME CONNECT BY
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
+ (select t2.object_type, t2.table_name, (tree_level(t1.tree_sortkey) - tree_level(t2.tree_sortkey)) + 1 as type_level
+ from acs_object_types t1, acs_object_types t2
+ where t2.tree_sortkey <= t1.tree_sortkey
+ and t1.tree_sortkey like (t2.tree_sortkey || '%')
+ and t1.object_type = :object_type) t
where attr.ancestor_type = t.object_type
and attr.object_type = :object_type
order by t.type_level
@@ -39,13 +39,12 @@
- FIX ME CONNECT BY
- 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 t2.object_type
+ from acs_object_types t1, acs_object_types t2
+ where t2.dynamic_p = 't'
+ and t2.tree_sortkey like (t1.tree_sortkey || '%')
+ and t1.object_type = :object_type
@@ -68,25 +67,24 @@
- FIX ME CONNECT BY
- 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 t2.object_type as ancestor_type
+ from acs_object_types t1, acs_object_types t2
+ where t2.tree_sortkey <= t1.tree_sortkey
+ and t1.tree_sortkey like (t2.tree_sortkey || '%')
+ and t1.object_type = :object_type
- FIX ME CONNECT BY
- 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 t2.object_type as sub_type
+ from acs_object_types t1, acs_object_types t2
+ where t2.tree_sortkey like (t1.tree_sortkey || '%')
+ and t1.object_type = :object_type
@@ -160,6 +158,15 @@
+
+
+
+select 1
+
+
+
+
+
@@ -172,4 +179,83 @@
+
+
+
+ select args.arg_name
+ from acs_function_args args
+ where args.function =upper(:supertype_package_name) || '__NEW'
+
+
+
+
+
+
+
+
+begin
+
+perform drop_package('${package_name}');
+
+perform define_function_args('${package_name}__new','[plpgsql_utility::define_function_args $attribute_list]');
+
+create function ${package_name}__new([plpgsql_utility::generate_function_signature $attribute_list])
+returns [plpgsql_utility::table_column_type ${table_name} ${id_column}] as '
+declare
+ [plpgsql_utility::generate_attribute_parameters $attribute_list];
+ v_$id_column ${table_name}.${id_column}%TYPE;
+begin
+
+ v_$id_column := ${supertype_package_name}__new (
+ [plpgsql_utility::generate_attribute_parameter_call_from_attributes \
+ -prepend "p_" \
+ "${supertype_package_name}__new" \
+ $supertype_attr_list]
+ );
+
+ insert into ${table_name}
+ ($id_column[plsql_utility::generate_attribute_dml -ignore [list $id_column] $table_name $attribute_list])
+ values
+ (v_$id_column[plsql_utility::generate_attribute_dml -prepend "p." -ignore [list $id_column] $table_name $attribute_list]);
+
+ return v_$id_column;
+
+end;' language 'plpgsql';
+
+create function ${package_name}__delete ([plpgsql_utility::table_column_type ${table_name} ${id_column}])
+returns integer as '
+declare
+ p_${id_column} alias for [plpgsql_utility::dollar]1;
+begin
+
+ perform ${supertype_package_name}__delete( p_${id_column} );
+ return 1;
+
+end;' language 'plpgsql';
+
+return null;
+end;
+
+
+
+
+
+
+
+
+select 1;
+
+
+
+
+
+
+ now()
+
+
+
+ now()
+
+
+
Index: openacs-4/packages/acs-subsite/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/tcl/package-procs.tcl 13 Mar 2001 22:59:26 -0000 1.1
+++ openacs-4/packages/acs-subsite/tcl/package-procs.tcl 3 Aug 2001 21:09:20 -0000 1.2
@@ -212,10 +212,10 @@
if { [string equal $table "ACS_OBJECTS"] } {
switch -- $column {
"OBJECT_TYPE" { return "'[DoubleApos $object_type]'" }
- "CREATION_DATE" { return "sysdate" }
+ "CREATION_DATE" { return [db_map creation_date] }
"CREATION_IP" { return "NULL" }
"CREATION_USER" { return "NULL" }
- "LAST_MODIFIED" { return "sysdate" }
+ "LAST_MODIFIED" { return [db_map last_modified] }
"MODIFYING_IP" { return "NULL" }
}
} elseif { [string equal $table "ACS_RELS"] } {
@@ -315,7 +315,8 @@
if { $debug_p == "t" } {
foreach pair $plsql {
- append text "[plsql_utility::parse_sql [lindex $pair 1]]\n\n"
+# append text "[plsql_utility::parse_sql [lindex $pair 1]]\n\n"
+ append text [lindex $pair 2]
}
return $text
}
@@ -366,23 +367,7 @@
where t.object_type = :object_type
}
- return "
-create or replace package $package_name as
-[package_insert_default_comment]
- function new (
- [plsql_utility::generate_attribute_parameters [package_create_attribute_list \
- -supertype $supertype \
- -object_name "NEW" \
- -table $table_name \
- -column $id_column \
- $object_type]]
- ) return ${table_name}.${id_column}%TYPE;
-
- procedure delete (
- $id_column in ${table_name}.${id_column}%TYPE
- );
-END ${package_name};
-"
+ return [db_map spec]
}
@@ -437,44 +422,7 @@
-column_value $id_column \
$supertype]
- return "
-create or replace package body ${package_name}
-as
-[package_insert_default_comment]
- function new (
- [plsql_utility::generate_attribute_parameters $attribute_list]
- ) return ${table_name}.${id_column}%TYPE
- is
- v_$id_column ${table_name}.${id_column}%TYPE;
- begin
-
- v_$id_column := ${supertype_package_name}.new (
- [plsql_utility::generate_attribute_parameter_call_from_attributes \
- -prepend "new." \
- -indent 21 \
- $supertype_attr_list]
- );
-
- insert into ${table_name}
- ($id_column[plsql_utility::generate_attribute_dml -ignore [list $id_column] $table_name $attribute_list])
- values
- (v_$id_column[plsql_utility::generate_attribute_dml -prepend "new." -ignore [list $id_column] $table_name $attribute_list]);
-
- return v_$id_column;
-
- end new;
-
- procedure delete (
- $id_column in ${table_name}.${id_column}%TYPE
- )
- is
- begin
-
- ${supertype_package_name}.delete( $package_name.delete.$id_column );
-
- end delete;
-
-end ${package_name};"
+ return [db_map body]
}
ad_proc -public package_object_view_reset {
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 -r1.2 -r1.3
--- openacs-4/packages/acs-subsite/tcl/package-procs.xql 15 May 2001 16:59:00 -0000 1.2
+++ openacs-4/packages/acs-subsite/tcl/package-procs.xql 3 Aug 2001 21:09:20 -0000 1.3
@@ -56,18 +56,6 @@
-
-
-
- select args.argument_name
- from user_arguments args
- where args.package_name =upper(:supertype_package_name)
- and args.object_name='NEW'
-
-
-
-
-
Index: openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl 22 Jul 2001 17:31:29 -0000 1.1
+++ openacs-4/packages/acs-subsite/tcl/plpgsql-utility-procs.tcl 3 Aug 2001 21:09:20 -0000 1.2
@@ -10,6 +10,26 @@
namespace eval plpgsql_utility {
+ ad_proc -public generate_attribute_parameter_call_from_attributes {
+ { -prepend "" }
+ function_name
+ attr_list
+ } {
+ Wrapper for generate_attribute_parameter_call that formats
+ default attribute list to the right format.
+
+ @author Michael Bryzek (mbryzek@arsdigita.com)
+ @creation-date 11/2000
+
+ } {
+ set the_list [list]
+ foreach row $attr_list {
+ lappend the_list [list [lindex $row 1] [lindex $row 3]]
+ }
+ return [generate_attribute_parameter_call -prepend $prepend $function_name $the_list]
+ }
+
+
ad_proc -public generate_attribute_parameter_call {
{ -prepend "" }
function_name
@@ -21,6 +41,7 @@
@creation-date 07/2001
} {
+ ns_log Notice "*** $function_name [join $pairs "\n"]"
# Get the list of real args to the function
set real_args [db_list_of_lists get_function_args "
select arg_name, arg_default
@@ -40,7 +61,7 @@
set arg_name [lindex $row 0]
set arg_default [lindex $row 1]
if { [info exists user_supplied($arg_name)] } {
- lappend pieces ":$user_supplied($arg_name)"
+ lappend pieces "${prepend}$user_supplied($arg_name)"
} else {
if { $arg_default == "" } {
lappend pieces "NULL"
@@ -53,4 +74,99 @@
return [join $pieces ","]
}
+ ad_proc -public table_column_type {
+ table
+ column
+ } {
+ Returns the datatype for column in table
+
+ @author Steve Woodcock (swoodcock@scholastic.co.uk)
+ @creation-date 07/2001
+
+ } {
+ return [db_string fetch_type "
+ select data_type
+ from user_tab_columns
+ where table_name = upper(:table)
+ and column_name = upper(:column)
+ "]
+ }
+
+ ad_proc -public generate_attribute_parameters {
+ { -indent "4" }
+ attr_list
+ } {
+ Generates the arg list to a pl/sql function or procedure
+
+ @author Michael Bryzek (mbryzek@arsdigita.com)
+ @creation-date 11/2000
+
+ } {
+ set pieces [list]
+ set arg_num 0
+ foreach triple $attr_list {
+ incr arg_num
+ set attr [string toupper [string trim [lindex $triple 1]]]
+ lappend pieces [list "p_${attr}" "alias for \$${arg_num}"]
+ }
+ return [plsql_utility::format_pieces -indent $indent -line_term ";" $pieces]
+
+ }
+
+
+ ad_proc -public generate_function_signature {
+ attr_list
+ } {
+ Generates the signature for a pl/sql function or procedure
+
+ @author Steve Woodcock (swoodcock@scholastic.co.uk)
+ @creation-date 07/2001
+
+ } {
+ set pieces [list]
+ foreach triple $attr_list {
+ set table [string toupper [string trim [lindex $triple 0]]]
+ set attr [string toupper [string trim [lindex $triple 1]]]
+ set datatype [table_column_type $table $attr]
+ lappend pieces $datatype
+ }
+ return [join $pieces ","]
+
+ }
+
+ ad_proc -public dollar {
+ } {
+ Return a literal dollar for use in .xql files.
+ } {
+ return "$"
+ }
+
+
+ ad_proc -public define_function_args {
+ attr_list
+ } {
+ Returns the attribute list as a string suitable for a call to define_function_args.
+
+ @author Steve Woodcock (swoodcock@scholastic.co.uk)
+ @creation-date 07/2001
+
+ } {
+ set pieces [list]
+ foreach triple $attr_list {
+ set attr [string trim [lindex $triple 1]]
+ set dft [string trim [lindex $triple 2]]
+ if { [empty_string_p $dft] || $dft == "NULL" } {
+ set default ""
+ } else {
+ if { [string index $dft 0] == "'" } {
+ set dft [string range $dft 1 [expr [string length $dft] - 2]]
+ }
+ set default ";${dft}"
+ }
+ lappend pieces "${attr}${default}"
+ }
+ return [join $pieces ","]
+
+ }
+
}
Index: openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/Attic/delete-2-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-oracle.xql 15 May 2001 16:59:00 -0000 1.1
+++ openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-oracle.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -29,5 +29,32 @@
+
+
+ drop package [DoubleApos $group_type]
+
+
+
+
+
+delete from group_type_rels where group_type = :group_type
+
+
+
+
+
+
+begin acs_object_type.drop_type(:group_type); end;
+
+
+
+
+
+
+drop table $table_name
+
+
+
+
Index: openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/Attic/delete-2-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-postgresql.xql 15 May 2001 16:59:00 -0000 1.1
+++ openacs-4/packages/acs-subsite/www/admin/group-types/delete-2-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -7,9 +7,8 @@
select case when exists (select 1
- from user_objects o
- where o.object_type='PACKAGE'
- and o.object_name = upper(:package_name))
+ from pg_proc
+ where proname like :package_name || '%')
then 1 else 0 end
@@ -30,4 +29,38 @@
+
+
+ select drop_package('[DoubleApos $group_type]')
+
+
+
+
+
+
+begin
+ delete from group_type_rels where group_type = :group_type;
+ return 1;
+end;
+
+
+
+
+
+
+select acs_object_type__drop_type(:group_type, 'f')
+
+
+
+
+
+
+begin
+ drop table $table_name;
+ return 1;
+end;
+
+
+
+
Index: openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.tcl 13 Mar 2001 22:59:26 -0000 1.1
+++ openacs-4/packages/acs-subsite/www/admin/group-types/delete-2.tcl 3 Aug 2001 21:09:20 -0000 1.2
@@ -50,13 +50,13 @@
then 1 else 0 end
from dual
}] } {
- lappend plsql [list "package_drop" "drop package [DoubleApos $group_type]"]
+ lappend plsql [list "package_drop" [db_map package_drop]]
} else {
set package_name ""
}
# Remove the specified rel_types
-lappend plsql [list "delete_rel_types" "delete from group_type_rels where group_type = :group_type"]
+lappend plsql [list "delete_rel_types" [db_map delete_rel_types]]
if { [db_string type_exists {
select case when exists (select 1 from acs_object_types t where t.object_type = :group_type)
@@ -65,12 +65,12 @@
end
from dual
}] } {
- lappend plsql [list "drop_type" "begin acs_object_type.drop_type(:group_type); end;"]
+ lappend plsql [list "drop_type" [db_map drop_type]]
}
# Make sure we drop the table last
if { ![empty_string_p $table_name] && [db_table_exists $table_name] } {
- lappend plsql [list "drop_table" "drop table $table_name"]
+ lappend plsql [list "drop_table" [db_map drop_table]]
}
# How do we handle the situation where we delete the groups we can,
Index: openacs-4/packages/acs-subsite/www/admin/group-types/new-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/new-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/www/admin/group-types/new-postgresql.xql 15 May 2001 16:59:00 -0000 1.1
+++ openacs-4/packages/acs-subsite/www/admin/group-types/new-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -14,13 +14,13 @@
-
+
- select case when exists (select 1 from acs_object_types t where t.pretty_name = :pretty_name)
- then 1 else 0 end
-
-
+ select repeat(' ', (tree_level(t2.tree_sortkey) - tree_level(t1.tree_sortkey)) * 4) || t2.pretty_name, t2.object_type
+ from acs_object_types t1, acs_object_types t2
+ where t2.tree_sortkey like (t1.tree_sortkey || '%')
+ and t1.object_type = 'group'
Index: openacs-4/packages/acs-subsite/www/admin/groups/elements-display-list-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/groups/elements-display-list-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-subsite/www/admin/groups/elements-display-list-postgresql.xql 15 May 2001 16:59:00 -0000 1.1
+++ openacs-4/packages/acs-subsite/www/admin/groups/elements-display-list-postgresql.xql 3 Aug 2001 21:09:20 -0000 1.2
@@ -5,16 +5,17 @@
- FIX ME CONNECT BY
select object_type as ancestor_rel_type
from acs_object_types
where supertype = 'relationship'
and object_type in (
- select object_type from acs_object_types
- start with object_type = :rel_type
- connect by object_type = prior supertype
- )
+ select t1.object_type
+ from acs_object_types t1, acs_object_types t2
+ where t2.tree_sortkey <= t1.tree_sortkey
+ and t1.tree_sortkey like (t2.tree_sortkey || '%')
+ and t1.object_type = :rel_type
+ )