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

Skip to content

Commit 4b9133e

Browse files
committed
Fixing issue with null vs null being returned as false.
Fixing change in Oracle 12.2+ where XML is stored as binary XML and not preserving insignificant white space. This require store data as clob.
1 parent 10e2f86 commit 4b9133e

5 files changed

Lines changed: 34 additions & 5 deletions

File tree

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ create or replace package body ut_compound_data_helper is
3434
,position + x.item_no item_no
3535
{:columns:}
3636
from {:ut3_owner:}.ut_compound_data_tmp x,
37-
xmltable('/ROWSET/ROW' passing x.item_data columns
37+
xmltable('/ROWSET/ROW' passing xmltype(x.item_data) columns
3838
item_data xmltype path '*'
3939
,position for ordinality
4040
{:xml_to_columns:} ) ucd
@@ -52,7 +52,7 @@ create or replace package body ut_compound_data_helper is
5252
,position + x.item_no item_no
5353
{:columns:}
5454
from {:ut3_owner:}.ut_compound_data_tmp x,
55-
xmltable('/ROWSET/ROW' passing x.item_data columns
55+
xmltable('/ROWSET/ROW' passing xmltype(x.item_data) columns
5656
item_data xmltype path '*'
5757
,position for ordinality
5858
{:xml_to_columns:} ) ucd
@@ -174,7 +174,7 @@ create or replace package body ut_compound_data_helper is
174174

175175
function generate_equal_sql(a_col_name in varchar2) return varchar2 is
176176
begin
177-
return ' a.'||a_col_name||q'[ = ]'||' e.'||a_col_name;
177+
return ' decode(a.'||a_col_name||','||' e.'||a_col_name||',1,0) = 1 ';
178178
end;
179179

180180
function generate_partition_stmt(

source/expectations/data_values/ut_compound_data_tmp.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ create global temporary table ut_compound_data_tmp(
1414
*/
1515
data_id raw(32),
1616
item_no integer,
17-
item_data xmltype,
17+
item_data clob,
1818
item_hash raw(128),
1919
pk_hash raw(128),
2020
duplicate_no integer,

source/expectations/data_values/ut_data_value_refcursor.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ create or replace type body ut_data_value_refcursor as
5555
execute immediate
5656
'insert into ' || l_ut_owner || '.ut_compound_data_tmp(data_id, item_no, item_data) ' ||
5757
'values (:self_guid, :self_row_count, :l_xml)'
58-
using in self.data_id, l_set_id, l_xml;
58+
using in self.data_id, l_set_id, l_xml.getclobval();
5959
l_set_id := l_set_id + c_bulk_rows;
6060
end loop;
6161
ut_expectation_processor.reset_nls_params();

test/core/expectations/test_expectation_anydata.pkb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,5 +970,29 @@ Rows: [ 60 differences, showing first 20 ]
970970
ut.expect(expectations.failed_expectations_data()).to_be_empty();
971971
end;
972972

973+
procedure arr_empty_eq_arr_empty_unord is
974+
begin
975+
--Arrange
976+
g_test_expected := anydata.convertCollection(t_tab_varchar(null));
977+
g_test_actual := anydata.convertCollection(t_tab_varchar(null));
978+
979+
--Act
980+
ut3.ut.expect( g_test_actual ).to_equal( g_test_expected ).unordered();
981+
ut.expect(expectations.failed_expectations_data()).to_be_empty();
982+
983+
end;
984+
985+
procedure arr_empty_nqua_arr_e_unord is
986+
begin
987+
--Arrange
988+
g_test_expected := anydata.convertCollection(t_tab_varchar('t'));
989+
g_test_actual := anydata.convertCollection(t_tab_varchar(' '));
990+
991+
--Act
992+
ut3.ut.expect( g_test_actual ).to_equal( g_test_expected ).unordered();
993+
ut.expect(expectations.failed_expectations_data()).to_be_empty();
994+
995+
end;
996+
973997
end;
974998
/

test/core/expectations/test_expectation_anydata.pks

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,10 @@ create or replace package test_expectation_anydata is
198198
--%test( Success when anydata object contains data from another anydata)
199199
procedure object_to_contain;
200200

201+
--%test ( Empty Array equal empty array )
202+
procedure arr_empty_eq_arr_empty_unord;
203+
204+
--%test ( Empty Array not equal array with space )
205+
procedure arr_empty_nqua_arr_e_unord;
201206
end;
202207
/

0 commit comments

Comments
 (0)