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

Skip to content

Commit 71d0b70

Browse files
committed
Fixed issues with comment-replace in big package specs.
1 parent 1adf35d commit 71d0b70

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

examples/developer_examples/RunExampleTestAnnotationsParsingTimeHugePackage.sql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
--Shows that even a very large package specification can be parsed quite quickly
22
--Clear Screen
3-
Set Serveroutput On Size Unlimited format truncated
3+
set serveroutput on
44
set echo off
55
--install the example unit test packages
66
@@tst_pkg_huge.pks
77

88
declare
99
l_suites ut_suite_items;
10+
l_items ut_suite_items;
1011
begin
1112
l_suites := ut_suite_manager.configure_execution_by_path(ut_varchar2_list(USER||'.TST_PKG_HUGE'));
13+
l_items := treat(
14+
treat( treat( l_suites( 1 ) as ut_logical_suite ).items( 1 ) as ut_logical_suite ).items( 1 )
15+
as ut_logical_suite
16+
).items;
17+
dbms_output.put_line('Created '||l_items.count||' tests in suite');
18+
dbms_output.put_line(' Last test name='||l_items(l_items.last).name);
1219
end;
1320
/
1421

source/core/annotations/ut_annotation_parser.pkb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ create or replace package body ut_annotation_parser as
130130
-- parse the comment block for the syntactically correct annotations and store them as an array
131131
add_annotations(a_annotations, l_proc_comments, a_comments, l_proc_name);
132132

133-
l_annot_proc_ind := regexp_instr(srcstr => a_source
134-
,pattern => ';'
135-
,occurrence => 1
136-
,position => l_annot_proc_ind + length(l_annot_proc_block) );
133+
l_annot_proc_ind := instr(a_source, ';', l_annot_proc_ind + length(l_annot_proc_block) );
137134
end loop;
138135
end add_procedure_annotations;
139136

@@ -197,7 +194,7 @@ create or replace package body ut_annotation_parser as
197194
l_comment_index positive;
198195
begin
199196

200-
l_source := ut_utils.replace_multiline_comments(l_source);
197+
l_source := ut_utils.replace_multiline_comments(l_source);
201198

202199
-- replace all single line comments with {COMMENT#12} element and store it's content for easier processing
203200
-- this call modifies l_source

source/core/ut_utils.pkb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab,
616616
end if;
617617

618618
if l_end = 0 then
619-
append_to_clob(l_result, dbms_lob.substr(a_source, l_length-l_offset, l_offset));
619+
append_to_clob(l_result, substr(a_source, l_offset, l_length-l_offset));
620620
else
621-
append_to_clob(l_result, dbms_lob.substr(a_source, l_end-l_offset, l_offset));
621+
append_to_clob(l_result, substr(a_source, l_offset, l_end-l_offset));
622622
end if;
623623
end if;
624624
l_offset := l_end;
@@ -635,7 +635,7 @@ procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab,
635635
l_escaped_text_start := instr(a_source,q'[q']',l_offset);
636636
end if;
637637
end loop;
638-
append_to_clob(l_result, dbms_lob.substr(a_source, offset=>l_end));
638+
append_to_clob(l_result, substr(a_source, l_end));
639639
return l_result;
640640
end;
641641

0 commit comments

Comments
 (0)