-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathut_metadata.pks
More file actions
169 lines (139 loc) · 5.17 KB
/
ut_metadata.pks
File metadata and controls
169 lines (139 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
create or replace package ut_metadata authid current_user as
/*
utPLSQL - Version 3
Copyright 2016 - 2021 utPLSQL Project
Licensed under the Apache License, Version 2.0 (the "License"):
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Common package for all code that reads from the system tables.
*/
type t_anytype_members_rec is record (
type_code pls_integer,
schema_name varchar2(128),
type_name varchar2(128),
length pls_integer,
elements_count pls_integer,
version varchar2(32767),
precision pls_integer,
scale pls_integer,
char_set_id pls_integer,
char_set_frm pls_integer
);
type t_anytype_elem_info_rec is record (
type_code pls_integer,
attribute_name varchar2(260),
length pls_integer,
version varchar2(32767),
precision pls_integer,
scale pls_integer,
char_set_id pls_integer,
char_set_frm pls_integer,
attr_elt_type anytype
);
/**
* Forms correct object/subprogram name to call as owner.object[.subprogram]
*
*/
function form_name(a_owner_name varchar2, a_object varchar2, a_subprogram varchar2 default null) return varchar2;
/**
* Check if package exists and is in a VALID state
*
*/
function package_valid(a_owner_name varchar2, a_package_name in varchar2) return boolean;
/**
* Check if package exists and is VALID and contains the given procedure.
*
*/
function procedure_exists(a_owner_name varchar2, a_package_name in varchar2, a_procedure_name in varchar2)
return boolean;
/**
* Return the text of the source line for a given object (body). It excludes package spec and type spec
*/
function get_source_definition_line(a_owner varchar2, a_object_name varchar2, a_line_no integer) return varchar2;
/**
* Invalidates package-level cache for source.
* Caching is used to improve performance of function get_source_definition_line
*/
procedure reset_source_definition_cache;
/**
* Returns dba_... view name if it is accessible, otherwise it returns all_... view
* @param a_dba_view_name the name of dba view requested
*/
function get_dba_view(a_dba_view_name varchar2) return varchar2;
/**
* Returns dba_source if accessible otherwise returns all_source
*/
function get_source_view_name return varchar2;
/**
* Returns dba_objects if accessible otherwise returns all_objects
*/
function get_objects_view_name return varchar2;
/**
* Returns true if object is accessible to current user
* @param a_object_name fully qualified object name (with schema name)
*/
function is_object_visible(a_object_name varchar2) return boolean;
/**
* Returns true if current user has execute any procedure privilege
* The check is performed by checking if user can execute ut_utils package
*/
function user_has_execute_any_proc return boolean;
/**
* Returns true if given object is a package and it exists in current schema
* @param a_object_name the name of the object to be checked
*/
function package_exists_in_cur_schema(a_object_name varchar2) return boolean;
/**
* Returns true if given typecode is a collection typecode
*/
function is_collection(a_anytype_code in integer) return boolean;
/**
* Returns true if given object is a collection
*/
function is_collection(a_owner varchar2, a_type_name varchar2) return boolean;
/**
* Returns a descriptor of anytype
*/
function get_anytype_members_info( a_anytype anytype ) return t_anytype_members_rec;
/**
* Returns a descriptor of anytype attribute
*/
function get_attr_elem_info( a_anytype anytype, a_pos pls_integer := null ) return t_anytype_elem_info_rec;
/**
* Returns ANYTYPE descriptor of an object type
*/
function get_user_defined_type(a_owner varchar2, a_type_name varchar2) return anytype;
/**
* Return fully qualified name of the object from collection, if not collection returns null
*/
function get_collection_element(a_anydata in anydata) return varchar2;
/**
* Check if collection got elements
*/
function has_collection_members (a_anydata in anydata) return boolean;
/**
* Get typename from anydata
*/
function get_anydata_typename(a_data_value anydata) return varchar2;
/**
* Is anydata object/collection is null
*/
function is_anytype_null(a_value in anydata, a_compound_type in varchar2) return number;
/**
* Get object name from fully qualified name e.g ut3.test -> test
*/
function get_object_name(a_full_object_name in varchar2) return varchar2;
/**
* Based on anydata decide if its a object or collection
*/
function get_anydata_compound_type(a_data_value anydata) return varchar2;
end ut_metadata;
/