rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\CIINDCOL.HPB 1.2 1998/12/30 14:56:03 loldham Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem ciindcol.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem jwetherb 10/07/94 - Creation REM *************************************************************************** REM Hand-carved package body for INDEX ENTRY created on 07-OCT-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihindcol IS -- Generic post-process routines PROCEDURE check_delete(id number); str_type constant varchar2(6) := 'INDCOL'; part_type constant varchar2(6) := 'IND'; use_type constant varchar2(6) := 'COL'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioindex_entry.data) IS pac_ref number; BEGIN -- Perform INSERT-specific processing if operation = 'INS' then -- Check for existence of index and column -- elements if ciiutl.el_exists(pl.v.relation_index_reference,part_type) = false then ciierr.fatal(3500,'INDEX ENTRY','index', pl.v.relation_index_reference); end if; if pl.v.column_reference is not null then if ciiutl.el_exists(pl.v.column_reference,use_type) = false then ciierr.fatal(3500,'INDEX ENTRY','column', pl.v.column_reference); end if ; end if; else if ciiutl.el_exists(id,str_type) = false then ciierr.fatal(3504,ciiutl.nls_type_name('INDEX_ENTRY'),id); end if; end if; -- Access rights for index entry derive from the -- index's table -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pl.v.relation_index_reference,part_type, -- 'UPD','SAC'); -- if operation = 'INS' and pl.v.column_reference is not null then -- ciiacc.check_access_rights(pl.v.column_reference, use_type,'SEL','SAC'); -- end if; -- Check that index entry with this index and -- column 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; --#BEGIN if pl.i.sequence_number = false then if pl.v.column_reference is null then pl.v.sequence_number := ciiexp.default_seq( get_pac_ref(pl.v.relation_index_reference, 'RIN'), str_type); else pl.v.sequence_number := ciiexp.default_str_seq( pl.v.relation_index_reference, pl.v.column_reference, str_type, NULL, 'COLUMN_REF'); end if; pl.i.sequence_number := true; end if; select name into pl.v.name from ci_indexes where id = pl.v.relation_index_reference; pl.i.name := true; if pl.i.column_reference then pl.v.index_entry_for := 'COL'; elsif pl.i.cqa_reference then pl.v.index_entry_for := 'CQA'; else pl.v.index_entry_for := 'INDEX_FUNCTION'; end if; pl.i.index_entry_for := true; --#END end if; -- 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; END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- Access rights for index entry derive from the -- index's table -- Access rights checking performed by triggers in config 4.0.9 /* if operation = 'DEL' then ciiacc.check_access_rights(id,str_type,'UPD','OSE'); else ciiacc.check_access_rights(id,str_type,operation,'OSE'); end if; */ -- 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 cioindex_entry.data) IS BEGIN null; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN null; 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 /* REMOVED- Bug 516577, 568009 */ END; --============================= GET PAC_REF ================================-- FUNCTION get_pac_ref(id number, type varchar2) RETURN number IS pac_ref number; tab_name varchar2(40); big_str varchar2(2000); cur_id integer; ret_val integer; BEGIN -- Need to get owning PAC to check access rights tab_name := ciiexp.get_table_name(type); cur_id := DBMS_SQL.OPEN_CURSOR; big_str := 'select el.pac_ref'|| ' from ' || tab_name || ' el'|| ' where el.irid = :id'; dbms_sql.parse(cur_id, big_str, dbms_sql.native); dbms_sql.bind_variable(cur_id, ':id', id); dbms_sql.define_column(cur_id, 1, pac_ref); ret_val := dbms_sql.execute_and_fetch(cur_id); if (ret_val > 0) then dbms_sql.column_value(cur_id, 1, pac_ref); elsif (ret_val = 0) then --element not contained in workarea views ciierr.fatal(6087,type,id ); end if; DBMS_SQL.CLOSE_CURSOR(cur_id); return pac_ref; END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /