DatabaseProcApplicationCreatedLinks
sybsystemprocssp_mon_archive_monTable  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_mon_archive_monTable(
3         @montable varchar(30)
4         , @prefix varchar(30)
5         , @datestamp datetime
6         , @created int output
7         , @trace int = NULL
8         , @unique_col1 varchar(30) = NULL
9         , @unique_col2 varchar(30) = NULL
10        , @unique_col3 varchar(30) = NULL
11        , @unique_col4 varchar(30) = NULL
12        , @unique_col5 varchar(30) = NULL
13    ) as
14        begin
15            declare @whoami varchar(30)
16                , @archivename varchar(30)
17                , @arch_dbname varchar(30)
18                , @retval int
19                , @sellist varchar(1800)
20                , @sellist_len int
21                , @fromclause varchar(40)
22                , @fromclause_len int
23                , @indent varchar(32)
24    
25                -- Name of the index created for duplicate elimination
26                , @uniqueindex_name varchar(30)
27    
28            select @whoami = 'sp_mon_archive_monTable'
29    
30            -- Prepend user-supplied prefix string, if any.
31            select @archivename = @prefix + @montable
32                , @arch_dbname = db_name()
33    
34                , @indent = char(10) + space(2 * @@nestlevel)
35                , @uniqueindex_name = @montable + "_uidx"
36    
37            if (@trace = 1)
38            begin
39                print "%1!---- Start Trace %2!: MonTable='%3!', ArchiveDb='%4!' Archive='%5!'"
40                    , @indent
41                    , @whoami
42                    , @montable
43                    , @arch_dbname
44                    , @archivename
45            end
46    
47            exec @retval = sp_mon_archive_genSQL
48                @montable
49                , @datestamp
50                , @sellist output
51                , @fromclause output
52                , @trace
53    
54            if (@trace = 1)
55            begin
56    
57                print " "
58                select @sellist_len = datalength(@sellist)
59                    , @fromclause_len = datalength(@fromclause)
60    
61                print "%1!%2!: Sqlstmt (length=%3!)=[%4!]"
62                    , @indent
63                    , @montable
64                    , @sellist_len, @sellist
65    
66                print "%1!%2!: FROM clause (length=%3!)=[%4!]"
67                    , @indent
68                    , @montable
69                    , @fromclause_len, @fromclause
70            end
71    
72            if (@retval != 0)
73                return @retval
74    
75            exec @retval = sp_mon_archive_data @archivename
76                , @sellist
77                , @fromclause
78                , NULL
79                , @uniqueindex_name
80                , @datestamp
81                , @created output
82                , @trace
83    
84                -- List of columns used for dup-elimn
85                , @unique_col1
86                , @unique_col2
87                , @unique_col3
88                , @unique_col4
89                , @unique_col5
90    
91            if (@trace = 1)
92            begin
93                print "%1!---- End Trace %2! (retval=%3!): ----"
94                    , @indent, @whoami, @retval
95            end
96    
97            return @retval
98        end -- }
99    

DEFECTS
 MTYP 4 Assignment type mismatch @fromclause: varchar(30) = varchar(40) 51
 MTYP 4 Assignment type mismatch @printsql: tinyint = int 52
 MTYP 4 Assignment type mismatch @fromclause: varchar(30) = varchar(40) 77
 MNER 3 No Error Check should check return value of exec 47
 MUCO 3 Useless Code Useless Brackets in create proc 2
 MUCO 3 Useless Code Useless Begin-End Pair 14
 MUCO 3 Useless Code Useless Brackets 37
 MUCO 3 Useless Code Useless Brackets 54
 MUCO 3 Useless Code Useless Brackets 72
 MUCO 3 Useless Code Useless Brackets 91
 MTR1 2 Metrics: Comments Ratio Comments: 6% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 6 = 5dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 22 2

DEPENDENCIES
PROCS AND TABLES USED
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..syscolumns (1)  
      reads table master..sysobjects (1)  
calls proc sybsystemprocs..sp_mon_archive_data  
   calls proc sybsystemprocs..sp_exec_SQL  
      writes table sybsystemprocs..sp_exec_SQL_rset_001 
   calls proc sybsystemprocs..sp_getmessage  
      reads table sybsystemprocs..sysusermessages  
      reads table master..syslanguages (1)  
      calls proc sybsystemprocs..sp_validlang  
         reads table master..syslanguages (1)  
      reads table master..sysmessages (1)  

CALLERS
called by proc sybsystemprocs..sp_mon_archive_deadlock