Database | Proc | Application | Created | Links |
sybsystemprocs | sp_shmdumpdrop | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** SP_SHMDUMPDROP 4 ** 5 ** This stored procedure is used to drop shared memory dump conditions. 6 ** It is called by the sp_shmdumpconfig stored procedure when I user 7 ** invokes sp_shmdumpconfig to drop a dump condition. 8 ** 9 ** Security: The sa_role role is required in order to execute this 10 ** stored procedure. 11 ** 12 ** History: 13 ** 19sept96 pdorfman Initial coding 14 ** 07Apr97 pdorfman Created separate stored procedure 15 */ 16 17 create procedure sp_shmdumpdrop 18 /* -------------- Stored Procedure Parameters ----------------------- */ 19 @type varchar(20), /* type of attribute affected */ 20 @value int, /* attribute value */ 21 @attrib int /* attribute id from caller */ 22 as 23 24 /* ----------------- Declare Local Variables ------------------------ */ 25 declare @object int, /* object column value */ 26 @not_status int /* notification return status */ 27 28 29 /* 30 ** The following variables are treated as constants within this 31 ** stored procedure. They are set below. 32 */ 33 declare @DUMPCOND_CLASS int, /* sysattributes class */ 34 @OBJTYPE char(2), /* sysattributes object typ */ 35 @CFG_PRIMARY int, /* primary record id */ 36 @CFG_FILENAME int, /* file name record id */ 37 @CFG_DIRNAME int, /* directory name record id */ 38 @CFG_MAXDUMPS int, /* maxdumps record id */ 39 @CFG_PAGECACHE int, /* page cache record id */ 40 @CFG_PROCCACHE int, /* proc cache record id */ 41 @CFG_UNUSED int, /* unused memory record id */ 42 @ATTR_ADD int, /* add notification value */ 43 @ATTR_CHANGE int, /* change notification val */ 44 @ATTR_DROP int, /* drop notification value */ 45 @ATTR_FETCH int, /* fetch notification value */ 46 @CFG_INCLUDE int, /* include memory type */ 47 @CFG_OMIT int, /* omit memory type */ 48 @CFG_DEFAULT int /* use default mem setting */ 49 50 /* ----------------- Setup and Validation ------------------------ */ 51 set nocount on 52 53 /* 54 ** Verify that the user has sufficient permissions to 55 ** update the dump configuration 56 */ 57 if (proc_role("sa_role") < 1) 58 begin 59 return 1 60 end 61 62 /* 63 ** Common Definition Section: Note: any changes made to the following 64 ** values must also be made in shmdumpconfig and shmdumpdisp 65 */ 66 67 /* 68 ** Class ID and type defined in utils/attrib.lst 69 */ 70 select @DUMPCOND_CLASS = 7 71 select @OBJTYPE = "DC" 72 73 /* 74 ** The following constants define record types for the dump condition 75 ** class in the sysattributes table.The values set here must be the 76 ** same as those defined in utils/cfgdump.c. 77 */ 78 select @CFG_PRIMARY = 1 79 select @CFG_FILENAME = 2 80 select @CFG_DIRNAME = 3 81 select @CFG_MAXDUMPS = 4 82 select @CFG_PAGECACHE = 5 83 select @CFG_PROCCACHE = 6 84 select @CFG_UNUSED = 7 85 86 /* 87 ** The following must correspond to values in sysattr.h 88 */ 89 select @ATTR_ADD = 1 90 select @ATTR_CHANGE = 2 91 select @ATTR_DROP = 3 92 select @ATTR_FETCH = 4 93 94 /* 95 ** End Common Definition Section 96 */ 97 98 /* ----------------- Identify and Perform the Command ----------- */ 99 100 if (@type = 'defaults') 101 begin 102 /* 103 ** 18508, "You cannot drop the system default settings" 104 */ 105 raiserror 18508 106 return 1 107 end 108 109 begin tran drop_condition 110 111 /* 112 ** Delete all rows belonging to this condition from 113 ** the sysattributes table. 114 */ 115 if (@type in ('severity', 'timeslice', 'defaults', 'panic', 'dbcc') 116 and @value is NULL) 117 begin 118 /* 119 ** Value not required in order to drop 120 ** a severity, timeslice, panic, dbcc or defaults condition 121 */ 122 delete master.dbo.sysattributes 123 where class = @DUMPCOND_CLASS 124 and object_type = @OBJTYPE 125 and attribute = @attrib 126 end 127 else 128 begin 129 /* 130 ** For other condition types a value 131 ** must also be supplied. 132 */ 133 select @object = @value 134 delete master.dbo.sysattributes 135 where class = @DUMPCOND_CLASS 136 and object_type = @OBJTYPE 137 and attribute = @attrib 138 and object = @object 139 end 140 141 if (@@rowcount = 0) 142 begin 143 /* 144 ** 18509, "There is no condition set for %1! %2!" 145 */ 146 raiserror 18509, @type, @object 147 rollback tran drop_condition 148 return 1 149 end 150 151 if (@@error = 0) 152 begin 153 select @not_status = attrib_notify( 154 @DUMPCOND_CLASS, /*cl*/ 155 @attrib, /*attrib */ 156 @OBJTYPE, /*type*/ 157 @object, /*object*/ 158 @CFG_PRIMARY, /*info1*/ 159 NULL, /*info2*/ 160 NULL, /*info3*/ 161 NULL, /*cinfo*/ 162 NULL, /*intval*/ 163 NULL, /*charval*/ 164 NULL, /*textval*/ 165 NULL, /*imageval*/ 166 NULL, /*comment*/ 167 @ATTR_DROP) 168 169 if (@not_status = 0) 170 begin 171 /* 172 ** 18510, "Notification failed. Your change did not take affect." 173 */ 174 raiserror 18510 175 rollback tran drop_condition 176 return 1 177 end 178 end 179 180 /* 181 ** Delete of rows and notification were successful. 182 ** Commit transaction. 183 */ 184 commit tran drop_condition 185 186 /* 187 ** Indicate success 188 */ 189 return 0 190 191 /* 192 ** End sp_shmdumpdrop 193 */ 194
exec sp_procxmode 'sp_shmdumpdrop', 'AnyMode' go Grant Execute on sp_shmdumpdrop to public go
DEFECTS | |
MINU 4 Unique Index with nullable columns master..sysattributes | master..sysattributes |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 123 |
QTYP 4 Comparison type mismatch smallint = int | 123 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 125 |
QTYP 4 Comparison type mismatch smallint = int | 125 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 135 |
QTYP 4 Comparison type mismatch smallint = int | 135 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 137 |
QTYP 4 Comparison type mismatch smallint = int | 137 |
MGTP 3 Grant to public master..sysattributes | |
MGTP 3 Grant to public sybsystemprocs..sp_shmdumpdrop | |
MNER 3 No Error Check should check @@error after delete | 122 |
MNER 3 No Error Check should check @@error after delete | 134 |
MUCO 3 Useless Code Useless Brackets | 57 |
MUCO 3 Useless Code Useless Brackets | 100 |
MUCO 3 Useless Code Useless Brackets | 115 |
MUCO 3 Useless Code Useless Brackets | 141 |
MUCO 3 Useless Code Useless Brackets | 151 |
MUCO 3 Useless Code Useless Brackets | 169 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {class, object_type, attribute} | 123 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object, attribute, class} | 135 |
VNRD 3 Variable is not read @CFG_FILENAME | 79 |
VNRD 3 Variable is not read @CFG_DIRNAME | 80 |
VNRD 3 Variable is not read @CFG_MAXDUMPS | 81 |
VNRD 3 Variable is not read @CFG_PAGECACHE | 82 |
VNRD 3 Variable is not read @CFG_PROCCACHE | 83 |
VNRD 3 Variable is not read @CFG_UNUSED | 84 |
VNRD 3 Variable is not read @ATTR_ADD | 89 |
VNRD 3 Variable is not read @ATTR_CHANGE | 90 |
VNRD 3 Variable is not read @ATTR_FETCH | 92 |
VUNU 3 Variable is not used @CFG_INCLUDE | 46 |
VUNU 3 Variable is not used @CFG_OMIT | 47 |
VUNU 3 Variable is not used @CFG_DEFAULT | 48 |
MTR1 2 Metrics: Comments Ratio Comments: 54% | 17 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 7dec - 5exi + 2 | 17 |
MTR3 2 Metrics: Query Complexity Complexity: 55 | 17 |
DEPENDENCIES |
PROCS AND TABLES USED writes table master..sysattributes (1) CALLERS called by proc sybsystemprocs..sp_shmdumpconfig |