DatabaseProcApplicationCreatedLinks
sybsystemprocssp_markreport  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/lock */
4     
5     /*
6     ** Messages for "sp_markreport"         17712
7     **
8     ** 17712, "Report must be in your current database."
9     ** 17713, "No such report exists."
10    */
11    
12    create or replace procedure sp_markreport
13        @reportname varchar(767) /* proc name we want to mark as report */
14    as
15    
16        if @@trancount = 0
17        begin
18            set chained off
19        end
20    
21        set transaction isolation level 1
22    
23        /*
24        **  Make sure the @reportname is local to the current database.
25        */
26        if @reportname like "%.%.%" and
27            substring(@reportname, 1, charindex(".", @reportname) - 1) != db_name()
28        begin
29            /*
30            ** 17712, "Report must be in your current database."
31            */
32            raiserror 17712
33            return (1)
34        end
35    
36        /*
37        **  Make sure that it actually exists as a sproc.
38        */
39        if not exists (select *
40                from sysobjects
41                where id = object_id(@reportname)
42                    and sysstat & 7 = 4 /* stored procedure */
43                    and uid = user_id())
44        begin
45            /*
46            ** 17713, "No such report exists."
47            */
48            raiserror 17713
49            return (1)
50        end
51    
52        update sysobjects
53        set userstat = userstat | - 32768 /* high bit means report */
54        from sysobjects
55        where id = object_id(@reportname)
56            and sysstat & 7 = 4 /* stored procedure */
57            and uid = user_id()
58    
59        return (0)
60    


exec sp_procxmode 'sp_markreport', 'AnyMode'
go

Grant Execute on sp_markreport to public
go
DEFECTS
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 41
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 55
 MGTP 3 Grant to public sybsystemprocs..sp_markreport  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MNER 3 No Error Check should check @@error after update 52
 MUCO 3 Useless Code Useless Brackets 33
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 59
 MUUF 3 Update or Delete with Useless From Clause 52
 QISO 3 Set isolation level 21
 MSUB 2 Subquery Marker 39
 MTR1 2 Metrics: Comments Ratio Comments: 42% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 6 = 7dec - 3exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 25 12

DEPENDENCIES
PROCS AND TABLES USED
read_writes table sybsystemprocs..sysobjects