rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\ciorc.hpb 1.4 1998/10/14 14:05:43 jkchow Exp $ rem Rem Copyright (c) 1995 by Oracle Corporation Rem NAME Rem ciorc.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem cvanes 01/31/95 - Creation REM *************************************************************************** REM Hand-carved package body for ORACLE DATABASE created on 30-JAN-95 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihorc IS -- Generic post-process routines PROCEDURE check_delete(id number); pac_type constant varchar2(6) := 'ODB'; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY ciooracle_database.data) IS 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; --#BEGIN pl.v.database_type := 'ORC'; pl.i.database_type := true; if pl.i.local_name = false then pl.v.local_name := substrb(pl.v.name,1,8); pl.i.local_name := true; end if; --#END 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 ciooracle_database.data) IS gr ciorole.data; save_do_csynch boolean; BEGIN if operation = 'INS' then ciiutl.create_appxxx(pac_type,pl.v.id,pl.v.name); 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; --#BEGIN if cdapi.load_mode or ciiexp.global_copy_mode then return; end if; -- Create a default PUBLIC role gr.v.name := 'PUBLIC'; gr.v.oracle_database_reference := pl.v.id; gr.v.complete_flag := 'Y'; --gr.v.application_system_owned_by := pl.v.application_system_owned_by; gr.v.remark := 'Auto-created when Oracle Database was created.'; gr.v.system_element_flag := 'Y'; -- B648749 gr.i.name := true; gr.i.oracle_database_reference := true; gr.i.complete_flag := true; --gr.i.application_system_owned_by := true; gr.i.remark := true; gr.i.system_element_flag := true; save_do_csynch := rm.do_csynch; rm.do_csynch := true; -- must do this to set system_element_flag ciorole.ins(null,gr); rm.do_csynch := save_do_csynch; elsif operation = 'UPD' and pl.i.name then cioapp_con_interface.traverse('CIHAPPCONU1',id,'APPODB'); --#END end if; END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN if operation = 'DEL' then -- Delete the oracle database 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 oracle database is connected to other application systems END; -- BEGIN --============================= IS LEGAL DB =================================-- FUNCTION is_legal_odb(id rm.reference) RETURN boolean IS db_count number; BEGIN -- Check if the id supplied refers to a legal database -- 0 is a legal value and means 'ALL Databases' and an element of -- type ORACLE_DATABASE is also legal if id = 0 then return(true); else select count(*) into db_count from ci_oracle_databases db where db.id = is_legal_odb.id; if db_count = 1 then return(true); else return(false); end if; end if; END; --============================= VERSION NUMBER ==============================-- -- returns the db_version of the specified database, or null for a non-oracle -- database -- warning: incoming id might be valid, null, zero or for a non-oracle database FUNCTION version_number(id rm.reference) RETURN number IS version_num number; BEGIN version_num := null; select db_version into version_num from ci_oracle_databases where id = version_number.id; return(version_num); exception when no_data_found then null; return(version_num); END; -- END --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /