Skip to content

Commit 4bb7a95

Browse files
committed
Added a hash of owner to the generated savepoint name.
Resolves #982
1 parent 39d144a commit 4bb7a95

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

source/core/coverage/proftab.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ begin
3737
if l_tab_exist = 0 then
3838
execute immediate q'[create table plsql_profiler_units
3939
(
40-
runid number(18) references plsql_profiler_runs,
40+
runid number references plsql_profiler_runs,
4141
unit_number number, -- internally generated library unit #
4242
unit_type varchar2(128), -- library unit type
4343
unit_owner varchar2(128), -- library unit owner name

source/core/ut_savepoint_seq.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
create sequence ut_savepoint_seq
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2019 utPLSQL Project
5+
Licensed under the Apache License, Version 2.0 (the "License"):
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
start with 1 cache 20 minvalue 1 maxvalue 99999999999999999 cycle;

source/core/ut_utils.pkb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ create or replace package body ut_utils is
2222
gc_invalid_first_xml_char constant varchar2(50) := '[^_a-zA-Z]';
2323
gc_invalid_xml_char constant varchar2(50) := '[^_a-zA-Z0-9\.-]';
2424
gc_full_valid_xml_name constant varchar2(50) := '^([_a-zA-Z])([_a-zA-Z0-9\.-])*$';
25+
gc_owner_hash constant integer(11) := dbms_utility.get_hash_value( ut_owner(), 0, power(2,31)-1);
2526

2627
function surround_with(a_value varchar2, a_quote_char varchar2) return varchar2 is
2728
begin
@@ -59,7 +60,7 @@ create or replace package body ut_utils is
5960

6061
function gen_savepoint_name return varchar2 is
6162
begin
62-
return 's'||to_char(systimestamp,'yyyymmddhh24missff9');
63+
return 's'||gc_owner_hash||trim(to_char(ut_savepoint_seq.nextval,'00000000000000000'));
6364
end;
6465

6566
procedure debug_log(a_message varchar2) is

source/install.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ end;
5959
@@install_component.sql 'core/types/ut_reporters_info.tps'
6060
@@install_component.sql 'core/ut_utils.pks'
6161
@@install_component.sql 'core/ut_metadata.pks'
62+
@@install_component.sql 'core/ut_savepoint_seq.sql'
6263
@@install_component.sql 'core/ut_utils.pkb'
6364
@@install_component.sql 'core/ut_metadata.pkb'
6465
@@install_component.sql 'reporters/ut_ansiconsole_helper.pks'

source/uninstall_objects.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ end;
243243

244244
drop package ut_utils;
245245

246+
drop sequence ut_savepoint_seq;
247+
246248
drop type ut_documentation_reporter force;
247249

248250
drop type ut_debug_reporter force;

0 commit comments

Comments
 (0)