From d47dd10a83a6a55fa130d90914eb94edc313e743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Mon, 17 Apr 2017 22:35:50 +0100 Subject: [PATCH 1/2] Fixing #273 - Failed to write to dbms_output (Oracle 11g) --- source/api/ut.pkb | 6 +++--- source/api/ut.pks | 6 +++--- source/core/types/ut_varchar2_rows.tps | 19 +++++++++++++++++++ source/core/ut_output_buffer.pkb | 4 ++-- source/core/ut_output_buffer.pks | 2 +- .../create_synonyms_and_grants_for_public.sql | 2 ++ .../create_synonyms_and_grants_for_user.sql | 2 ++ source/install.sql | 1 + source/uninstall.sql | 2 ++ 9 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 source/core/types/ut_varchar2_rows.tps diff --git a/source/api/ut.pkb b/source/api/ut.pkb index 7169dae74..950b78f25 100644 --- a/source/api/ut.pkb +++ b/source/api/ut.pkb @@ -99,7 +99,7 @@ create or replace package body ut is rollback; end; - function run(a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined is + function run(a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := coalesce(a_reporter, ut_documentation_reporter()); l_paths ut_varchar2_list := ut_varchar2_list(sys_context('userenv', 'current_schema')); l_lines sys_refcursor; @@ -115,7 +115,7 @@ create or replace package body ut is close l_lines; end; - function run(a_paths ut_varchar2_list, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined is + function run(a_paths ut_varchar2_list, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := coalesce(a_reporter, ut_documentation_reporter()); l_lines sys_refcursor; l_line varchar2(4000); @@ -130,7 +130,7 @@ create or replace package body ut is close l_lines; end; - function run(a_path varchar2, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined is + function run(a_path varchar2, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined is l_reporter ut_reporter_base := coalesce(a_reporter, ut_documentation_reporter()); l_paths ut_varchar2_list := ut_varchar2_list(coalesce(a_path, sys_context('userenv', 'current_schema'))); l_lines sys_refcursor; diff --git a/source/api/ut.pks b/source/api/ut.pks index c227d13dd..75293ef32 100644 --- a/source/api/ut.pks +++ b/source/api/ut.pks @@ -47,11 +47,11 @@ create or replace package ut authid current_user as procedure fail(a_message in varchar2); - function run(a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined; + function run(a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined; - function run(a_paths ut_varchar2_list, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined; + function run(a_paths ut_varchar2_list, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined; - function run(a_path varchar2, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_list pipelined; + function run(a_path varchar2, a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console integer := 0) return ut_varchar2_rows pipelined; procedure run(a_reporter ut_reporter_base := ut_documentation_reporter(), a_color_console boolean := false); diff --git a/source/core/types/ut_varchar2_rows.tps b/source/core/types/ut_varchar2_rows.tps new file mode 100644 index 000000000..c0ae808cc --- /dev/null +++ b/source/core/types/ut_varchar2_rows.tps @@ -0,0 +1,19 @@ +create or replace type ut_varchar2_rows as + /* + utPLSQL - Version X.X.X.X + Copyright 2016 - 2017 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 varchar2(4000) +/ diff --git a/source/core/ut_output_buffer.pkb b/source/core/ut_output_buffer.pkb index 74ad38f2b..010f9030b 100644 --- a/source/core/ut_output_buffer.pkb +++ b/source/core/ut_output_buffer.pkb @@ -54,9 +54,9 @@ create or replace package body ut_output_buffer is commit; end; - function get_lines(a_reporter_id varchar2, a_timeout_sec naturaln := gc_max_wait_sec) return ut_varchar2_list pipelined is + function get_lines(a_reporter_id varchar2, a_timeout_sec naturaln := gc_max_wait_sec) return ut_varchar2_rows pipelined is pragma autonomous_transaction; - l_results ut_varchar2_list; + l_results ut_varchar2_rows; l_wait_wait_time number(10,1) := 0; l_finished boolean := false; begin diff --git a/source/core/ut_output_buffer.pks b/source/core/ut_output_buffer.pks index 869a040cd..5fda8d4dd 100644 --- a/source/core/ut_output_buffer.pks +++ b/source/core/ut_output_buffer.pks @@ -26,7 +26,7 @@ create or replace package ut_output_buffer authid definer is procedure close(a_reporters ut_reporters); - function get_lines(a_reporter_id varchar2, a_timeout_sec naturaln := gc_max_wait_sec) return ut_varchar2_list pipelined; + function get_lines(a_reporter_id varchar2, a_timeout_sec naturaln := gc_max_wait_sec) return ut_varchar2_rows pipelined; function get_lines_cursor(a_reporter_id varchar2, a_timeout_sec naturaln := gc_max_wait_sec) return sys_refcursor; diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index 503a56abd..d6000225a 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -50,6 +50,7 @@ grant execute on ut_coverage_sonar_reporter to public; grant execute on ut_coveralls_reporter to public; grant execute on ut_reporters to public; grant execute on ut_varchar2_list to public; +grant execute on ut_varchar2_rows to public; grant execute on ut_reporter_base to public; grant execute on ut_coverage to public; grant execute on ut_coverage_helper to public; @@ -85,6 +86,7 @@ create public synonym ut_coverage_sonar_reporter for ut_coverage_sonar_reporter; create public synonym ut_coveralls_reporter for ut_coveralls_reporter; create public synonym ut_reporters for ut_reporters; create public synonym ut_varchar2_list for ut_varchar2_list; +create public synonym ut_varchar2_rows for ut_varchar2_rows; create public synonym ut_reporter_base for ut_reporter_base; create public synonym ut_coverage for ut_coverage; create public synonym ut_coverage_helper for ut_coverage_helper; diff --git a/source/create_synonyms_and_grants_for_user.sql b/source/create_synonyms_and_grants_for_user.sql index e557d41a5..bab674c44 100644 --- a/source/create_synonyms_and_grants_for_user.sql +++ b/source/create_synonyms_and_grants_for_user.sql @@ -51,6 +51,7 @@ grant execute on ut_coverage_sonar_reporter to &ut3_user; grant execute on ut_coveralls_reporter to &ut3_user; grant execute on ut_reporters to &ut3_user; grant execute on ut_varchar2_list to &ut3_user; +grant execute on ut_varchar2_rows to &ut3_user; grant execute on ut_reporter_base to &ut3_user; grant execute on ut_coverage to &ut3_user; grant execute on ut_coverage_helper to &ut3_user; @@ -86,6 +87,7 @@ create or replace synonym &ut3_user .ut_coverage_sonar_reporter for ut_coverage_ create or replace synonym &ut3_user .ut_coveralls_reporter for ut_coveralls_reporter; create or replace synonym &ut3_user .ut_reporters for ut_reporters; create or replace synonym &ut3_user .ut_varchar2_list for ut_varchar2_list; +create or replace synonym &ut3_user .ut_varchar2_rows for ut_varchar2_rows; create or replace synonym &ut3_user .ut_reporter_base for ut_reporter_base; create or replace synonym &ut3_user .ut_coverage for ut_coverage; create or replace synonym &ut3_user .ut_coverage_helper for ut_coverage_helper; diff --git a/source/install.sql b/source/install.sql index 33221a268..06aa9d10f 100644 --- a/source/install.sql +++ b/source/install.sql @@ -35,6 +35,7 @@ whenever oserror exit failure rollback --common utilities @@core/types/ut_varchar2_list.tps +@@core/types/ut_varchar2_rows.tps @@core/types/ut_object_name.tps @@core/types/ut_object_name.tpb @@core/types/ut_object_names.tps diff --git a/source/uninstall.sql b/source/uninstall.sql index f3983d2c6..bdd21556a 100644 --- a/source/uninstall.sql +++ b/source/uninstall.sql @@ -231,6 +231,8 @@ drop type ut_object_name; drop type ut_varchar2_list; +drop type ut_varchar2_rows; + begin for syn in ( select From 4209764f14f6db21584dda754999e352c6f53418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Tue, 18 Apr 2017 23:13:44 +0100 Subject: [PATCH 2/2] Changed varchar2 precision to byte for column data representation. --- source/core/types/ut_varchar2_rows.tps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/types/ut_varchar2_rows.tps b/source/core/types/ut_varchar2_rows.tps index c0ae808cc..5a37917aa 100644 --- a/source/core/types/ut_varchar2_rows.tps +++ b/source/core/types/ut_varchar2_rows.tps @@ -15,5 +15,5 @@ create or replace type ut_varchar2_rows as See the License for the specific language governing permissions and limitations under the License. */ - table of varchar2(4000) + table of varchar2(4000 byte) /