Index: openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql	15 Aug 2002 18:00:49 -0000	1.5
+++ openacs-4/packages/dotlrn/sql/postgresql/community-memberships-packages-create.sql	1 Nov 2013 21:08:29 -0000	1.6
@@ -28,17 +28,23 @@
 
 select define_function_args('dotlrn_member_rel__new','rel_id,rel_type;dotlrn_member_rel,portal_id,community_id,user_id,member_state;approved,creation_user,creation_ip');
 
-create function dotlrn_member_rel__new(integer,varchar,integer,integer,integer,varchar,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_member_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_member_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar,     -- default 'dotlrn_member_rel'
+   p_portal_id integer,
+   p_community_id integer,
+   p_user_id integer,
+   p_member_state varchar, -- default 'approved'
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_portal_id             alias for $3;
-        p_community_id          alias for $4;
-        p_user_id               alias for $5;
-        p_member_state          alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= membership_rel__new(
@@ -59,39 +65,52 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 select define_function_args('dotlrn_member_rel__delete','rel_id');
 
-create function dotlrn_member_rel__delete(integer)
-returns integer as '
+
+
+--
+-- procedure dotlrn_member_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_member_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete from dotlrn_member_rels where rel_id = p_rel_id; 
 
         PERFORM membership_rel__delete(p_rel_id);
 
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
 
+
 select define_function_args('dotlrn_admin_rel__new','rel_id,rel_type;dotlrn_admin_rel,community_id,user_id,member_state,portal_id,creation_user,creation_ip');
 
-create function dotlrn_admin_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_admin_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_admin_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_admin_rel'
+   p_community_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_portal_id integer,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_community_id          alias for $3;
-        p_user_id               alias for $4;
-        p_member_state          alias for $5;
-        p_portal_id             alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_member_rel__new(
@@ -113,38 +132,51 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 select define_function_args('dotlrn_admin_rel__delete','rel_id');
 
-create function dotlrn_admin_rel__delete(integer)
-returns integer as '
+
+
+--
+-- procedure dotlrn_admin_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_admin_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete from dotlrn_admin_rels where rel_id = p_rel_id;
 
         PERFORM dotlrn_member_rel__delete(p_rel_id);
 
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 select define_function_args('dotlrn_student_rel__new','rel_id,rel_type;dotlrn_student_rel,portal_id,class_instance_id,user_id,member_state,creation_user,creation_ip');
 
-create function dotlrn_student_rel__new(integer,varchar,integer,integer,integer,varchar,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_student_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_student_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_student_rel'
+   p_portal_id integer,
+   p_class_instance_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_portal_id             alias for $3;
-        p_class_instance_id     alias for $4;
-        p_user_id               alias for $5;
-        p_member_state          alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_member_rel__new(
@@ -166,42 +198,55 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 select define_function_args('dotlrn_student_rel__delete','rel_id');
 
-create function dotlrn_student_rel__delete(integer)
-returns integer as '
+
+
+--
+-- procedure dotlrn_student_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_student_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete from dotlrn_student_rels where rel_id= p_rel_id;
 
         PERFORM dotlrn_member_rel__delete(p_rel_id);
 
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
 
+
 select define_function_args('dotlrn_ta_rel__new','rel_id,rel_type;dotlrn_ta_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip');
 
 select define_function_args('dotlrn_ta_rel__delete','rel_id');
 
 
-create function dotlrn_ta_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_ta_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_ta_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_ta_rel'
+   p_class_instance_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_portal_id integer,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_class_instance_id     alias for $3;
-        p_user_id               alias for $4;
-        p_member_state          alias for $5;
-        p_portal_id             alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_admin_rel__new(
@@ -223,13 +268,19 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
-create function dotlrn_ta_rel__delete(integer)
-returns integer as '
+
+
+
+--
+-- procedure dotlrn_ta_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_ta_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete
         from dotlrn_ta_rels
@@ -239,27 +290,34 @@
         
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 -- ca rel
 
 select define_function_args('dotlrn_ca_rel__new','rel_id,rel_type;dotlrn_ca_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip');
 
 select define_function_args('dotlrn_ca_rel__delete','rel_id');
 
 
-create function dotlrn_ca_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_ca_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_ca_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_ca_rel'
+   p_class_instance_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_portal_id integer,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_class_instance_id     alias for $3;
-        p_user_id               alias for $4;
-        p_member_state          alias for $5;
-        p_portal_id             alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_admin_rel__new(
@@ -281,13 +339,19 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
-create function dotlrn_ca_rel__delete(integer)
-returns integer as '
+
+
+
+--
+-- procedure dotlrn_ca_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_ca_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete
         from dotlrn_ca_rels
@@ -297,27 +361,34 @@
         
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 -- course admin
 
 select define_function_args('dotlrn_cadmin_rel__new','rel_id,rel_type;dotlrn_cadmin_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip');
 
 select define_function_args('dotlrn_cadmin_rel__delete','rel_id');
 
 
-create function dotlrn_cadmin_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_cadmin_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_cadmin_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_cadmin_rel'
+   p_class_instance_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_portal_id integer,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_class_instance_id     alias for $3;
-        p_user_id               alias for $4;
-        p_member_state          alias for $5;
-        p_portal_id             alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_admin_rel__new(
@@ -339,13 +410,19 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
-create function dotlrn_cadmin_rel__delete(integer)
-returns integer as '
+
+
+
+--
+-- procedure dotlrn_cadmin_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_cadmin_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete
         from dotlrn_cadmin_rels
@@ -355,27 +432,34 @@
         
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 -- instructor rel
 
 select define_function_args('dotlrn_instructor_rel__new','rel_id,rel_type;dotlrn_instructor_rel,class_instance_id,user_id,member_state,portal_id,creation_user,creation_ip');
 
 select define_function_args('dotlrn_instructor_rel__delete','rel_id');
 
 
-create function dotlrn_instructor_rel__new(integer,varchar,integer,integer,varchar,integer,integer,varchar)
-returns integer as '
+
+
+--
+-- procedure dotlrn_instructor_rel__new/8
+--
+CREATE OR REPLACE FUNCTION dotlrn_instructor_rel__new(
+   p_rel_id integer,
+   p_rel_type varchar, -- default 'dotlrn_instructor_rel'
+   p_class_instance_id integer,
+   p_user_id integer,
+   p_member_state varchar,
+   p_portal_id integer,
+   p_creation_user integer,
+   p_creation_ip varchar
+
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
-        p_rel_type              alias for $2;
-        p_class_instance_id     alias for $3;
-        p_user_id               alias for $4;
-        p_member_state          alias for $5;
-        p_portal_id             alias for $6;
-        p_creation_user         alias for $7;
-        p_creation_ip           alias for $8;
         v_rel_id                integer;
 BEGIN
         v_rel_id:= dotlrn_admin_rel__new(
@@ -397,13 +481,19 @@
 
         return v_rel_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
-create function dotlrn_instructor_rel__delete(integer)
-returns integer as '
+
+
+
+--
+-- procedure dotlrn_instructor_rel__delete/1
+--
+CREATE OR REPLACE FUNCTION dotlrn_instructor_rel__delete(
+   p_rel_id integer
+) RETURNS integer AS $$
 DECLARE
-        p_rel_id                alias for $1;
 BEGIN
         delete
         from dotlrn_instructor_rels
@@ -413,5 +503,6 @@
         
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
+
