Skip to content

Commit fab120e

Browse files
authored
Merge branch 'develop' into feature/pure_sql
2 parents 0c994a4 + 08496bd commit fab120e

File tree

11 files changed

+138
-36
lines changed

11 files changed

+138
-36
lines changed

source/api/ut_runner.pkb

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -226,32 +226,21 @@ create or replace package body ut_runner is
226226
end;
227227

228228
function get_reporters_list return tt_reporters_info pipelined is
229-
l_cursor sys_refcursor;
230229
l_owner varchar2(128) := upper(ut_utils.ut_owner());
231-
l_results tt_reporters_info;
232-
c_bulk_limit constant integer := 10;
233-
l_view_name varchar2(200) := ut_metadata.get_dba_view('dba_types');
230+
l_reporters ut_reporters_info;
231+
l_result t_reporter_rec;
234232
begin
235-
open l_cursor for q'[
236-
SELECT
237-
owner || '.' || type_name,
238-
CASE
239-
WHEN sys_connect_by_path(owner||'.'||type_name,',') LIKE '%]' || l_owner || q'[.UT_OUTPUT_REPORTER_BASE%'
240-
THEN 'Y'
241-
ELSE 'N'
242-
END is_output_reporter
243-
FROM ]'||l_view_name||q'[ t
244-
WHERE instantiable = 'YES'
245-
CONNECT BY supertype_name = PRIOR type_name AND supertype_owner = PRIOR owner
246-
START WITH type_name = 'UT_REPORTER_BASE' AND owner = ']'|| l_owner || '''';
247233
loop
248-
fetch l_cursor bulk collect into l_results limit c_bulk_limit;
249-
for i in 1 .. l_results.count loop
250-
pipe row (l_results(i));
234+
l_reporters := ut_utils.get_child_reporters( l_reporters );
235+
exit when l_reporters is null or l_reporters.count = 0;
236+
for i in 1 .. l_reporters.count loop
237+
if l_reporters(i).is_instantiable = 'Y' then
238+
l_result.reporter_object_name := l_owner||'.'||l_reporters(i).object_name;
239+
l_result.is_output_reporter := l_reporters(i).is_output_reporter;
240+
pipe row( l_result );
241+
end if;
251242
end loop;
252-
exit when l_cursor%notfound;
253243
end loop;
254-
close l_cursor;
255244
end;
256245

257246
end ut_runner;

source/api/ut_runner.pks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ create or replace package ut_runner authid current_user is
126126

127127

128128
type t_reporter_rec is record (
129-
reporter_object_name varchar2(250),
130-
is_output_reporter varchar2(1) --Y/N flag
129+
reporter_object_name varchar2(250), -- full reporter name in format: owner.name
130+
is_output_reporter varchar2(1) -- Y/N indication of reporter providing output for API
131131
);
132132
type tt_reporters_info is table of t_reporter_rec ;
133133

source/core/output_buffers/ut_output_buffer_tmp.sql

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
create table ut_output_buffer_tmp$(
1+
declare
2+
v_table_sql varchar2(32767);
3+
e_non_assm exception;
4+
pragma exception_init(e_non_assm, -43853);
5+
begin
6+
v_table_sql := 'create table ut_output_buffer_tmp$(
27
/*
38
utPLSQL - Version 3
49
Copyright 2016 - 2018 utPLSQL Project
@@ -25,9 +30,18 @@ create table ut_output_buffer_tmp$(
2530
constraint ut_output_buffer_tmp_pk primary key(output_id, message_id),
2631
constraint ut_output_buffer_tmp_ck check(is_finished = 0 and text is not null or is_finished = 1 and text is null),
2732
constraint ut_output_buffer_fk1 foreign key (output_id) references ut_output_buffer_info_tmp$(output_id)
28-
) organization index overflow nologging initrans 100
29-
lob(text) store as securefile ut_output_text(retention none)
30-
;
33+
) organization index overflow nologging initrans 100 ';
34+
begin
35+
execute immediate
36+
v_table_sql || 'lob(text) store as securefile ut_output_text(retention none)';
37+
exception
38+
when e_non_assm then
39+
execute immediate
40+
v_table_sql || 'lob(text) store as basicfile ut_output_text(pctversion 0)';
41+
42+
end;
43+
end;
44+
/
3145

3246
-- This is needed to be EBR ready as editioning view can only be created by edition enabled user
3347
declare

source/core/output_buffers/ut_output_table_buffer.tpb

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ create or replace type body ut_output_table_buffer is
8989
lc_long_sleep_time constant number(1) := 1; --sleep for 1 s when waiting long
9090
lc_long_wait_time constant number(1) := 1; --waiting more than 1 sec
9191
l_sleep_time number(2,1) := lc_short_sleep_time;
92+
lc_bulk_limit constant integer := 100;
9293

9394
procedure remove_read_data(a_message_ids ut_integer_list) is
9495
pragma autonomous_transaction;
@@ -99,13 +100,26 @@ create or replace type body ut_output_table_buffer is
99100
commit;
100101
end;
101102

102-
begin
103-
loop
104-
select a.message_id, ut_output_data_row(a.text, a.item_type)
103+
procedure remove_buffer_info is
104+
pragma autonomous_transaction;
105+
begin
106+
delete from ut_output_buffer_info_tmp a
107+
where a.output_id = self.output_id;
108+
commit;
109+
end;
110+
111+
begin
112+
while not l_finished loop
113+
with ordered_buffer as (
114+
select a.message_id, ut_output_data_row(a.text, a.item_type)
115+
from ut_output_buffer_tmp a
116+
where a.output_id = self.output_id
117+
order by a.message_id
118+
)
119+
select b.*
105120
bulk collect into l_message_ids, l_buffer_data
106-
from ut_output_buffer_tmp a
107-
where a.output_id = self.output_id
108-
order by a.message_id;
121+
from ordered_buffer b
122+
where rownum <= lc_bulk_limit;
109123

110124
--nothing fetched from output, wait and try again
111125
if l_buffer_data.count = 0 then
@@ -130,7 +144,12 @@ create or replace type body ut_output_table_buffer is
130144
end loop;
131145
end if;
132146
remove_read_data(l_message_ids);
133-
exit when l_already_waited_for >= l_wait_for or l_finished;
147+
if l_finished then
148+
remove_buffer_info();
149+
end if;
150+
if l_already_waited_for >= l_wait_for then
151+
l_finished := true;
152+
end if;
134153
end loop;
135154
return;
136155
end;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
create or replace type ut_reporter_info as object (
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"):
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
object_name varchar2(250),
19+
is_output_reporter varchar2(1),
20+
is_instantiable varchar2(1),
21+
is_final varchar2(1)
22+
)
23+
/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
create or replace type ut_reporters_info as
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"):
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
table of ut_reporter_info;
19+
/

source/core/ut_utils.pkb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,5 +692,32 @@ create or replace package body ut_utils is
692692
return l_result;
693693
end;
694694

695+
function get_child_reporters(a_for_reporters ut_reporters_info := null) return ut_reporters_info is
696+
l_for_reporters ut_reporters_info := a_for_reporters;
697+
l_results ut_reporters_info;
698+
begin
699+
if l_for_reporters is null then
700+
l_for_reporters := ut_reporters_info(ut_reporter_info('UT_REPORTER_BASE','N','N','N'));
701+
end if;
702+
703+
select /*+ cardinality(f 10) */
704+
ut_reporter_info(
705+
object_name => t.type_name,
706+
is_output_reporter =>
707+
case
708+
when f.is_output_reporter = 'Y' or t.type_name = 'UT_OUTPUT_REPORTER_BASE'
709+
then 'Y' else 'N'
710+
end,
711+
is_instantiable => case when t.instantiable = 'YES' then 'Y' else 'N' end,
712+
is_final => case when t.final = 'YES' then 'Y' else 'N' end
713+
)
714+
bulk collect into l_results
715+
from user_types t
716+
join (select * from table(l_for_reporters) where is_final = 'N' ) f
717+
on f.object_name = supertype_name;
718+
719+
return l_results;
720+
end;
721+
695722
end ut_utils;
696723
/

source/core/ut_utils.pks

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ create or replace package ut_utils authid definer is
2121
*
2222
*/
2323

24-
gc_version constant varchar2(50) := 'v3.1.4.2480-develop';
24+
gc_version constant varchar2(50) := 'v3.1.4.2493-develop';
2525

2626
/* Constants: Event names */
2727
subtype t_event_name is varchar2(30);
@@ -358,5 +358,10 @@ create or replace package ut_utils authid definer is
358358
*/
359359
function replace_multiline_comments(a_source clob) return clob;
360360

361+
/**
362+
* Returns list of sub-type reporters for given list of super-type reporters
363+
*/
364+
function get_child_reporters(a_for_reporters ut_reporters_info := null) return ut_reporters_info;
365+
361366
end ut_utils;
362367
/

source/install.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ alter session set current_schema = &&ut3_owner;
4646
@@install_component.sql 'core/types/ut_object_names.tps'
4747
@@install_component.sql 'core/types/ut_key_value_pair.tps'
4848
@@install_component.sql 'core/types/ut_key_value_pairs.tps'
49+
@@install_component.sql 'core/types/ut_reporter_info.tps'
50+
@@install_component.sql 'core/types/ut_reporters_info.tps'
4951
@@install_component.sql 'core/ut_utils.pks'
5052
@@install_component.sql 'core/ut_metadata.pks'
5153
@@install_component.sql 'core/ut_utils.pkb'

source/uninstall_objects.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ drop package ut_event_manager;
269269

270270
drop type ut_event_item force;
271271

272+
drop type ut_reporters_info force;
273+
274+
drop type ut_reporter_info force;
275+
272276
drop type ut_key_anyval_pair force;
273277

274278
drop type ut_key_anyval_pairs force;

0 commit comments

Comments
 (0)