DatabaseProcApplicationCreatedLinks
sybsystemprocssp_xact_loginfo  14 déc. 14Defects Propagation Dependencies

1     
2     
3     /*
4     **	SP_XACT_LOGINFO
5     **
6     ** 	Driver interface to get oldest active transaction information
7     **	and some more entities which will help making decisions when
8     **	database log runs out of space. 
9     **
10    **	Parameters
11    **		@dbid			- Database id (input parameter)
12    **		@vcharparam1		- Varchar parameter1 (input parameter)
13    **		@vcharparam2		- Varchar parameter2 (input parameter)
14    **		@intparam1		- Int parameter1 (input parameter)
15    **		@intparam2		- Int parameter2 (input parameter)
16    **		@span_pct		- Span of Active transaction 
17    **					  in percentage of total log size. 
18    **					  Range between 0 to 100.  (output)
19    **		@startpage		- Start page of Active transaction 
20    **					  in the log. (output)
21    **		@xact_spid		- Spid of the task with Active 
22    **					  transaction (output)
23    **		@starttime		- Start time of Active transaction 
24    **					  (output)
25    **		@firstlog_page		- First logical page of transation log.
26    **					  (output)
27    **		@stp_page		- Secondary truncation point page of 
28    **					  transation log. (output)
29    **		@stp_blocking		- If secondary truncation point
30    **					  is before start of oldest active 
31    **					  transaction in the log.
32    **					  (output)
33    **		@canfree_without_abort_pct		
34    **					- Span of log which can be freed
35    **					  up with dump tran in percentage of 
36    **					  total log size. 
37    **					  Range between 0 to 100.  (output)
38    **		@dump_in_progress	- If dump tran command is in progress.
39    **					  (output)
40    **		@activexact		- Indicates if there is at least
41    **					  single active transaction in log.
42    **					  (output)
43    **		@errorcode		- 0 if no error.
44    **					  1 Insufficient Permission to execute
45    **					  2 DBTABLE not found. Could be
46    **					    various reasons including
47    **					    given dbid does not exist.
48    **					  3 Failure to initiate scan of log.
49    **					  4 No active transactions in
50    **					    the log.
51    */
52    create or replace procedure sp_xact_loginfo --(
53        @dbid int,
54        @vcharparam1 varchar(127),
55        @vcharparam2 varchar(127),
56        @intparam1 int,
57        @intparam2 int,
58        @span_pct int output,
59        @startpage bigint output,
60        @xact_spid int output,
61        @starttime varchar(27) output,
62        @firstlog_page bigint output,
63        @stp_page bigint output,
64        @stp_blocking int output,
65        @canfree_without_abort_pct int output,
66        @dump_in_progress int output,
67        @activexact int output,
68        @errorcode int output
69    --)
70    as
71        declare @loginfo_str varchar(512),
72            @value char(30)
73    
74        if (@vcharparam1 = 'oldestactive')
75        begin -- {
76            select @loginfo_str = loginfo(@dbid, 'oldestactive', NULL)
77    
78            select @value = dbo.sp_f_getval(@loginfo_str,
79                    'Oldestact_xact_span_pct', default, default)
80    
81            select @span_pct = convert(int, @value)
82    
83            select @value = dbo.sp_f_getval(@loginfo_str,
84                    'Oldestact_logpage', default, default)
85    
86            select @startpage = convert(bigint, @value)
87    
88            select @value = dbo.sp_f_getval(@loginfo_str,
89                    'Oldestact_spid', default, default)
90    
91            select @xact_spid = convert(int, @value)
92    
93            select @value = ""
94            select @value = dbo.sp_f_getval(@loginfo_str,
95                    'Oldestact_starttime', default, default)
96    
97            select @starttime = @value
98    
99            select @value = dbo.sp_f_getval(@loginfo_str,
100                   'Start_logpage', default, default)
101   
102           select @firstlog_page = convert(bigint, @value)
103   
104           select @value = dbo.sp_f_getval(@loginfo_str,
105                   'STP_page', default, default)
106   
107           select @stp_page = convert(bigint, @value)
108   
109           select @value = dbo.sp_f_getval(@loginfo_str,
110                   'STP_blocking', default, default)
111   
112           select @stp_blocking = convert(int, @value)
113   
114           select @value = dbo.sp_f_getval(@loginfo_str,
115                   'Can_free_without_abort', default, default)
116   
117           select @canfree_without_abort_pct = convert(int, @value)
118   
119           select @value = dbo.sp_f_getval(@loginfo_str,
120                   'dump_in_progress', default, default)
121   
122           select @dump_in_progress = convert(int, @value)
123   
124           select @value = dbo.sp_f_getval(@loginfo_str,
125                   'Activexact', default, default)
126   
127           select @activexact = convert(int, @value)
128   
129           select @value = dbo.sp_f_getval(@loginfo_str,
130                   'Errorcode', default, default)
131   
132           select @errorcode = convert(int, @value)
133       end --}
134   
135       else if (@vcharparam1 = 'xactspanbyspid')
136       begin -- {
137           select @span_pct = loginfo(@dbid, 'xactspanbyspid', @intparam1)
138       end --}
139   


exec sp_procxmode 'sp_xact_loginfo', 'AnyMode'
go

Grant Execute on sp_xact_loginfo to public
go
DEFECTS
 MEST 4 Empty String will be replaced by Single Space 93
 MTYP 4 Assignment type mismatch @starttime: varchar(27) = char(30) 97
 MGTP 3 Grant to public sybsystemprocs..sp_xact_loginfo  
 MUCO 3 Useless Code Useless Brackets 74
 MUCO 3 Useless Code Useless Brackets 135
 MTR1 2 Metrics: Comments Ratio Comments: 42% 52
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 3dec - 1exi + 2 52
 MTR3 2 Metrics: Query Complexity Complexity: 31 52

DEPENDENCIES