DatabaseProcApplicationCreatedLinks
sybsystemprocssp_helplog  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/fixindex */
4     /*
5     ** Messages for "sp_helplog"            17672
6     **
7     ** 17672, "In database '%1!', the log starts on device '%2!'."
8     ** 18433, "No valid log device can be found to contain the starting logpage 
9     **	   of '%1!', on database '%2!'. Perhaps the segment mapping of 
10    **	   database has changed recently.  Please inspect the sysusages 
11    **	   catalog and contact your system administrator."
12    **
13    */
14    create or replace procedure sp_helplog
15    as
16        declare @firstpage unsigned int,
17            @devname varchar(255),
18            @msg varchar(1024),
19            @dbname varchar(255)
20    
21    
22        if @@trancount = 0
23        begin
24            set chained off
25        end
26    
27        set transaction isolation level 1
28    
29        /* Get the first page of the log from sysindexes */
30        select @firstpage = firstpage
31        from syspartitions
32        where id = 8
33            and partitionid = 8
34            and indid = 0
35    
36        /*
37        **  Get the name of the device which contains the first page of the log.
38        **  Make sure that the device has logsegment mapped to it.
39        */
40        select @devname = d.name
41        from master.dbo.sysdevices d, master.dbo.sysusages u
42        where (d.status & 6) != 0
43            and @firstpage >= u.lstart
44            and @firstpage < u.lstart + u.size
45            and u.dbid = db_id()
46            and u.segmap & 4 = 4
47            and u.vdevno = d.vdevno
48    
49        select @dbname = db_name()
50    
51        if (@devname is NULL)
52        begin
53    
54            /* 
55            ** 18433, "No valid log device can be found to contain the starting 
56            **	  logpage of '%1!', on database '%2!'. Perhaps the segment 
57            **	  mapping of database has changed recently.  Please inspect 
58            **	  the sysusages catalog and contact your system administrator."
59            */
60            exec sp_getmessage 18433, @msg out
61            print @msg, @firstpage, @dbname
62        end
63        else
64        begin
65            /* Print the name of the device which contains the log start page */
66            /* 17672, "In database '%1!', the log starts on device '%2!'." */
67            exec sp_getmessage 17672, @msg out
68            print @msg, @dbname, @devname
69        end
70    
71        return (0)
72    


exec sp_procxmode 'sp_helplog', 'AnyMode'
go

Grant Execute on sp_helplog to public
go
DEFECTS
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 34
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs uint 43
 QTYP 4 Comparison type mismatch uint = int 43
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 45
 MAW1 3 Warning message on %name% sybsystemprocs..syspartitions.id: Warning message on syspartitions 32
 MGTP 3 Grant to public master..sysdevices  
 MGTP 3 Grant to public master..sysusages  
 MGTP 3 Grant to public sybsystemprocs..sp_helplog  
 MGTP 3 Grant to public sybsystemprocs..syspartitions  
 MNER 3 No Error Check should check return value of exec 60
 MNER 3 No Error Check should check return value of exec 67
 MUCO 3 Useless Code Useless Brackets 51
 MUCO 3 Useless Code Useless Brackets 71
 QISO 3 Set isolation level 27
 QNAJ 3 Not using ANSI Inner Join 41
 MTR1 2 Metrics: Comments Ratio Comments: 51% 14
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 11 = 10dec - 1exi + 2 14
 MTR3 2 Metrics: Query Complexity Complexity: 28 14
 PRED_QUERY_COLLECTION 2 {d=master..sysdevices, u=master..sysusages} 0 40

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysusages (1)  
reads table sybsystemprocs..syspartitions  
reads table master..sysdevices (1)  
calls proc sybsystemprocs..sp_getmessage  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)