prompt Package Header : jr_gen create or replace package jr_gen is --------------------------------------------------------------------------------- -- Procedure : generate -- -- Note, this procedure is called by jr_registration.generate -- Moved to new package as jr_registration was so big -- Also, the indirection allows for more flexibility -- -- See jr_registration.generate for descriptions of parameters --------------------------------------------------------------------------------- procedure generate ( schema_name varchar2 , log_file_location varchar2 default null , ddl_file_location varchar2 default null , log_file_name varchar2 default 'jr_gen.log' , tables_file varchar2 default 'jrtable.sql' , indexes_file varchar2 default 'jrindex.sql' , constraints_file varchar2 default 'jrcon.sql' , triggers_file varchar2 default 'jrtrig.sql' , functions_file varchar2 default 'jrfunc.sql' , views_file varchar2 default 'jrview.sql' , stored_objs_file varchar2 default 'jrstor.sql' , synonyms_file varchar2 default 'jrsyn.sql' , sequences_file varchar2 default 'jrseq.sql' , regen varchar2 default 'N' ); --------------------------------------------------------------------------------- -- Procedure : gen_plsql_api -- -- Note, this procedure is called by either : -- 1) jr_registration.gen_plsql_api - the public registration interface -- or -- 2) directly when registering our own models so we can set options -- that we don't want to allow for users -- -- See jr_registration.gen_plsql_api for descriptions of parameters -- -- Extra parameters here are : -- -- include_system_objs : Generate an api for system objects ? -- --------------------------------------------------------------------------------- procedure gen_plsql_api ( schema_name varchar2 , log_file_location varchar2 default null , ddl_file_location varchar2 default null , log_file_name varchar2 default 'jr_plgen.log' , plsql_api_file varchar2 default 'jrplsapi.sql' , regenerate boolean default false , include_system_objs boolean default false ); subtype ddl_type is pls_integer; SCHEMA constant ddl_type := 1; TAB constant ddl_type := 2; TAB_PK constant ddl_type := 3; TAB_FK constant ddl_type := 4; TAB_BR_TRIG constant ddl_type := 5; -- BR = Before Row TAB_AR_TRIG constant ddl_type := 6; -- AR = After Row TAB_COMMENT constant ddl_type := 7; VIEWX constant ddl_type := 8; VIEW_DEL_TRIG constant ddl_type := 9; VIEW_COMMENT constant ddl_type := 10; VER_FUN_A constant ddl_type := 11; VER_FUN_B constant ddl_type := 12; CPY_FUN_A constant ddl_type := 13; CPY_FUN_B constant ddl_type := 14; UK_FUN constant ddl_type := 15; TAB_INV_TRIG constant ddl_type := 16; TAB_VAL_TRIG constant ddl_type := 17; FK_FUN constant ddl_type := 18; FK_DEL_FUN constant ddl_type := 19; FK_CM_DEL_FUN constant ddl_type := 20; STORED_OBJ constant ddl_type := 21; NLS_TRIG constant ddl_type := 22; TAB_UK constant ddl_type := 23; VERSION_REGISTRY constant ddl_type := 24; USER_CHECKCON constant ddl_type := 25; USER_TRIGGER constant ddl_type := 26; USER_VIEW constant ddl_type := 27; INDX constant ddl_type := 28; TAB_API constant ddl_type := 29; VIEW_INS_TRIG constant ddl_type := 30; --------------------------------------------------------------------------------- -- Procedure : control_ddl -- -- Method to control what type of ddl is/is not generated and/or executed -- -- the_ddl_type : Type of ddl to generate and/or execute -- execute : Set to true to execute the ddl in the current schema -- write_file : Set to true to write the ddl to file -- -- Thus, the following combinations are possible : -- -- execute write_file outcome -- true true execute in schema and write to file -- true false execute in schema only -- false true generate sql and write to file -- false false do not need to generate sql at all -- -- Note, ddl_file_location must be set in generate call for write_file to work --------------------------------------------------------------------------------- procedure control_ddl ( the_ddl_type ddl_type , execute boolean , write_file boolean ); --------------------------------------------------------------------------------- -- Helper methods for easily enabling or disabling all generation -- It is then sometimes easier to just enable the dll required --------------------------------------------------------------------------------- procedure disable_all_execute; procedure disable_all_write_file; function ddl_execute (the_ddl_type ddl_type) return boolean; function ddl_write_file (the_ddl_type ddl_type) return boolean; end jr_gen; /