rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\civw.hpb 1.4 1998/10/14 14:10:07 jkchow Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem civw.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem jwetherb 10/07/94 - Add log_change for UID constraint Rem jwetherb 09/29/94 - Creation REM *************************************************************************** REM Hand-carved package body for VIEW DEFINITION created on 26-SEP-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihvw IS -- Generic post-process routines PROCEDURE check_delete(id number); pac_type constant varchar2(6) := 'TAB'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioview_definition.data) IS dummy number; old_obj_type_ref number; BEGIN -- Access control checks -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.id,pac_type,operation,'SHR'); -- Validate user-defined properties if cieval.is_extended then cieval.check_element(id,pl.v.types,(operation='UPD') ,pl.v.user_defined_property_0,pl.i.user_defined_property_0 ,pl.v.user_defined_property_1,pl.i.user_defined_property_1 ,pl.v.user_defined_property_2,pl.i.user_defined_property_2 ,pl.v.user_defined_property_3,pl.i.user_defined_property_3 ,pl.v.user_defined_property_4,pl.i.user_defined_property_4 ,pl.v.user_defined_property_5,pl.i.user_defined_property_5 ,pl.v.user_defined_property_6,pl.i.user_defined_property_6 ,pl.v.user_defined_property_7,pl.i.user_defined_property_7 ,pl.v.user_defined_property_8,pl.i.user_defined_property_8 ,pl.v.user_defined_property_9,pl.i.user_defined_property_9 ,pl.v.user_defined_property_10,pl.i.user_defined_property_10 ,pl.v.user_defined_property_11,pl.i.user_defined_property_11 ,pl.v.user_defined_property_12,pl.i.user_defined_property_12 ,pl.v.user_defined_property_13,pl.i.user_defined_property_13 ,pl.v.user_defined_property_14,pl.i.user_defined_property_14 ,pl.v.user_defined_property_15,pl.i.user_defined_property_15 ,pl.v.user_defined_property_16,pl.i.user_defined_property_16 ,pl.v.user_defined_property_17,pl.i.user_defined_property_17 ,pl.v.user_defined_property_18,pl.i.user_defined_property_18 ,pl.v.user_defined_property_19,pl.i.user_defined_property_19 ); end if; -- Initialize unassigned properties with default values on INSERT if operation = 'INS' then pl.v.element_type_name := pac_type; pl.i.element_type_name := true; pl.v.table_type := 'VIEW'; pl.i.table_type := true; end if; --#BEGIN if pl.i.name then -- replace spaces with underscores cihtbl.remove_spaces(pl.v.name); --B631806 end if; if pl.i.column_prefix then -- replace spaces with underscores pl.v.column_prefix := translate(pl.v.column_prefix,' ','_'); end if; if pl.i.alias then -- replace spaces with underscores cihtbl.remove_spaces(pl.v.alias); --B631806 end if; if cdapi.load_mode then return; end if; -- 04Feb97 CvE 510491 et al Removed great chunk of code supporting MLT for Views --#END if operation = 'UPD' and pl.i.oracle_object_type_reference then -- Get the existing oracle object type reference -- This tells us if the view is object or relational select tab.oracle_object_type_ref into old_obj_type_ref from sdd_tab tab where tab.irid = pl.v.id; -- Trying to change view from object to relational - not allowed if old_obj_type_ref is not null and pl.v.oracle_object_type_reference is null then ciierr.fatal(1194,ciiutl.identify(pl.v.id, pl.v.types)); end if; -- Trying to change view from relational to object - not allowed if old_obj_type_ref is null and pl.v.oracle_object_type_reference is not null then ciierr.fatal(1194,ciiutl.identify(pl.v.id, pl.v.types)); end if; end if; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- Access control checks -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,pac_type,operation,'SHR'); -- if operation is 'DELETE', make sure no non-cascading references exist if operation = 'DEL' then check_delete(id); end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id number, pl cioview_definition.data) IS BEGIN if operation = 'INS' then ciiutl.create_appxxx(pac_type,pl.v.id,pl.v.name); end if; --#BEGIN if pl.i.name or pl.i.alias then if operation = 'UPD' then cioapp_con_interface.traverse('CIHAPPCONU1',id,'APPTAB'); end if; if pl.i.name then -- check name is a valid ORACLE name if cihtbl.is_name_valid(pl.v.name) then ciierr.fatal(1003,ciiutl.identify(pl.v.id, pl.v.types),pl.v.name); end if; end if; if pl.i.alias then --Check that alias is a valid ORACLE name if cihtbl.is_name_valid(pl.v.alias) then ciierr.fatal(1003,ciiutl.identify(pl.v.id, pl.v.types),pl.v.alias); end if; end if; end if; --#END END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN if operation = 'DEL' then -- Delete the view definition and all it's related sub-bits ciiutl.delete_element(id,pac_type); end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS dummy number; error_count number := 0; BEGIN null; -- 4.0.12 Removed all simple delete checking -- Check if this view definition is connected to other application systems -- Check if any MTIs are connected to me -- Check if any VWTABs are connected to me -- Check if any FCOs are connected to me -- (that I don't own - you can delete pig's ears) select count(*) into dummy from ci_foreign_key_constraints where foreign_table_reference = check_delete.id and table_reference != check_delete.id; if dummy > 0 then ciierr.post(101,ciiutl.identify(id, 'VW'), ciiutl.nls_type_plural_name_s('FCO'), ciiutl.nls_type_name_s('TBL')); error_count := 1; end if; -- -- Check if any COLs are connected to me that are the source of a -- denormailsed column in another table. select count(*) into dummy from ci_columns c1 where c1.table_reference = check_delete.id and exists (select null from ci_columns c2 where c2.column_denormalised_from = c1.id and c2.table_reference != check_delete.id); if dummy > 0 then ciierr.post(101,ciiutl.identify(id, 'VW'), ciiutl.nls_type_plural_name_s('COL'), ciiutl.nls_type_name_s('TBL')); error_count := 1; end if; if error_count > 0 then raise cdapi.apierror; end if; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /