rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\CITABENT.HPB 1.3 1998/12/30 15:00:40 loldham Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem citabent.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem jwetherb 09/03/94 - Correct params to cieval.check_association REM *************************************************************************** REM Hand-carved package body for TABLE ENTITY created on 22-AUG-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihtabent IS -- Type-specific post-process routines PROCEDURE check_delete(id rm.reference); PROCEDURE upd_tab(tab_ref rm.reference); str_type constant varchar2(6) := 'TABENT'; part_type constant varchar2(6) := 'TAB'; use_type constant varchar2(6) := 'ENT'; tab_ref rm.reference; -- temp table ref used by post-process code tbl_ref number; ent_ref number; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id rm.reference, pl in out NOCOPY ciotable_entity.data) IS BEGIN -- Perform INSERT-specific processing if operation = 'INS' then -- Check for existence of relation definition and entity -- elements if ciiutl.el_exists(pl.v.table_reference,part_type) = false then ciierr.fatal(3500,'TABLE ENTITY','relation_definition', pl.v.table_reference); end if; if ciiutl.el_exists(pl.v.entity_reference,use_type) = false then ciierr.fatal(3500,'TABLE ENTITY','entity', pl.v.entity_reference); end if ; else if ciiutl.el_exists(id,str_type) = false then ciierr.fatal(3504,ciiutl.nls_type_name('TABLE_ENTITY'),id); end if; end if; -- Access rights for table entity derive from the relation definition -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.table_reference,part_type,operation,'SHR'); -- if operation = 'INS' then -- ciiacc.check_access_rights(pl.v.entity_reference, use_type,'SEL','SHR'); -- end if; -- Check that table entity with this relation_definition and -- entity doesn't already exist on insert -- CHECK REPLACED BY DEFERRED CONSTRAINT AT 4.0.6 if operation = 'INS' then -- Initialize unassigned properties with default values on INSERT pl.v.element_type_name := str_type; pl.i.element_type_name := true; end if; -- Validate user-defined properties if cieval.is_extended then cieval.check_association(id,pl.v.types,(operation='UPD') ,pl.v.table_reference ,pl.v.entity_reference ,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; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id rm.reference) IS --declare pl ciotable_entity.data; BEGIN -- Access rights for table entity derive from the relation definition if operation = 'DEL' then -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,str_type,'UPD','MM'); -- Save tab_ref away for later use -- ciotable_entity.sel(id, pl); -- cihtabent.tab_ref := pl.v.table_reference; select table_reference, entity_reference into tbl_ref, ent_ref from ci_tables_entities tabent where tabent.id = pre_process.id; -- else -- ciiacc.check_access_rights(id,str_type,operation,'MM'); end if; END; --===================== POST-PROCESS (INS,UPD,SEL) ==========================-- PROCEDURE post_process(operation varchar2,id rm.reference, pl ciotable_entity.data) IS BEGIN null; --if operation != 'SEL' then -- upd_tab(pl.v.table_reference); --end if; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id rm.reference) IS BEGIN -- upd_tab(cihtabent.tab_ref); update ci_columns col set col.source_attribute_reference = '' where col.table_reference = tbl_ref and exists (select null from ci_attributes att where att.entity_reference = ent_ref and att.id = col.source_attribute_reference); END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id rm.reference) IS dummy number; BEGIN null; END; --============================= upd_tab ================================-- PROCEDURE upd_tab(tab_ref rm.reference) IS -- declare init_vol number; max_vol number; tab_pl ciotable_definition.data; begin SELECT sum(ent.initial_volume) , sum(ent.maximum_volume) INTO init_vol , max_vol FROM ci_entities ent , ci_tables_entities te WHERE ent.id = te.entity_reference AND te.table_reference = upd_tab.tab_ref; if init_vol is not null and max_vol is not null then tab_pl.v.INITIAL_NUMBER_OF_ROWS := init_vol; tab_pl.v.MAXIMUM_NUMBER_OF_ROWS := max_vol; tab_pl.i.INITIAL_NUMBER_OF_ROWS := true; tab_pl.i.MAXIMUM_NUMBER_OF_ROWS := true; ciotable_definition.upd(tab_ref, tab_pl); end if; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /