with generator_support; use generator_support; with string_pack; use string_pack; package body concrete_package is function strip_this(source, this : in string) return string is begin return strip(source(1..indx(source, this) - 1)); end strip_this; function find_concrete_type(base_type : in base_specific_domain_types) return string is position : integer := 0; other, temp_string : string (1..100) := (others => ' '); begin for i in sql_types loop position := base_specific_domain_types'pos(base_type); move (corresponding_concrete_types'image(corresponding_concrete_types'val(position)), other); if indx(other, sql_types'image(i)) /= 0 then -- i is the concrete type of the parameter if i = enumeration -- we must convert the value to a char to use/store in the database then is_enumeration := true; if indx(base_specific_domain_types'image (base_type), "_TYPE") /= 0 -- this is the null bearing type then move(strip_this(base_specific_domain_types'image (base_type), "_TYPE") & "_NOT_NULL", temp_string); return ("CHAR(" & strip(temp_string) & "'image(without_null("); else return("CHAR(" & base_specific_domain_types'image(base_type) & "'image"); end if; else is_enumeration := false; return sql_types'image(i); end if; end if; end loop; end find_concrete_type; function find_only_concrete_type(base_type : in base_specific_domain_types) return string is position : integer := 0; other, temp_string : string (1..100) := (others => ' '); begin for i in sql_types loop position := base_specific_domain_types'pos(base_type); move (corresponding_concrete_types'image(corresponding_concrete_types'val(position)), other); if indx(other, sql_types'image(i)) /= 0 then -- i is the concrete type of the parameter if i = enumeration -- we must convert the value to a char to use/store in the database then return ("CHAR"); else return sql_types'image(i); end if; end if; end loop; end find_only_concrete_type; function find_length(base_type : in base_specific_domain_types) return string is position : integer := 0; other : string (1..100) := (others => ' '); begin position := base_specific_domain_types'pos(base_type); move (corresponding_concrete_types'image(corresponding_concrete_types'val(position)), other); if indx(other, "ENUMERATION") = 0 -- then this is not an enumeration type. then return(other((indx(other, "CHAR") + 5)..strip(other)'last)); else return(integer'image(longest_enum_value));-- if it is an enum type return the longest enum -- value as the length of the 'char' end if; end; end concrete_package;