DatabaseProcApplicationCreatedLinks
sybsystemprocssp_unbindcache  14 déc. 14Defects Propagation Dependencies

1     
2     /* Stored procedure for unbinding entites that are bound to named caches.
3     **
4     ** Databases can only be unbound when using Master.
5     */
6     create or replace procedure sp_unbindcache
7         @dbname varchar(255),
8         @tablename varchar(512) = NULL,
9         @indexname varchar(255) = NULL
10    as
11    
12        declare @returncode smallint
13        declare @nullarg char(1)
14        declare @dummy int
15        declare @gp_enabled int
16    
17    
18        /*
19        **  Don't allow this in a transaction because we can't undo what
20        **  the bind_cache() builtin has done.
21        */
22        if @@trancount > 0
23        begin
24            /*
25            ** 17260, "Can't run %1! from within a transaction."
26            */
27            raiserror 17260, "sp_unbindcache"
28            return (1)
29        end
30        else
31        begin
32            set chained off
33        end
34    
35        set transaction isolation level 1
36    
37        /* check if user has sa role, proc_role will also do auditing
38        ** if required. proc_role will also print error message if required.
39        */
40        /* 
41        ** If granular permissions is not enabled then sa_role is required.
42        ** If granular permissions is enabled then the permission manage server is
43        ** required.  proc_role and proc_auditperm will also do auditing
44        ** if required. Both will also print error message if required.
45        */
46    
47        select @nullarg = NULL
48        execute @returncode = sp_aux_checkroleperm "sa_role", "manage data cache",
49            @nullarg, @gp_enabled output
50    
51        /* For Auditing */
52        if (@gp_enabled = 0)
53        begin
54            if (proc_role("sa_role") = 0)
55                return (1)
56        end
57        else
58        begin
59            select @dummy = proc_auditperm("manage data cache", @returncode)
60        end
61    
62        if (@returncode != 0)
63            return (1)
64    
65        execute @returncode = sp_bindcache NULL, @dbname, @tablename, @indexname
66    
67        return @returncode
68    


exec sp_procxmode 'sp_unbindcache', 'AnyMode'
go

Grant Execute on sp_unbindcache to public
go
DEFECTS
 MTYP 4 Assignment type mismatch @dbname: varchar(30) = varchar(255) 65
 MGTP 3 Grant to public sybsystemprocs..sp_unbindcache  
 MNER 3 No Error Check should check return value of exec 65
 MUCO 3 Useless Code Useless Brackets 28
 MUCO 3 Useless Code Useless Brackets 52
 MUCO 3 Useless Code Useless Brackets 54
 MUCO 3 Useless Code Useless Brackets 55
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 63
 QISO 3 Set isolation level 35
 VNRD 3 Variable is not read @dummy 59
 MTR1 2 Metrics: Comments Ratio Comments: 40% 6
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 5dec - 3exi + 2 6
 MTR3 2 Metrics: Query Complexity Complexity: 24 6

DATA PROPAGATION detailed
ColumnWritten To
@dbnamesysattributes.object   sysqueryplans.gid   sp_find_qplan_rset_001.gid sp_help_qplan_rset_001.hashkey sp_help_qplan_rset_004.query_plan sp_passwordpolicy_rset_002.message sp_show_metrics_rset_001.Group ID sp_show_query_tuning_rset_001.Group ID
@tablenamesysattributes.object   sysqueryplans.gid   sp_find_qplan_rset_001.gid sp_help_qplan_rset_001.hashkey sp_help_qplan_rset_004.query_plan sp_passwordpolicy_rset_002.message sp_show_metrics_rset_001.Group ID sp_show_query_tuning_rset_001.Group ID

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)  
calls proc sybsystemprocs..sp_bindcache  
   reads table master..sysdatabases (1)  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..spt_values (1)  
   calls proc sybsystemprocs..sp_getmessage  
      reads table master..sysmessages (1)  
      calls proc sybsystemprocs..sp_validlang  
         reads table master..syslanguages (1)  
      reads table sybsystemprocs..sysusermessages  
      reads table master..syslanguages (1)  
   read_writes table sybsystemprocs..sysattributes  
   reads table master..sysconfigures (1)  
   calls proc sybsystemprocs..sp_aux_parse_entity  
      reads table sybsystemprocs..sysindexes  
      reads table sybsystemprocs..sysobjects