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

Skip to content

Commit e0de1b4

Browse files
committed
Fixed issues with file list length and output params
1 parent 9753ddb commit e0de1b4

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

client_source/sqlplus/file_list.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ echo begin>%sqlFile%
1515
echo ^ null;>>%sqlFile%
1616

1717
if not %sourcePath% == "-" (
18-
echo :l_source_files := q'[ut_varchar2_list(>>%sqlFile%
18+
echo open :l_source_files for select * from table(ut_varchar2_list(>>%sqlFile%
1919
call :FileList %sourcePath%
2020
)
2121

2222
if not %testPath% == "-" (
23-
echo :l_test_files := q'[ut_varchar2_list(>>%sqlFile%
23+
echo open :l_test_files for select * from table(ut_varchar2_list(>>%sqlFile%
2424
call :FileList %testPath%
2525
)
2626

@@ -30,9 +30,9 @@ echo />>%sqlFile%
3030
goto :eof
3131

3232
:FileList
33-
for /f "tokens=* delims= " %%a in ('dir %projectPath%\%1\* /B /S') do (
33+
for /f "tokens=* delims= " %%a in ('dir %projectPath%\%1\* /B /S /A:-D') do (
3434
set "filePath=%%a"
3535
set filePath=!filePath:%projectPath%=!
3636
echo ^ '!filePath!^',>>%sqlFile%
3737
)
38-
echo null)]';>>%sqlFile%
38+
echo null));>>%sqlFile%

client_source/sqlplus/file_list.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function fileList {
1313
for f in $(find $projectPath/$1/* -type f | sed "s|$projectPath/||"); do
1414
echo " '$f'," >> $sqlFile
1515
done
16-
echo " null)]';" >> $sqlFile
16+
echo " null));" >> $sqlFile
1717
}
1818

1919
echo "begin" > $sqlFile

client_source/sqlplus/ut_run.sql

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ var l_paths varchar2(4000);
130130
var l_color_enabled varchar2(5);
131131
var l_source_path varchar2(4000);
132132
var l_test_path varchar2(4000);
133-
var l_source_files clob;
134-
var l_test_files clob;
133+
var l_source_files refcursor;
134+
var l_test_files refcursor;
135135
var l_run_params_cur refcursor;
136136
var l_out_params_cur refcursor;
137137
/*
@@ -186,8 +186,8 @@ declare
186186
for param in(
187187
with
188188
param_vals as(
189-
select regexp_substr(column_value,'-([fos])\=?(.*)',1,1,'c',1) param_type,
190-
regexp_substr(column_value,'-([fos])\=(.*)',1,1,'c',2) param_value
189+
select regexp_substr(column_value,'-([a-z_]+)\=?(.*)',1,1,'c',1) param_type,
190+
regexp_substr(column_value,'-([a-z_]+)\=?(.*)',1,1,'c',2) param_value
191191
from table(a_params)
192192
where column_value is not null)
193193
select param_type, param_value
@@ -349,6 +349,7 @@ spool &&client_path/run_in_background.sql.tmp
349349
declare
350350
l_reporter_id varchar2(250);
351351
l_reporter_name varchar2(250);
352+
l_file_path varchar2(32767);
352353
procedure p(a_text varchar2) is begin dbms_output.put_line(a_text); end;
353354
begin
354355
p( 'set serveroutput on size unlimited format truncated');
@@ -364,10 +365,22 @@ begin
364365
loop
365366
fetch :l_run_params_cur into l_reporter_id, l_reporter_name;
366367
exit when :l_run_params_cur%notfound;
367-
if lower(l_reporter_name) in ('ut_coveralls_reporter', 'ut_coverage_sonar_reporter') then
368-
p(' v_reporter := '||l_reporter_name||'( a_file_paths => '||:l_source_files||' );');
368+
if lower(l_reporter_name) in ('ut_coveralls_reporter', 'ut_coverage_sonar_reporter', 'ut_coverage_html_reporter') then
369+
p(' v_reporter := '||l_reporter_name||'( a_file_paths => ut_varchar2_list(');
370+
loop
371+
fetch :l_source_files into l_file_path;
372+
exit when :l_source_files%notfound or l_file_path is null;
373+
p(' '''||l_file_path||''',');
374+
end loop;
375+
p(' null));');
369376
elsif lower(l_reporter_name) = ('ut_sonar_test_reporter') then
370-
p(' v_reporter := '||l_reporter_name||'( a_file_paths => '||:l_test_files||' );');
377+
p(' v_reporter := '||l_reporter_name||'( a_file_paths => ut_varchar2_list(');
378+
loop
379+
fetch :l_test_files into l_file_path;
380+
exit when :l_test_files%notfound or l_file_path is null;
381+
p(' '''||l_file_path||''',');
382+
end loop;
383+
p(' null));');
371384
else
372385
p(' v_reporter := '||l_reporter_name||'();');
373386
end if;

0 commit comments

Comments
 (0)