Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 6 Feb 2004 20:02:03 -0000 1.12 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 17 Feb 2004 15:32:50 -0000 1.13 @@ -10,7 +10,7 @@ -- License. Full text of the license is available from the GNU Project: -- http://www.fsf.org/copyleft/gpl.html -select define_function_args('content_extlink__new','name;null,url,label;null,description;null,parent_id,extlink_id;null,creation_date;current_timestamp,creation_user;null,creation_ip;null'); +select define_function_args('content_extlink__new','name,url,label,description,parent_id,extlink_id,creation_date;now,creation_user,creation_ip'); create or replace function content_extlink__new (varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar) returns integer as ' Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql,v diff -u -r1.29 -r1.30 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 17 Feb 2004 15:10:22 -0000 1.29 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 17 Feb 2004 15:32:50 -0000 1.30 @@ -115,7 +115,7 @@ -- function new -- accepts security_inherit_p DaveB -select define_function_args('content_folder__new','name,label,description;null,parent_id;null,context_id;null,folder_id;null,creation_date,creation_user;null,creation_ip;null,security_inherit_p;t'); +select define_function_args('content_folder__new','name,label,description,parent_id,context_id,folder_id,creation_date;now,creation_user,creation_ip,security_inherit_p'); create or replace function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar, boolean) returns integer as ' Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v diff -u -r1.46 -r1.47 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 7 Feb 2004 04:19:38 -0000 1.46 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 17 Feb 2004 15:32:50 -0000 1.47 @@ -43,7 +43,7 @@ -- new 19 param version of content_item__new -select define_function_args('content_item__new','name,parent_id;null,item_id;null,locale;null,creation_date;current_timestamp,creation_user;null,context_id;null,creation_ip;null,item_subtype;content_item,content_type;content_revision,title;null,description;null,mime_type;text/plain,nls_language;null,text;null,data;null,relation_tag;null,is_live;f,storage_type;lob'); +select define_function_args('content_item__new','name,parent_id,item_id,locale,creation_date;now,creation_user,context_id,creation_ip,item_subtype;content_item,content_type;content_revision,title,description,mime_type;text/plain,nls_language,text,data,relation_tag,is_live;f,storage_type;lob'); create or replace function content_item__new ( cr_items.name%TYPE, Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 6 Feb 2004 20:02:03 -0000 1.17 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-keyword.sql 17 Feb 2004 15:32:50 -0000 1.18 @@ -92,7 +92,7 @@ -- function new -select define_function_args('content_keyword__new','heading,description;null,parent_id;null,keyword_id;null,creation_date;current_timestamp,creation_user;null,creation_ip;null,object_type;content_keyword'); +select define_function_args('content_keyword__new','heading,description,parent_id,keyword_id,creation_date;now,creation_user,creation_ip,object_type;content_keyword'); create or replace function content_keyword__new (varchar,varchar,integer,integer,timestamptz,integer,varchar,varchar) returns integer as ' Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 6 Feb 2004 20:02:03 -0000 1.14 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 17 Feb 2004 15:32:50 -0000 1.15 @@ -12,7 +12,7 @@ -- create or replace package body content_symlink -- function new -select define_function_args('content_symlink__new','name;null,label;null,target_id,parent_id,symlink_id;null,creation_date;current_timestamp,creation_user;null,creation_ip;null'); +select define_function_args('content_symlink__new','name,label,target_id,parent_id,symlink_id,creation_date;now,creation_user,creation_ip'); create or replace function content_symlink__new (varchar,varchar,integer,integer,integer,timestamptz,integer,varchar) returns integer as ' Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 6 Feb 2004 20:02:03 -0000 1.11 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-template.sql 17 Feb 2004 15:32:50 -0000 1.12 @@ -36,7 +36,7 @@ -- function new -select define_function_args('content_template__new','name,parent_id;null,template_id;null,creation_date;null,creation_user;null,creation_ip;null'); +select define_function_args('content_template__new','name,parent_id,template_id,creation_date,creation_user,creation_ip'); create or replace function content_template__new (varchar,integer,integer,timestamptz,integer,varchar) returns integer as ' Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql,v diff -u -r1.31 -r1.32 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 12 Feb 2004 17:00:11 -0000 1.31 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 17 Feb 2004 15:32:50 -0000 1.32 @@ -41,35 +41,42 @@ create trigger cr_type_template_map_tr before insert on cr_type_template_map for each row execute procedure cr_type_template_map_tr (); --- show errors +select define_function_args('content_type__create_type','content_type,supertype;content_revision,pretty_name,pretty_plural,table_name,id_column;XXX,name_method'); --- create or replace package body content_type is --- procedure create_type - -select define_function_args('content_type__create_type','content_type,super_type;content_revision,pretty_name,pretty_plural,table_name;null,id_colum;XXX,name_method;null'); - create or replace function content_type__create_type (varchar,varchar,varchar,varchar,varchar,varchar,varchar) returns integer as ' declare create_type__content_type alias for $1; create_type__supertype alias for $2; -- default ''content_revision'' create_type__pretty_name alias for $3; create_type__pretty_plural alias for $4; - create_type__table_name alias for $5; -- default null + create_type__table_name alias for $5; create_type__id_column alias for $6; -- default ''XXX'' create_type__name_method alias for $7; -- default null - table_exists boolean; + v_temp_p boolean; v_supertype_table acs_object_types.table_name%TYPE; begin + if (create_type__supertype <> ''content_revision'') + and (create_type__content_type <> ''content_revision'') then + select count(*) > 0 into v_temp_p + from acs_object_type_supertype_map + where object_type = create_type__supertype + and ancestor_type = ''content_revision''; + + if not v_temp_p then + raise EXCEPTION ''-20000: supertype % must be a subtype of content_revision'', create_type__supertype; + end if; + end if; + -- create the attribute table if not already created - select count(*) > 0 into table_exists + select count(*) > 0 into v_temp_p from pg_class where relname = lower(create_type__table_name); - if NOT table_exists then + if NOT v_temp_p then select table_name into v_supertype_table from acs_object_types where object_type = create_type__supertype; @@ -96,6 +103,7 @@ return 0; end;' language 'plpgsql'; +select define_function_args('content_type__drop_type','content_type,drop_children_p;f,drop_table_p;f'); create or replace function content_type__drop_type (varchar,boolean,boolean) returns integer as ' @@ -198,7 +206,7 @@ return 0; end;' language 'plpgsql'; -select define_function_args('content_type__create_attribute','content_type,attribute_name,datatype,pretty_name,pretty_plural;null,sort_order;null,default_value;null,column_spec;text'); +select define_function_args('content_type__create_attribute','content_type,attribute_name,datatype,pretty_name,pretty_plural,sort_order,default_value,column_spec;text'); -- function create_attribute create or replace function content_type__create_attribute (varchar,varchar,varchar,varchar,varchar,integer,varchar,varchar) @@ -262,6 +270,9 @@ -- procedure drop_attribute + +select define_function_args('content_type__drop_attribute','content_type,attribute_name,drop_column;f'); + create or replace function content_type__drop_attribute (varchar,varchar,boolean) returns integer as ' declare @@ -296,9 +307,9 @@ -- FIXME: postgresql does not support drop column. -- Drop the column if neccessary - if drop_attribute__drop_column and ''f''::boolean then + if drop_attribute__drop_column then execute ''alter table '' || v_table || '' drop column '' || - drop_attribute__attribute_name; + drop_attribute__attribute_name || ''cascade''; -- exception when others then -- raise_application_error(-20000, ''Unable to drop column '' ||