Skip to content

Commit

Permalink
Merge 957e5c9 into f69d65c
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippSalvisberg committed Dec 31, 2018
2 parents f69d65c + 957e5c9 commit fb3befc
Show file tree
Hide file tree
Showing 28 changed files with 1,109 additions and 128 deletions.
4 changes: 2 additions & 2 deletions examples/developer_examples/ut_custom_reporter.tpb
Expand Up @@ -16,9 +16,9 @@ create or replace type body ut_custom_reporter is
return tab_str;
end tab;

overriding member procedure print_text(a_text varchar2) is
overriding member procedure print_text(a_text varchar2, a_item_type varchar2 := null) is
begin
(self as ut_documentation_reporter).print_text(tab || a_text);
(self as ut_documentation_reporter).print_text(tab || a_text, a_item_type);
end;

overriding member procedure before_calling_suite(self in out nocopy ut_custom_reporter, a_suite ut_logical_suite) as
Expand Down
2 changes: 1 addition & 1 deletion examples/developer_examples/ut_custom_reporter.tps
Expand Up @@ -5,7 +5,7 @@ create or replace type ut_custom_reporter under ut_documentation_reporter
-- Member functions and procedures
constructor function ut_custom_reporter(a_tab_size integer default 4) return self as result,
overriding member function tab(self in ut_custom_reporter) return varchar2,
overriding member procedure print_text(a_text varchar2),
overriding member procedure print_text(a_text varchar2, a_item_type varchar2 := null),
overriding member procedure before_calling_suite(self in out nocopy ut_custom_reporter, a_suite ut_logical_suite),
overriding member procedure before_calling_test(self in out nocopy ut_custom_reporter, a_test ut_test),
overriding member procedure after_calling_test(self in out nocopy ut_custom_reporter, a_test ut_test),
Expand Down
114 changes: 72 additions & 42 deletions source/api/ut.pkb
Expand Up @@ -175,8 +175,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
ut_varchar2_list(),
Expand All @@ -190,13 +192,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand All @@ -213,8 +218,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
ut_varchar2_list(),
Expand All @@ -228,13 +235,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand All @@ -252,8 +262,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
a_paths,
Expand All @@ -267,13 +279,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand All @@ -291,8 +306,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
a_paths,
Expand All @@ -306,13 +323,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand All @@ -330,8 +350,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
ut_varchar2_list(a_path),
Expand All @@ -345,13 +367,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand All @@ -369,8 +394,10 @@ create or replace package body ut is
a_client_character_set varchar2 := null
) return ut_varchar2_rows pipelined is
l_reporter ut_reporter_base := a_reporter;
l_lines sys_refcursor;
l_line varchar2(4000);
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
l_lines ut_varchar2_list;
begin
run_autonomous(
ut_varchar2_list(a_path),
Expand All @@ -384,13 +411,16 @@ create or replace package body ut is
a_client_character_set
);
if l_reporter is of (ut_output_reporter_base) then
l_lines := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
l_data := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
loop
fetch l_lines into l_line;
exit when l_lines%notfound;
pipe row(l_line);
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
for i in 1 .. l_lines.count loop
pipe row(l_lines(i));
end loop;
end loop;
close l_lines;
close l_data;
end if;
raise_if_packages_invalidated();
return;
Expand Down
7 changes: 4 additions & 3 deletions source/core/output_buffers/ut_output_buffer_base.tps
Expand Up @@ -19,9 +19,10 @@ create or replace type ut_output_buffer_base authid definer as object(
output_id raw(32),
member procedure init(self in out nocopy ut_output_buffer_base),
not instantiable member procedure close(self in ut_output_buffer_base),
not instantiable member procedure send_line(self in ut_output_buffer_base, a_text varchar2),
not instantiable member procedure send_lines(self in ut_output_buffer_base, a_text_list ut_varchar2_rows),
not instantiable member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural := null) return ut_varchar2_rows pipelined,
not instantiable member procedure send_line(self in ut_output_buffer_base, a_text varchar2, a_item_type varchar2 := null),
not instantiable member procedure send_lines(self in ut_output_buffer_base, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
not instantiable member procedure send_clob(self in ut_output_buffer_base, a_text clob, a_item_type varchar2 := null),
not instantiable member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural := null) return ut_output_data_rows pipelined,
not instantiable member function get_lines_cursor(a_initial_timeout natural := null, a_timeout_sec natural := null) return sys_refcursor,
not instantiable member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout natural := null, a_timeout_sec natural := null)
) not final not instantiable
Expand Down
5 changes: 4 additions & 1 deletion source/core/output_buffers/ut_output_buffer_tmp.sql
Expand Up @@ -19,12 +19,14 @@ create table ut_output_buffer_tmp$(
*/
output_id raw(32) not null,
message_id number(38,0) not null,
text varchar2(4000),
text clob,
item_type varchar2(1000),
is_finished number(1,0) default 0 not null,
constraint ut_output_buffer_tmp_pk primary key(output_id, message_id),
constraint ut_output_buffer_tmp_ck check(is_finished = 0 and text is not null or is_finished = 1 and text is null),
constraint ut_output_buffer_fk1 foreign key (output_id) references ut_output_buffer_info_tmp$(output_id)
) organization index overflow nologging initrans 100
lob(text) store as securefile ut_output_text(retention none)
;

-- This is needed to be EBR ready as editioning view can only be created by edition enabled user
Expand Down Expand Up @@ -58,6 +60,7 @@ limitations under the License.
select output_id
,message_id
,text
,item_type
,is_finished
from ut_output_buffer_tmp$';

Expand Down
21 changes: 21 additions & 0 deletions source/core/output_buffers/ut_output_data_row.tps
@@ -0,0 +1,21 @@
create or replace type ut_output_data_row as object (
/*
utPLSQL - Version 3
Copyright 2016 - 2018 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.
*/
text clob,
item_type varchar2(1000)
)
/
19 changes: 19 additions & 0 deletions source/core/output_buffers/ut_output_data_rows.tps
@@ -0,0 +1,19 @@
create or replace type ut_output_data_rows as
/*
utPLSQL - Version 3
Copyright 2016 - 2018 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.
*/
table of ut_output_data_row
/

0 comments on commit fb3befc

Please sign in to comment.