Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28b6eaa

Browse files
committed
Small performance improvements to output buffer handling and some tests.
1 parent 5cf7f34 commit 28b6eaa

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

source/api/ut.pkb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,15 @@ create or replace package body ut is
222222
raise_if_packages_invalidated();
223223
raise no_data_found;
224224
end if;
225-
g_result_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
226-
g_result_line_no := g_result_lines.first;
225+
if l_clob is not null and l_clob != empty_clob() then
226+
if length(l_clob) > ut_utils.gc_max_storage_varchar2_len then
227+
g_result_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
228+
else
229+
g_result_lines := ut_varchar2_list(l_clob);
230+
end if;
231+
g_result_line_no := g_result_lines.first;
232+
end if;
227233
end if;
228-
229234
if g_result_line_no is not null then
230235
l_result := g_result_lines(g_result_line_no);
231236
g_result_line_no := g_result_lines.next(g_result_line_no);
@@ -274,6 +279,7 @@ create or replace package body ut is
274279
if l_reporter is of (ut_output_reporter_base) then
275280
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
276281
loop
282+
g_result_lines := ut_varchar2_list();
277283
pipe row( get_report_outputs( l_results ) );
278284
end loop;
279285
end if;

source/core/output_buffers/ut_output_table_buffer.tpb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ create or replace type body ut_output_table_buffer is
7575

7676
overriding member procedure lines_to_dbms_output(self in ut_output_table_buffer, a_initial_timeout number := null, a_timeout_sec number := null) is
7777
l_data sys_refcursor;
78-
l_text varchar2(32767);
79-
l_item_type varchar2(32767);
78+
l_text ut_varchar2_rows;
79+
l_item_type ut_varchar2_rows;
8080
begin
8181
l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
8282
loop
83-
fetch l_data into l_text, l_item_type;
83+
fetch l_data bulk collect into l_text, l_item_type limit 10000;
84+
for idx in 1 .. l_text.count loop
85+
dbms_output.put_line(l_text(idx));
86+
end loop;
8487
exit when l_data%notfound;
85-
dbms_output.put_line(l_text);
8688
end loop;
8789
close l_data;
8890
end;

test/ut3_tester_helper/coverage_helper.pkb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,16 +489,30 @@ create or replace package body coverage_helper is
489489
l_coverage_id raw(32) := sys_guid();
490490
begin
491491
l_plsql_block := q'[
492+
declare
493+
x dbms_output.chararr;
494+
i integer := 100000;
492495
begin
496+
execute immediate 'alter session set statistics_level=all';
497+
/*
498+
dbms_hprof.start_profiling(
499+
location => 'PLSHPROF_DIR'
500+
, filename => 'profiler_utPLSQL_run_]'||rawtohex(l_coverage_id)||q'[.txt'
501+
);
502+
*/
493503
ut3_develop.ut_runner.coverage_start(']'||rawtohex(l_coverage_id)||q'[');
494504
ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => true);
495505
--gather coverage on the command executed
496506
begin {a_run_command}; end;
507+
dbms_output.get_lines(x,i);
497508
ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => false);
498509
ut3_develop.ut_runner.coverage_stop();
499510
--get the actual results of the command gathering the coverage
500511
insert into test_results select rownum as id, x.* from table( {a_run_command} ) x;
501512
commit;
513+
/*
514+
dbms_hprof.stop_profiling;
515+
*/
502516
end;]';
503517
l_plsql_block := replace(l_plsql_block,'{a_run_command}',a_run_command);
504518
l_result_clob := run_code_as_job( l_plsql_block );

0 commit comments

Comments
 (0)