rem rem $Header: L:\\\\model\\repman40\\api\\RCS\\ciatv.hpb 1.1 1998/05/28 16:04:43 mfrobins Exp $ rem Rem Copyright (c) 1994 by Oracle Corporation Rem NAME Rem ciatv.hpb - Rem DESCRIPTION Rem Rem RETURNS Rem Rem NOTES Rem Rem MODIFIED (MM/DD/YY) Rem jwetherb 10/13/94 - Creation REM *************************************************************************** REM Hand-carved package body for ATTRIBUTE VALUE created on 12-OCT-94 REM *************************************************************************** CREATE OR REPLACE PACKAGE BODY cihatv IS -- Generic post-process routines PROCEDURE check_delete(id number); sac_type constant varchar2(6) := 'ATV'; pac_type varchar2(6); pac_reference number; --======================== PRE-PROCESS (INS,UPD) ============================-- PROCEDURE pre_process(operation varchar2,id number, pl in out NOCOPY cioattribute_value.data) IS BEGIN -- Calculate the PAC reference which determines access control rights -- pac_reference := nvl(nvl(nvl(nvl( -- pl.v.attribute_reference,pl.v.column_reference),pl.v.domain_reference), -- pl.v.module_argument_reference), pl.v.unbound_item_reference); -- pac_type := ciiutl.short_type(pac_reference); -- Access rights for attribute value derive from the attribute/column/ -- domain/module_argument reference -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(pac_reference,pac_type,'UPD'); -- Initialize unassigned properties with default values on INSERT if operation = 'INS' then pl.v.element_type_name := sac_type; pl.i.element_type_name := true; if pl.v.attribute_reference is not null then pl.v.attribute_value_for := 'ATT'; elsif pl.v.column_reference is not null then pl.v.attribute_value_for := 'COL'; elsif pl.v.domain_reference is not null then pl.v.attribute_value_for := 'DOM'; elsif pl.v.unbound_item_reference is not null then pl.v.attribute_value_for := 'UBI'; else pl.v.attribute_value_for := 'ARG'; end if; pl.i.attribute_value_for := true; end if; --#BEGIN -- 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; declare uc varchar2(1); begin if pac_type = 'COL' and pl.i.column_reference then select max(uppercase) into uc from ci_columns where id = pl.v.column_reference; if uc = 'Y' then pl.v.low_value := nls_upper(pl.v.low_value); pl.v.high_value := nls_upper(pl.v.high_value); pl.i.low_value := true; pl.i.high_value := true; end if; end if; end; --#END END; --======================== PRE-PROCESS (DEL,SEL) ============================-- PROCEDURE pre_process(operation varchar2,id number) IS BEGIN -- Access rights for attribute value derive from the attribute/column/ -- domain/module_argument reference -- Access rights checking performed by triggers in config 4.0.9 -- ciiacc.check_access_rights(id,sac_type,operation,'SAC'); -- 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 in out NOCOPY cioattribute_value.data) IS BEGIN null; --#BEGIN -- Reset unused arc references to NULL if pl.v.attribute_value_for != 'ATT' then pl.v.attribute_reference := null; elsif pl.v.attribute_value_for != 'COL' then pl.v.column_reference := null; elsif pl.v.attribute_value_for != 'DOM' then pl.v.domain_reference := null; elsif pl.v.attribute_value_for != 'ARG' then pl.v.module_argument_reference := null; end if; --#END END; --========================= POST PROCESS (DEL) ==============================-- PROCEDURE post_process(operation varchar2,id number) IS BEGIN if operation = 'DEL' then -- Delete the attribute value and all it's related sub-bits ciiutl.delete_element(id,sac_type); end if; END; --============================= CHECK DELETE ================================-- PROCEDURE check_delete(id number) IS dummy number; error_count number := 0; BEGIN null; END; --============================= IS_RANGE_OK =================================-- FUNCTION is_range_ok(low_value in varchar2, high_value in varchar2) RETURN boolean IS low_num number; high_num number; low_date date; high_date date; BEGIN -- The following code test if the string low_value and high_value -- are numbers if they are both numbers then a numeric comparison is -- made otherwise a string comparison is made. if low_value is null or high_value is null then return(false); end if; if high_value = '$$DBDATE$$' then return (true); end if; begin low_num := low_value; high_num := high_value; -- both low_value and high_values are numbers! return(low_num <= high_num); exception when VALUE_ERROR then null; when others then raise; end; return(true); -- Following code is now ignored, as it is impossible to -- discriminate between dates and varchars, without being -- given the format mask, so now no validation is performed. -- Also if these are to be Check Constraints in Oracle8 -- they must be to_date(...), and now it's getting really -- tricky to validate! Dynamic SQL might be a solution? -- B647650 begin low_date := low_value; high_date := high_value; -- both low_value and high_values are dates! return(low_date <= high_date); exception when OTHERS then -- either low_value or high_value is NOT a number or date! -- dbms_output.put_line(SQLCODE); if SQLCODE between -1899 and -1800 then -- these are the date conversion errors -- dbms_output.put_line('A1'); null; else -- dbms_output.put_line('A2'); raise; end if; end; return(low_value <= high_value); END; --================================== END ====================================-- -- -- Package instantiation block -- BEGIN is_installed := true; END; /