Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql,v diff -u -r1.43 -r1.44 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql 20 Mar 2005 15:58:45 -0000 1.43 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-revision.sql 6 Jul 2005 23:31:01 -0000 1.44 @@ -560,51 +560,6 @@ from cr_revisions r where r.revision_id = p_revision_id; end;' language 'plpgsql' stable strict; --- procedure index_attributes -create or replace function content_revision__index_attributes (integer) -returns integer as ' -declare - index_attributes__revision_id alias for $1; - clob_loc text; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception ''content_revision__index_attributes not implemented on postgres''; - -end;' language 'plpgsql'; - - --- function import_xml -create or replace function content_revision__import_xml (integer,integer,numeric) -returns integer as ' -declare - import_xml__item_id alias for $1; - import_xml__revision_id alias for $2; - import_xml__doc_id alias for $3; - clob_loc text; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception ''content_revision__import_xml not implemented on postgres''; - -end;' language 'plpgsql'; - - --- function export_xml -create or replace function content_revision__export_xml (integer) -returns integer as ' -declare - revision_id alias for $1; - clob_loc text; - v_doc_id cr_xml_docs.doc_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception ''content_revision__export_xml Not currently implemented on postgresql''; - -end;' language 'plpgsql'; - - -- procedure to_html select define_function_args('content_revision__to_html','revision_id'); create or replace function content_revision__to_html (integer) 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.42 -r1.43 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 8 Jun 2005 20:59:00 -0000 1.42 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-type.sql 6 Jul 2005 23:31:01 -0000 1.43 @@ -14,8 +14,6 @@ -- Create a trigger to make sure that there will never be more than -- one default template for a given content type and use context ---set serveroutput on - create function cr_type_template_map_tr () returns opaque as ' begin @@ -41,7 +39,7 @@ create trigger cr_type_template_map_tr before insert on cr_type_template_map for each row execute procedure cr_type_template_map_tr (); -select define_function_args('content_type__create_type','content_type,supertype;content_revision,pretty_name,pretty_plural,table_name,id_column;XXX,name_method'); +select define_function_args('content_type__create_type','content_type,supertype;content_revision,pretty_name,pretty_plural,table_name,id_column,name_method'); create or replace function content_type__create_type (varchar,varchar,varchar,varchar,varchar,varchar,varchar) returns integer as ' @@ -76,7 +74,7 @@ from pg_class where relname = lower(create_type__table_name); - if NOT v_temp_p then + if NOT v_temp_p and create_type__table_name is not null then select table_name into v_supertype_table from acs_object_types where object_type = create_type__supertype; @@ -207,9 +205,9 @@ end;' language 'plpgsql'; --- function create_attribute select define_function_args('content_type__create_attribute','content_type,attribute_name,datatype,pretty_name,pretty_plural,sort_order,default_value,column_spec;text'); + create or replace function content_type__create_attribute (varchar,varchar,varchar,varchar,varchar,integer,varchar,varchar) returns integer as ' declare @@ -270,8 +268,6 @@ end;' language 'plpgsql'; --- 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) @@ -312,9 +308,6 @@ execute ''alter table '' || v_table || '' drop column '' || drop_attribute__attribute_name || '' cascade''; --- exception when others then --- raise_application_error(-20000, ''Unable to drop column '' || --- v_table || ''.'' || attribute_name || '' in content_type.drop_attribute''); end if; PERFORM content_type__refresh_view(drop_attribute__content_type); @@ -323,7 +316,6 @@ end;' language 'plpgsql'; --- procedure register_template select define_function_args('content_type__register_template','content_type,template_id,use_context,is_default;f'); create or replace function content_type__register_template (varchar,integer,varchar,boolean) returns integer as ' @@ -375,9 +367,8 @@ return 0; end;' language 'plpgsql'; - --- procedure set_default_template select define_function_args('content_type__set_default_template','content_type,template_id,use_context'); + create or replace function content_type__set_default_template (varchar,integer,varchar) returns integer as ' declare @@ -406,8 +397,8 @@ end;' language 'plpgsql'; --- function get_template select define_function_args('content_type__get_template','content_type,use_context'); + create or replace function content_type__get_template (varchar,varchar) returns integer as ' declare @@ -433,8 +424,8 @@ end;' language 'plpgsql' stable strict; --- procedure unregister_template select define_function_args('content_type__unregister_template','content_type,template_id,use_context'); + create or replace function content_type__unregister_template (varchar,integer,varchar) returns integer as ' declare @@ -474,8 +465,8 @@ end;' language 'plpgsql'; --- function trigger_insert_statement select define_function_args('content_type__trigger_insert_statement','content_type'); + create or replace function content_type__trigger_insert_statement (varchar) returns varchar as ' declare @@ -557,8 +548,8 @@ -- Create or replace a trigger on insert for simplifying addition of -- revisions for any content type --- procedure refresh_trigger select define_function_args('content_type__refresh_trigger','content_type'); + create or replace function content_type__refresh_trigger (varchar) returns integer as ' declare @@ -639,9 +630,8 @@ end;' language 'plpgsql'; - --- procedure refresh_view select define_function_args('content_type__refresh_view','content_type'); + create or replace function content_type__refresh_view (varchar) returns integer as ' declare @@ -652,19 +642,11 @@ v_table_name varchar; join_rec record; begin --- select --- table_name, id_column, level --- from --- acs_object_types --- where --- object_type <> ''acs_object'' --- and --- object_type <> ''content_revision'' --- start with --- object_type = refresh_view__content_type --- connect by --- object_type = prior supertype + if v_table_name is null then + return 0; + end if; + for join_rec in select ot2.table_name, ot2.id_column, tree_level(ot2.tree_sortkey) as level from acs_object_types ot1, acs_object_types ot2 where ot2.object_type <> ''acs_object'' @@ -673,10 +655,12 @@ and ot1.tree_sortkey between ot2.tree_sortkey and tree_right(ot2.tree_sortkey) order by ot2.tree_sortkey desc LOOP - cols := cols || '', '' || join_rec.table_name || ''.*''; - tabs := tabs || '', '' || join_rec.table_name; - joins := joins || '' and acs_objects.object_id = '' || - join_rec.table_name || ''.'' || join_rec.id_column; + if join_rec.table_name is not null then + cols := cols || '', '' || join_rec.table_name || ''.*''; + tabs := tabs || '', '' || join_rec.table_name; + joins := joins || '' and acs_objects.object_id = '' || + join_rec.table_name || ''.'' || join_rec.id_column; + end if; end loop; select table_name into v_table_name from acs_object_types @@ -756,9 +740,8 @@ return 0; end;' language 'plpgsql'; - --- procedure register_child_type select define_function_args('content_type__register_child_type','parent_type,child_type,relation_tag;generic,min_n;0,max_n'); + create or replace function content_type__register_child_type (varchar,varchar,varchar,integer,integer) returns integer as ' declare @@ -805,8 +788,8 @@ end;' language 'plpgsql'; --- procedure unregister_child_type select define_function_args('content_type__unregister_child_type','content_type,child_type,relation_tag'); + create or replace function content_type__unregister_child_type (varchar,varchar,varchar) returns integer as ' declare @@ -828,8 +811,8 @@ end;' language 'plpgsql'; --- procedure register_relation_type select define_function_args('content_type__register_relation_type','content_type,target_type,relation_tag;generic,min_n;0,max_n'); + create or replace function content_type__register_relation_type (varchar,varchar,varchar,integer,integer) returns integer as ' declare @@ -881,8 +864,8 @@ end;' language 'plpgsql'; --- procedure unregister_relation_type select define_function_args('content_type__unregister_relation_type','content_type,target_type,relation_tag;generic'); + create or replace function content_type__unregister_relation_type (varchar,varchar,varchar) returns integer as ' declare @@ -905,8 +888,8 @@ end;' language 'plpgsql'; --- procedure register_mime_type select define_function_args('content_type__register_mime_type','content_type,mime_type'); + create or replace function content_type__register_mime_type (varchar,varchar) returns integer as ' declare @@ -943,8 +926,8 @@ end;' language 'plpgsql'; --- procedure unregister_mime_type select define_function_args('content_type__unregister_mime_type','content_type,mime_type'); + create or replace function content_type__unregister_mime_type (varchar,varchar) returns integer as ' declare @@ -960,8 +943,8 @@ end;' language 'plpgsql'; --- function is_content_type select define_function_args('content_type__is_content_type','content_type'); + create or replace function content_type__is_content_type (varchar) returns boolean as ' declare @@ -985,8 +968,8 @@ end;' language 'plpgsql' stable; --- procedure rotate_template select define_function_args('content_type__rotate_template','template_id,content_type,use_context'); + create or replace function content_type__rotate_template (integer,varchar,varchar) returns integer as ' declare @@ -1066,11 +1049,6 @@ type_rec record; begin --- select object_type --- from acs_object_types --- connect by supertype = prior object_type --- start with object_type = ''content_revision'' - for type_rec in select ot.object_type from acs_object_types ot, acs_object_types ot2 where ot2.object_type = ''content_revision'' Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.0.0b3-5.0.0b4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.0.0b3-5.0.0b4.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.0.0b3-5.0.0b4.sql 26 Jan 2004 15:39:43 -0000 1.3 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.0.0b3-5.0.0b4.sql 6 Jul 2005 23:31:01 -0000 1.4 @@ -424,23 +424,6 @@ return 0; end;' language 'plpgsql'; - - -create or replace function content_revision__export_xml (integer) -returns integer as ' -declare - revision_id alias for $1; - clob_loc text; - v_doc_id cr_xml_docs.doc_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception '' content_revision__export_xml Not currently implemented on postgresql''; - -end;' language 'plpgsql'; - - - create or replace function content_keyword__is_assigned (integer,integer,varchar) returns boolean as ' declare @@ -642,35 +625,6 @@ return 0; end;' language 'plpgsql'; - -create or replace function content_revision__import_xml (integer,integer,numeric) -returns integer as ' -declare - import_xml__item_id alias for $1; - import_xml__revision_id alias for $2; - import_xml__doc_id alias for $3; - clob_loc text; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception '' content_revision__import_xml not implemented on postgres''; - -end;' language 'plpgsql'; - - -create or replace function content_revision__index_attributes (integer) -returns integer as ' -declare - index_attributes__revision_id alias for $1; - clob_loc text; - v_revision_id cr_revisions.revision_id%TYPE; -begin - - raise exception ''content_revision__index_attributes not implemented on postgres''; - -end;' language 'plpgsql'; - - create or replace function content_type__get_template (varchar,varchar) returns integer as ' declare