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

Skip to content

Commit f2da43b

Browse files
committed
Added EBR support by creating views/edition views.
1 parent 5bf992c commit f2da43b

4 files changed

Lines changed: 205 additions & 35 deletions

File tree

source/core/coverage/proftab_temp_tables.sql

Lines changed: 144 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
create global temporary table plsql_profiler_runs(
1+
create global temporary table plsql_profiler_runs$(
22
/*
33
utPLSQL - Version X.X.X.X
44
Copyright 2016 - 2017 utPLSQL Project
@@ -25,10 +25,56 @@ create global temporary table plsql_profiler_runs(
2525
spare1 varchar2(256) -- unused
2626
) on commit preserve rows;
2727

28-
comment on table plsql_profiler_runs is
28+
comment on table plsql_profiler_runs$ is
2929
'Run-specific information for the PL/SQL profiler';
3030

31-
create global temporary table plsql_profiler_units(
31+
declare
32+
ex_nonedition_user exception;
33+
ex_view_doesnt_exist exception;
34+
pragma exception_init(ex_nonedition_user,-42314);
35+
pragma exception_init(ex_view_doesnt_exist,-942);
36+
v_view_source varchar2(32767);
37+
begin
38+
begin
39+
execute immediate 'drop view plsql_profiler_runs';
40+
exception
41+
when ex_view_doesnt_exist then
42+
null;
43+
end;
44+
v_view_source := ' plsql_profiler_runs as
45+
/*
46+
utPLSQL - Version X.X.X.X
47+
Copyright 2016 - 2017 utPLSQL Project
48+
Licensed under the Apache License, Version 2.0 (the "License"):
49+
you may not use this file except in compliance with the License.
50+
You may obtain a copy of the License at
51+
http://www.apache.org/licenses/LICENSE-2.0
52+
Unless required by applicable law or agreed to in writing, software
53+
distributed under the License is distributed on an "AS IS" BASIS,
54+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55+
See the License for the specific language governing permissions and
56+
limitations under the License.
57+
*/
58+
select runid
59+
,related_run
60+
,run_owner
61+
,run_date
62+
,run_comment
63+
,run_total_time
64+
,run_system_info
65+
,run_comment1
66+
,spare1
67+
from plsql_profiler_runs$';
68+
69+
execute immediate 'create or replace editioning view '||v_view_source;
70+
exception
71+
when ex_nonedition_user then
72+
execute immediate 'create or replace view '||v_view_source;
73+
end;
74+
/
75+
76+
77+
create global temporary table plsql_profiler_units$(
3278
/*
3379
utPLSQL - Version X.X.X.X
3480
Copyright 2016 - 2017 utPLSQL Project
@@ -57,10 +103,55 @@ create global temporary table plsql_profiler_units(
57103
primary key (runid, unit_number)
58104
) on commit preserve rows;
59105

60-
comment on table plsql_profiler_units is
106+
comment on table plsql_profiler_units$ is
61107
'Information about each library unit in a run';
62108

63-
create global temporary table plsql_profiler_data(
109+
declare
110+
ex_nonedition_user exception;
111+
ex_view_doesnt_exist exception;
112+
pragma exception_init(ex_nonedition_user,-42314);
113+
pragma exception_init(ex_view_doesnt_exist,-942);
114+
v_view_source varchar2(32767);
115+
begin
116+
begin
117+
execute immediate 'drop view plsql_profiler_units';
118+
exception
119+
when ex_view_doesnt_exist then
120+
null;
121+
end;
122+
v_view_source := ' plsql_profiler_units as
123+
/*
124+
utPLSQL - Version X.X.X.X
125+
Copyright 2016 - 2017 utPLSQL Project
126+
Licensed under the Apache License, Version 2.0 (the "License"):
127+
you may not use this file except in compliance with the License.
128+
You may obtain a copy of the License at
129+
http://www.apache.org/licenses/LICENSE-2.0
130+
Unless required by applicable law or agreed to in writing, software
131+
distributed under the License is distributed on an "AS IS" BASIS,
132+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133+
See the License for the specific language governing permissions and
134+
limitations under the License.
135+
*/
136+
select runid
137+
,unit_number
138+
,unit_type
139+
,unit_owner
140+
,unit_name
141+
,unit_timestamp
142+
,total_time
143+
,spare1
144+
,spare2
145+
from plsql_profiler_units$';
146+
147+
execute immediate 'create or replace editioning view '||v_view_source;
148+
exception
149+
when ex_nonedition_user then
150+
execute immediate 'create or replace view '||v_view_source;
151+
end;
152+
/
153+
154+
create global temporary table plsql_profiler_data$(
64155
/*
65156
utPLSQL - Version X.X.X.X
66157
Copyright 2016 - 2017 utPLSQL Project
@@ -89,7 +180,54 @@ create global temporary table plsql_profiler_data(
89180
primary key (runid, unit_number, line#)
90181
) on commit preserve rows;
91182

92-
comment on table plsql_profiler_data is
183+
comment on table plsql_profiler_data$ is
93184
'Accumulated data from all profiler runs';
94185

95186
create sequence plsql_profiler_runnumber start with 1 nocache;
187+
188+
declare
189+
ex_nonedition_user exception;
190+
ex_view_doesnt_exist exception;
191+
pragma exception_init(ex_nonedition_user,-42314);
192+
pragma exception_init(ex_view_doesnt_exist,-942);
193+
v_view_source varchar2(32767);
194+
begin
195+
begin
196+
execute immediate 'drop view plsql_profiler_data';
197+
exception
198+
when ex_view_doesnt_exist then
199+
null;
200+
end;
201+
v_view_source := ' plsql_profiler_data as
202+
/*
203+
utPLSQL - Version X.X.X.X
204+
Copyright 2016 - 2017 utPLSQL Project
205+
Licensed under the Apache License, Version 2.0 (the "License"):
206+
you may not use this file except in compliance with the License.
207+
You may obtain a copy of the License at
208+
http://www.apache.org/licenses/LICENSE-2.0
209+
Unless required by applicable law or agreed to in writing, software
210+
distributed under the License is distributed on an "AS IS" BASIS,
211+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
212+
See the License for the specific language governing permissions and
213+
limitations under the License.
214+
*/
215+
select runid
216+
,unit_number
217+
,line#
218+
,total_occur
219+
,total_time
220+
,min_time
221+
,max_time
222+
,spare1
223+
,spare2
224+
,spare3
225+
,spare4
226+
from plsql_profiler_data$';
227+
228+
execute immediate 'create or replace editioning view '||v_view_source;
229+
exception
230+
when ex_nonedition_user then
231+
execute immediate 'create or replace view '||v_view_source;
232+
end;
233+
/

source/core/coverage/ut_coverage_sources_tmp.sql

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
create global temporary table ut_coverage_sources_tmp(
1+
create global temporary table ut_coverage_sources_tmp$(
22
/*
33
utPLSQL - Version X.X.X.X
44
Copyright 2016 - 2017 utPLSQL Project
@@ -21,5 +21,46 @@ create global temporary table ut_coverage_sources_tmp(
2121
constraint ut_coverage_sources_tmp_pk primary key (owner,name,line)
2222
) on commit preserve rows;
2323

24-
create unique index ut_coverage_sources_tmp_uk on ut_coverage_sources_tmp (owner,name,to_be_skipped, line);
24+
create unique index ut_coverage_sources_tmp_uk on ut_coverage_sources_tmp$ (owner,name,to_be_skipped, line);
2525

26+
declare
27+
ex_nonedition_user exception;
28+
ex_view_doesnt_exist exception;
29+
pragma exception_init(ex_nonedition_user,-42314);
30+
pragma exception_init(ex_view_doesnt_exist,-942);
31+
v_view_source varchar2(32767);
32+
begin
33+
begin
34+
execute immediate 'drop view ut_coverage_sources_tmp';
35+
exception
36+
when ex_view_doesnt_exist then
37+
null;
38+
end;
39+
v_view_source := ' ut_coverage_sources_tmp as
40+
/*
41+
utPLSQL - Version X.X.X.X
42+
Copyright 2016 - 2017 utPLSQL Project
43+
Licensed under the Apache License, Version 2.0 (the "License"):
44+
you may not use this file except in compliance with the License.
45+
You may obtain a copy of the License at
46+
http://www.apache.org/licenses/LICENSE-2.0
47+
Unless required by applicable law or agreed to in writing, software
48+
distributed under the License is distributed on an "AS IS" BASIS,
49+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50+
See the License for the specific language governing permissions and
51+
limitations under the License.
52+
*/
53+
select full_name
54+
,owner
55+
,name
56+
,line
57+
,to_be_skipped
58+
,text
59+
from ut_coverage_sources_tmp$';
60+
61+
execute immediate 'create or replace editioning view '||v_view_source;
62+
exception
63+
when ex_nonedition_user then
64+
execute immediate 'create or replace view '||v_view_source;
65+
end;
66+
/

source/core/ut_output_buffer_tmp.sql

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ declare
3535
ex_view_doesnt_exist exception;
3636
pragma exception_init(ex_nonedition_user,-42314);
3737
pragma exception_init(ex_view_doesnt_exist,-942);
38+
v_view_source varchar2(32767);
3839
begin
3940
begin
4041
execute immediate 'drop view ut_output_buffer_tmp';
4142
exception
4243
when ex_view_doesnt_exist then
4344
null;
4445
end;
45-
46-
execute immediate 'create or replace editioning view ut_output_buffer_tmp as
46+
v_view_source := ' ut_output_buffer_tmp as
4747
/*
4848
utPLSQL - Version X.X.X.X
4949
Copyright 2016 - 2017 utPLSQL Project
@@ -63,27 +63,10 @@ select reporter_id
6363
,is_finished
6464
,start_date
6565
from ut_output_buffer_tmp$';
66-
exception
66+
67+
execute immediate 'create or replace editioning view '||v_view_source;
68+
exception
6769
when ex_nonedition_user then
68-
execute immediate 'create or replace view ut_output_buffer_tmp as
69-
/*
70-
utPLSQL - Version X.X.X.X
71-
Copyright 2016 - 2017 utPLSQL Project
72-
Licensed under the Apache License, Version 2.0 (the "License"):
73-
you may not use this file except in compliance with the License.
74-
You may obtain a copy of the License at
75-
http://www.apache.org/licenses/LICENSE-2.0
76-
Unless required by applicable law or agreed to in writing, software
77-
distributed under the License is distributed on an "AS IS" BASIS,
78-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79-
See the License for the specific language governing permissions and
80-
limitations under the License.
81-
*/
82-
select reporter_id
83-
,message_id
84-
,text
85-
,is_finished
86-
,start_date
87-
from ut_output_buffer_tmp$';
70+
execute immediate 'create or replace view '||v_view_source;
8871
end;
8972
/

source/uninstall.sql

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,21 @@ drop type ut_coverage_file_mapping;
6363

6464
drop package ut_coverage_helper;
6565

66-
drop table plsql_profiler_data cascade constraints;
66+
drop view plsql_profiler_data;
6767

68-
drop table plsql_profiler_units cascade constraints;
68+
drop view plsql_profiler_units;
6969

70-
drop table plsql_profiler_runs cascade constraints;
70+
drop view plsql_profiler_runs;
7171

72-
drop table ut_coverage_sources_tmp;
72+
drop table plsql_profiler_data$ cascade constraints;
73+
74+
drop table plsql_profiler_units$ cascade constraints;
75+
76+
drop table plsql_profiler_runs$ cascade constraints;
77+
78+
drop view ut_coverage_sources_tmp;
79+
80+
drop table ut_coverage_sources_tmp$;
7381

7482
drop sequence plsql_profiler_runnumber;
7583

0 commit comments

Comments
 (0)