DatabaseProcApplicationCreatedLinks
sybsystemprocssp_mon_archive_deadlock  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_mon_archive_deadlock(
3         @prefix varchar(30)
4         , @datestamp datetime
5         , @trace int = NULL
6     ) as
7         begin
8             declare @retval int
9                 , @montable varchar(11)
10                , @sqlstmt varchar(256)
11                , @new_arch_created int -- whether a new archive 
12            -- was created by callee.
13    
14            select @montable = 'monDeadLock'
15            exec @retval = sp_mon_archive_monTable @montable
16                , @prefix
17                , @datestamp
18                , @new_arch_created output
19                , @trace
20                , 'ResolveTime'
21                , 'DeadlockID'
22                , 'HeldSPID'
23                , 'WaitSPID'
24                , 'ServerName'
25    
26            -- If a new archive was created successfully, go back and create
27            -- more unique indexes as faster access methods. It's quite cmmon
28            -- to expect that archival analysis will be done for particular 
29            -- deadlock ID instances, so create an index on that column.
30            --
31            if ((@retval = 0) and (@new_arch_created = 1))
32            begin
33                select @sqlstmt = "CREATE INDEX "
34                    + @montable + "_ncind1"
35                    + " ON "
36                    + @montable
37                    + '('
38                    + 'DeadlockID'
39                    + ')'
40                exec @retval = sp_exec_SQL @sqlstmt, 'sp_mon_archive_deadlock'
41                    , NULL, @trace
42            end
43    
44            return @retval
45        end -- }
46    

DEFECTS
 MTYP 4 Assignment type mismatch @trace: tinyint = int 41
 MNER 3 No Error Check should check return value of exec 40
 MUCO 3 Useless Code Useless Brackets in create proc 2
 MUCO 3 Useless Code Useless Begin-End Pair 7
 MUCO 3 Useless Code Useless Brackets 31
 MTR1 2 Metrics: Comments Ratio Comments: 24% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 3dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 10 2

DATA PROPAGATION detailed
ColumnWritten To
@datestampsp_exec_SQL_rset_001.sqlbNoName57
@prefixsp_exec_SQL_rset_001.sqlbNoName57

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_exec_SQL  
   writes table sybsystemprocs..sp_exec_SQL_rset_001 
calls proc sybsystemprocs..sp_mon_archive_monTable  
   calls proc sybsystemprocs..sp_mon_archive_genSQL  
      calls proc sybsystemprocs..sp_versioncrack  
         calls proc sybsystemprocs..sp_split_string  
      calls proc sybsystemprocs..sp_mon_gen_columnlist  
         reads table master..sysobjects (1)  
         reads table master..syscolumns (1)  
   calls proc sybsystemprocs..sp_mon_archive_data  
      calls proc sybsystemprocs..sp_getmessage  
         reads table sybsystemprocs..sysusermessages  
         calls proc sybsystemprocs..sp_validlang  
            reads table master..syslanguages (1)  
         reads table master..sysmessages (1)  
         reads table master..syslanguages (1)  
      calls proc sybsystemprocs..sp_exec_SQL