Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions source/expectations/data_values/ut_compound_data_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ create or replace package body ut_compound_data_helper is
l_col_type := 'VARCHAR2(50)';
elsif a_data_info.is_sql_diffable = 1 and type_no_length(a_data_info.column_type) then
l_col_type := a_data_info.column_type;
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('VARCHAR2','CHAR') then
l_col_type := 'VARCHAR2('||greatest(a_data_info.column_len,4000)||')';
else
l_col_type := a_data_info.column_type
||case when a_data_info.column_len is not null
Expand Down
14 changes: 10 additions & 4 deletions source/expectations/data_values/ut_data_value_refcursor.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,22 @@ create or replace type body ut_data_value_refcursor as
dbms_xmlgen.setNullHandling(l_ctx, dbms_xmlgen.empty_tag);
dbms_xmlgen.setMaxRows(l_ctx, c_bulk_rows);
loop
l_xml := dbms_xmlgen.getxmltype(l_ctx);
l_xml := dbms_xmlgen.getxmltype(l_ctx);
exit when dbms_xmlgen.getNumRowsProcessed(l_ctx) = 0;
--Bug in oracle 12.2+ where XML binary storage trimming insignificant whitespaces.
$if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
l_xml := xmltype( replace(l_xml.getClobVal(),'<ROWSET','<ROWSET xml:space=''preserve'''));
$else
null;
$end
l_elements_count := l_elements_count + dbms_xmlgen.getNumRowsProcessed(l_ctx);
execute immediate
'insert into ' || l_ut_owner || '.ut_compound_data_tmp(data_id, item_no, item_data) ' ||
'values (:self_guid, :self_row_count, :l_xml)'
using in self.data_id, l_set_id, l_xml;
using in self.data_id, l_set_id, l_xml;
l_set_id := l_set_id + c_bulk_rows;
end loop;

ut_expectation_processor.reset_nls_params();
dbms_xmlgen.closeContext(l_ctx);
self.elements_count := l_elements_count;
Expand Down Expand Up @@ -317,8 +324,7 @@ create or replace type body ut_data_value_refcursor as
l_cursor := ut_compound_data_helper.get_compare_cursor(a_diff_cursor_text,
a_self.data_id, a_other.data_id);
--fetch and save rows for display of diff
fetch l_cursor bulk collect into l_diff_tab limit ut_utils.gc_diff_max_rows;

fetch l_cursor bulk collect into l_diff_tab limit ut_utils.gc_diff_max_rows;
exception when others then
if l_cursor%isopen then
close l_cursor;
Expand Down
85 changes: 85 additions & 0 deletions test/ut3_user/expectations/test_expectations_cursor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -2676,6 +2676,91 @@ Check the query and data for errors.';
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);

end;


procedure insginificant_whitespace1 is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select column_value t1 from table(ut_varchar2_list(''));

open l_actual for
select column_value t1 from table(ut_varchar2_list(' '));
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

procedure insginificant_whitespace2 is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select ' t ' t1 from dual;

open l_actual for
select 't' t1 from dual;
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

procedure insginificant_whitespace3 is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select 't ' t1 from dual;

open l_actual for
select 't' t1 from dual;
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

procedure insginificant_whitespace4 is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select ' t' t1 from dual;

open l_actual for
select 't' t1 from dual;
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

procedure insginificant_whitespace5 is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select ' ' t1 from dual;

open l_actual for
select '' t1 from dual;
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

procedure nulltowhitespace is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select cast(null as varchar2(2)) t1 from dual;

open l_actual for
select ' ' t1 from dual;
--Assert
ut3.ut.expect( l_actual ).to_equal( l_expected );
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
end;

end;
/
25 changes: 25 additions & 0 deletions test/ut3_user/expectations/test_expectations_cursor.pks
Original file line number Diff line number Diff line change
Expand Up @@ -418,5 +418,30 @@ create or replace package test_expectations_cursor is
--%test(Check that column name accept non xml characters fix #902)
procedure nonxmlchar_part_of_colname;


/*Oracle Bug not readin properly in xmltable */
--%test ( Compare insiginificant whitespaces scenario 1 )
--%disabled
procedure insginificant_whitespace1;

--%test ( Compare insiginificant whitespaces scenario 2 )
procedure insginificant_whitespace2;

--%test ( Compare insiginificant whitespaces scenario 3 )
procedure insginificant_whitespace3;

--%test ( Compare insiginificant whitespaces scenario 4 )
procedure insginificant_whitespace4;

/*Oracle Bug not readin properly in xmltable */
--%test ( Compare insiginificant whitespaces scenario 5 )
--%disabled
procedure insginificant_whitespace5;

/*Oracle Bug not readin properly in xmltable */
--%test ( Compare null to whitespace )
--%disabled
procedure nulltowhitespace;

end;
/