Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Small performance improvements to output buffer handling and some tests.
  • Loading branch information
jgebal committed Feb 11, 2023
commit 28b6eaa53ec15e0fc11c8ff2531388d7e857c645
12 changes: 9 additions & 3 deletions source/api/ut.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,15 @@ create or replace package body ut is
raise_if_packages_invalidated();
raise no_data_found;
end if;
g_result_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
g_result_line_no := g_result_lines.first;
if l_clob is not null and l_clob != empty_clob() then
if length(l_clob) > ut_utils.gc_max_storage_varchar2_len then
g_result_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
else
g_result_lines := ut_varchar2_list(l_clob);
end if;
g_result_line_no := g_result_lines.first;
end if;
end if;

if g_result_line_no is not null then
l_result := g_result_lines(g_result_line_no);
g_result_line_no := g_result_lines.next(g_result_line_no);
Expand Down Expand Up @@ -274,6 +279,7 @@ create or replace package body ut is
if l_reporter is of (ut_output_reporter_base) then
l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
g_result_lines := ut_varchar2_list();
pipe row( get_report_outputs( l_results ) );
end loop;
end if;
Expand Down
10 changes: 6 additions & 4 deletions source/core/output_buffers/ut_output_table_buffer.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ create or replace type body ut_output_table_buffer is

overriding member procedure lines_to_dbms_output(self in ut_output_table_buffer, a_initial_timeout number := null, a_timeout_sec number := null) is
l_data sys_refcursor;
l_text varchar2(32767);
l_item_type varchar2(32767);
l_text ut_varchar2_rows;
l_item_type ut_varchar2_rows;
begin
l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
loop
fetch l_data into l_text, l_item_type;
fetch l_data bulk collect into l_text, l_item_type limit 10000;
for idx in 1 .. l_text.count loop
dbms_output.put_line(l_text(idx));
end loop;
exit when l_data%notfound;
dbms_output.put_line(l_text);
end loop;
close l_data;
end;
Expand Down
14 changes: 14 additions & 0 deletions test/ut3_tester_helper/coverage_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -489,16 +489,30 @@ create or replace package body coverage_helper is
l_coverage_id raw(32) := sys_guid();
begin
l_plsql_block := q'[
declare
x dbms_output.chararr;
i integer := 100000;
begin
execute immediate 'alter session set statistics_level=all';
/*
dbms_hprof.start_profiling(
location => 'PLSHPROF_DIR'
, filename => 'profiler_utPLSQL_run_]'||rawtohex(l_coverage_id)||q'[.txt'
);
*/
ut3_develop.ut_runner.coverage_start(']'||rawtohex(l_coverage_id)||q'[');
ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => true);
--gather coverage on the command executed
begin {a_run_command}; end;
dbms_output.get_lines(x,i);
ut3_develop.ut_coverage.set_develop_mode(a_develop_mode => false);
ut3_develop.ut_runner.coverage_stop();
--get the actual results of the command gathering the coverage
insert into test_results select rownum as id, x.* from table( {a_run_command} ) x;
commit;
/*
dbms_hprof.stop_profiling;
*/
end;]';
l_plsql_block := replace(l_plsql_block,'{a_run_command}',a_run_command);
l_result_clob := run_code_as_job( l_plsql_block );
Expand Down