|
| 1 | +create or replace package ut_annotations as |
| 2 | + /* |
| 3 | + package: ut_annotations |
| 4 | + |
| 5 | + Responsible for parsing and accessing utplsql annotations. |
| 6 | + |
| 7 | + */ |
| 8 | + |
| 9 | + subtype t_annotation_name is varchar2(1000); |
| 10 | + subtype t_procedure_name is varchar2(30); |
| 11 | + |
| 12 | + /* |
| 13 | + type: typ_annotation_param |
| 14 | + |
| 15 | + a key/value pair of annotation parameters |
| 16 | + |
| 17 | + example: |
| 18 | + --%test(name=A name of the test) |
| 19 | + will be stored as: |
| 20 | + typ_annotation_param( key=> 'name', value=>'A name of the test' ) |
| 21 | + */ |
| 22 | + type typ_annotation_param is record( |
| 23 | + key varchar2(255) |
| 24 | + ,value varchar2(4000)); |
| 25 | + |
| 26 | + /* |
| 27 | + type: typ_annotation_param |
| 28 | + a list of typ_annotation_param |
| 29 | + */ |
| 30 | + type tt_annotation_params is table of typ_annotation_param index by pls_integer; |
| 31 | + |
| 32 | + /* |
| 33 | + type: tt_annotations |
| 34 | + a list of tt_annotation_params index by the annotation name |
| 35 | + */ |
| 36 | + type tt_annotations is table of tt_annotation_params index by t_annotation_name; |
| 37 | + |
| 38 | + /* |
| 39 | + type: tt_procedure_annotations |
| 40 | + a list of tt_annotations index by the procedure name |
| 41 | + */ |
| 42 | + type tt_procedure_annotations is table of tt_annotations index by t_procedure_name; |
| 43 | + |
| 44 | + /* |
| 45 | + type: typ_annotated_package |
| 46 | + a structure containing a list of package level annotations and a list of procedure level annotations |
| 47 | + |
| 48 | + */ |
| 49 | + type typ_annotated_package is record( |
| 50 | + procedure_annotations tt_procedure_annotations |
| 51 | + ,package_annotations tt_annotations); |
| 52 | + |
| 53 | + /* |
| 54 | + INTERNAL USE ONLY |
| 55 | + */ |
| 56 | + function parse_package_annotations(a_source clob) return typ_annotated_package; |
| 57 | + |
| 58 | + /* |
| 59 | + function: get_package_annotations |
| 60 | + |
| 61 | + get annotations for specified package specification and return its annotated schema |
| 62 | + */ |
| 63 | + function get_package_annotations(a_owner_name varchar2, a_name varchar2) return typ_annotated_package; |
| 64 | + |
| 65 | + |
| 66 | + /* |
| 67 | + function: get_annotation_param |
| 68 | + |
| 69 | + get annotation parameter on a specified index position |
| 70 | + */ |
| 71 | + function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2; |
| 72 | + |
| 73 | +end ut_annotations; |
| 74 | +/ |
0 commit comments