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

Skip to content

Commit 7d27d3a

Browse files
LUKASZ104LUKASZ104
authored andcommitted
TAG: Phase2
Adding a new attribute filterpath that is used for filtering cursor in anydata / refcursor. This value will be different from cursor in anydata as we skip root element.
1 parent f66445b commit 7d27d3a

9 files changed

Lines changed: 2882 additions & 2899 deletions

source/core/ut_utils.pkb

Lines changed: 827 additions & 817 deletions
Large diffs are not rendered by default.

source/core/ut_utils.pks

Lines changed: 400 additions & 396 deletions
Large diffs are not rendered by default.

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 694 additions & 694 deletions
Large diffs are not rendered by default.
Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,70 @@
1-
create or replace type body ut_cursor_column as
2-
3-
member procedure init(
4-
self in out nocopy ut_cursor_column,
5-
a_col_name varchar2, a_col_schema_name varchar2,
6-
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
7-
a_col_position integer, a_col_type varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
8-
a_col_scale integer
9-
) is
10-
begin
11-
self.parent_name := a_parent_name; --Name of the parent if its nested
12-
self.hierarchy_level := a_hierarchy_level; --Hierarchy level
13-
self.column_position := a_col_position; --Position of the column in cursor/ type
14-
self.column_len := a_col_max_len; --length of column
15-
self.column_precision := a_col_precision;
16-
self.column_scale := a_col_scale;
17-
self.column_name := TRIM( BOTH '''' FROM a_col_name); --name of the column
18-
self.column_type_name := coalesce(a_col_type_name,a_col_type); --type name e.g. test_dummy_object or varchar2
19-
self.xml_valid_name := ut_utils.get_valid_xml_name(self.column_name);
20-
self.display_path := case when a_access_path is null then
21-
self.column_name
22-
else
23-
a_access_path||'/'||self.column_name
24-
end; --Access path used for incldue exclude eg/ TEST_DUMMY_OBJECT/VARCHAR2
25-
self.access_path := case when a_access_path is null then
26-
self.xml_valid_name
27-
else
28-
a_access_path||'/'||self.xml_valid_name
29-
end; --Access path used for incldue exclude eg/ TEST_DUMMY_OBJECT/VARCHAR2
30-
self.transformed_name := case when length(self.xml_valid_name) > 30 then
31-
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
32-
when self.parent_name is null then
33-
'"'||self.xml_valid_name||'"'
34-
else
35-
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
36-
end; --when is nestd we need to hash name to make sure we dont exceed 30 char
37-
self.column_type := a_col_type; --column type e.g. user_defined , varchar2
38-
self.column_schema := a_col_schema_name; -- schema name
39-
self.is_sql_diffable := case
40-
when lower(self.column_type) = 'user_defined_type' then
41-
0
42-
-- Due to bug in 11g/12.1 collection fails on varchar 4000+
43-
when (lower(self.column_type) in ('varchar2','char')) and (self.column_len > 4000) then
44-
0
45-
else
46-
ut_utils.boolean_to_int(ut_compound_data_helper.is_sql_compare_allowed(self.column_type))
47-
end; --can we directly compare or do we need to hash value
48-
self.is_collection := a_collection;
49-
self.has_nested_col := case when lower(self.column_type) = 'user_defined_type' and self.is_collection = 0 then 1 else 0 end;
50-
end;
51-
52-
constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
53-
a_col_name varchar2, a_col_schema_name varchar2,
54-
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
55-
a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
56-
a_col_scale integer
57-
) return self as result is
58-
begin
59-
init(a_col_name, a_col_schema_name, a_col_type_name, a_col_max_len, a_parent_name,a_hierarchy_level, a_col_position,
60-
a_col_type, a_collection,a_access_path,a_col_precision,a_col_scale);
61-
return;
62-
end;
63-
64-
constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result is
65-
begin
66-
return;
67-
end;
68-
end;
69-
/
1+
create or replace type body ut_cursor_column as
2+
3+
member procedure init(
4+
self in out nocopy ut_cursor_column,
5+
a_col_name varchar2, a_col_schema_name varchar2,
6+
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
7+
a_col_position integer, a_col_type varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
8+
a_col_scale integer
9+
) is
10+
begin
11+
self.parent_name := a_parent_name; --Name of the parent if its nested
12+
self.hierarchy_level := a_hierarchy_level; --Hierarchy level
13+
self.column_position := a_col_position; --Position of the column in cursor/ type
14+
self.column_len := a_col_max_len; --length of column
15+
self.column_precision := a_col_precision;
16+
self.column_scale := a_col_scale;
17+
self.column_name := TRIM( BOTH '''' FROM a_col_name); --name of the column
18+
self.column_type_name := coalesce(a_col_type_name,a_col_type); --type name e.g. test_dummy_object or varchar2
19+
self.xml_valid_name := ut_utils.get_valid_xml_name(self.column_name);
20+
self.display_path := case when a_access_path is null then
21+
self.column_name
22+
else
23+
a_access_path||'/'||self.column_name
24+
end; --Access path used for incldue exclude eg/ TEST_DUMMY_OBJECT/VARCHAR2
25+
self.access_path := case when a_access_path is null then
26+
self.xml_valid_name
27+
else
28+
a_access_path||'/'||self.xml_valid_name
29+
end; --Access path used for XMLTABLE query
30+
self.filter_path := '/'||self.access_path; --Filter path will differ from access path in anydata type
31+
self.transformed_name := case when length(self.xml_valid_name) > 30 then
32+
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
33+
when self.parent_name is null then
34+
'"'||self.xml_valid_name||'"'
35+
else
36+
'"'||ut_compound_data_helper.get_fixed_size_hash(self.parent_name||self.xml_valid_name)||'"'
37+
end; --when is nestd we need to hash name to make sure we dont exceed 30 char
38+
self.column_type := a_col_type; --column type e.g. user_defined , varchar2
39+
self.column_schema := a_col_schema_name; -- schema name
40+
self.is_sql_diffable := case
41+
when lower(self.column_type) = 'user_defined_type' then
42+
0
43+
-- Due to bug in 11g/12.1 collection fails on varchar 4000+
44+
when (lower(self.column_type) in ('varchar2','char')) and (self.column_len > 4000) then
45+
0
46+
else
47+
ut_utils.boolean_to_int(ut_compound_data_helper.is_sql_compare_allowed(self.column_type))
48+
end; --can we directly compare or do we need to hash value
49+
self.is_collection := a_collection;
50+
self.has_nested_col := case when lower(self.column_type) = 'user_defined_type' and self.is_collection = 0 then 1 else 0 end;
51+
end;
52+
53+
constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
54+
a_col_name varchar2, a_col_schema_name varchar2,
55+
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
56+
a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
57+
a_col_scale integer
58+
) return self as result is
59+
begin
60+
init(a_col_name, a_col_schema_name, a_col_type_name, a_col_max_len, a_parent_name,a_hierarchy_level, a_col_position,
61+
a_col_type, a_collection,a_access_path,a_col_precision,a_col_scale);
62+
return;
63+
end;
64+
65+
constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result is
66+
begin
67+
return;
68+
end;
69+
end;
70+
/
Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
1-
create or replace type ut_cursor_column force authid current_user as object (
2-
/*
3-
utPLSQL - Version 3
4-
Copyright 2016 - 2018 utPLSQL Project
5-
6-
Licensed under the Apache License, Version 2.0 (the "License"):
7-
you may not use this file except in compliance with the License.
8-
You may obtain a copy of the License at
9-
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
17-
*/
18-
parent_name varchar2(4000),
19-
access_path varchar2(4000),
20-
display_path varchar2(4000),
21-
has_nested_col number(1,0),
22-
transformed_name varchar2(2000),
23-
hierarchy_level number,
24-
column_position number,
25-
xml_valid_name varchar2(2000),
26-
column_name varchar2(2000),
27-
column_type varchar2(128),
28-
column_type_name varchar2(128),
29-
column_schema varchar2(128),
30-
column_len integer,
31-
column_precision integer,
32-
column_scale integer,
33-
is_sql_diffable number(1, 0),
34-
is_collection number(1, 0),
35-
36-
member procedure init(self in out nocopy ut_cursor_column,
37-
a_col_name varchar2, a_col_schema_name varchar2,
38-
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
39-
a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
40-
a_col_scale integer),
41-
42-
constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
43-
a_col_name varchar2, a_col_schema_name varchar2,
44-
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
45-
a_col_position integer, a_col_type in varchar2, a_collection integer, a_access_path in varchar2, a_col_precision in integer,
46-
a_col_scale integer)
47-
return self as result,
48-
49-
constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result
50-
)
51-
/
1+
create or replace type ut_cursor_column authid current_user as object (
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
6+
Licensed under the Apache License, Version 2.0 (the "License"):
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
parent_name varchar2(4000),
19+
access_path varchar2(4000),
20+
filter_path varchar2(4000),
21+
display_path varchar2(4000),
22+
has_nested_col number(1,0),
23+
transformed_name varchar2(2000),
24+
hierarchy_level number,
25+
column_position number,
26+
xml_valid_name varchar2(2000),
27+
column_name varchar2(2000),
28+
column_type varchar2(128),
29+
column_type_name varchar2(128),
30+
column_schema varchar2(128),
31+
column_len integer,
32+
column_precision integer,
33+
column_scale integer,
34+
is_sql_diffable number(1, 0),
35+
is_collection number(1, 0),
36+
37+
member procedure init(self in out nocopy ut_cursor_column,
38+
a_col_name varchar2, a_col_schema_name varchar2,
39+
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
40+
a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
41+
a_col_scale integer),
42+
43+
constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
44+
a_col_name varchar2, a_col_schema_name varchar2,
45+
a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
46+
a_col_position integer, a_col_type in varchar2, a_collection integer, a_access_path in varchar2, a_col_precision in integer,
47+
a_col_scale integer)
48+
return self as result,
49+
50+
constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result
51+
)
52+
/

0 commit comments

Comments
 (0)