DatabaseProcApplicationCreatedLinks
sybsystemprocssp_shmdumpconfig  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** SP_SHMDUMPCONFIG
4     **
5     ** This file contains the definition of the sp_dumpconfig system
6     ** stored procedure.  This stored procedure is used to set shared
7     ** memory dump conditions and to display the current dump condition
8     ** settings.  If granular permissions is not enabled sa_role is required 
9     ** to make any changes to the system configuration.  If granular permissions
10    ** is enabled then the permission 'manage server configuration' is required.
11    ** Public access is granted to display the current settings.
12    **
13    ** This stored procedure calls sp_shmdumpdrop to drop shared memory
14    ** dump conditions; and it calls sp_shmdumpdisp to display current
15    ** settings.
16    **
17    ** Security: The sa_role role is required in order to add a dump condition.
18    ** The sa_role role is required by sp_shmdumpdrop to drop a dump
19    ** condition.
20    **
21    ** History:
22    ** 19sept96	pdorfman	Initial coding
23    ** 07apr97	pdorfman	Code complete
24    ** 21jan02	dwein		Added support for message dump type
25    ** 20jun03	panchaks	Added support for dbcc dump type
26    ** 12dec03	dwein		Added support for the halt / no_halt option
27    ** 18apr11      malloy          Added support for granular permissions
28    */
29    
30    create or replace procedure sp_shmdumpconfig
31        /* -------------- Stored Procedure Parameters ----------------------- */
32        @action varchar(10) = "display", /* action requested by user   */
33        @type varchar(20) = "", /* type of attribute affected */
34        @value int = NULL, /* attribute value            */
35        @maxdumps int = NULL, /* maximum # of dumps         */
36        @dirname varchar(255) = NULL, /* dump directory             */
37        @filename varchar(128) = NULL, /* dump file name.  Maximum   */
38        /* length is 30 but declare   */
39        /* longer here to avoid       */
40        /* truncation                 */
41        @optarg1 varchar(20) = NULL, /* in/exclude memory type or option     */
42        @optarg2 varchar(20) = NULL, /* in/exclude memory type or option     */
43        @optarg3 varchar(20) = NULL, /* in/exclude memory type or option     */
44        @optarg4 varchar(20) = NULL, /* in/exclude memory type or option     */
45        @optarg5 varchar(20) = NULL /* in/exclude memory type or option     */
46    as
47    
48        /* ----------------- Declare Local Variables ------------------------ */
49        declare @object int, /* object column value        */
50            @attrib int, /* attribute column value     */
51            @not_status int, /* notification return status */
52            @curarg varchar(20), /* memory mode working var    */
53            @opttype int, /* type of memory for obj     */
54            @optsetting int, /* setting for this memtype   */
55            @counter int, /* counter                    */
56            @recfound int, /* record already exists      */
57            @notify_cnt int, /* count notification done    */
58            @maxconds int, /* max # dump conditions      */
59            @curcount int, /* current # dump cond's      */
60            @trancount int, /* receiver for @@trancount   */
61            @print_str varchar(1024), /* Buffer for messages        */
62            @windows int, /* indicates if this is the windows platform */
63            @hvalue char(8), /* value as a hex number      */
64            @temp_maxdumps int, /* used to check maxdumps     */
65            @nullarg char(1),
66            @dummy int,
67            @status int,
68            @gp_enabled int
69    
70    
71    
72        /*
73        ** The following variables are treated as constants within this
74        ** stored procedure. They are set below.
75        */
76        declare @DUMPCOND_CLASS int, /* sysattributes class        */
77            @OBJTYPE char(2), /* sysattributes object typ   */
78            @CFG_PRIMARY int, /* primary record id          */
79            @CFG_FILENAME int, /* file name record id        */
80            @CFG_DIRNAME int, /* directory name record id   */
81            @CFG_MAXDUMPS int, /* maxdumps record id         */
82            @CFG_PAGECACHE int, /* page cache record id       */
83            @CFG_PROCCACHE int, /* proc cache record id       */
84            @CFG_UNUSED int, /* unused memory record id    */
85            @CFG_HALT int, /* halt option record id	*/
86            @CFG_CORE int, /* produce coredump */
87            @CFG_CSMD int, /* produce CSMD */
88            @ATTR_ADD int, /* add notification value     */
89            @ATTR_CHANGE int, /* change notification val    */
90            @ATTR_DROP int, /* drop notification value    */
91            @ATTR_FETCH int, /* fetch notification value   */
92            @CFG_INCLUDE int, /* include memory type        */
93            @CFG_OMIT int, /* omit memory type           */
94            @CFG_DEFAULT int, /* use default mem setting    */
95            @CFG_CLUSTER int /* behavior of dump in cluster*/
96    
97        /* ----------------- Setup and Validation ------------------------ */
98        set nocount on
99    
100       /*
101       **  Common Definition Section: Note: any changes made to the following
102       **  values must also be made in shmdumpdrop and shmdumpdisp
103       */
104   
105       /*
106       ** Class ID and type defined in utils/attrib.lst
107       */
108       select @DUMPCOND_CLASS = 7
109       select @OBJTYPE = "DC"
110   
111       /*
112       ** The following constants define record types for the dump condition
113       ** class in the sysattributes table.  The values set here must be the 
114       ** same as those defined in utils/shmdump.c.
115       */
116       select @CFG_PRIMARY = 1
117       select @CFG_FILENAME = 2
118       select @CFG_DIRNAME = 3
119       select @CFG_MAXDUMPS = 4
120       select @CFG_PAGECACHE = 5
121       select @CFG_PROCCACHE = 6
122       select @CFG_UNUSED = 7
123       select @CFG_HALT = 8
124       select @CFG_CLUSTER = 9
125       select @CFG_CORE = 10
126       select @CFG_CSMD = 11
127   
128       /*
129       ** The following constants are used for setting memory modes and other
130       ** options.  These values must correspond to those used in utils/shmdump.c.
131       */
132       select @CFG_DEFAULT = 0 /* Use the default value */
133       select @CFG_INCLUDE = 1 /* Include memory / Option On */
134       select @CFG_OMIT = 2 /* Omit memory / Option off */
135   
136       /*
137       ** The following must correspond to values in sysattr.h
138       */
139       select @ATTR_ADD = 1
140       select @ATTR_CHANGE = 2
141       select @ATTR_DROP = 3
142       select @ATTR_FETCH = 4
143   
144       /*
145       ** Determine if we are running on the windows platform
146       */
147       if (select charindex("Windows", @@version)) > 0
148       begin
149           select @windows = 1
150       end
151       else
152       begin
153           select @windows = 0
154       end
155   
156       /*
157       ** End Common Definition Section
158       */
159   
160       select @notify_cnt = 0
161   
162       /*
163       ** Validate the action value
164       */
165       if (@action not in ('add', 'drop', 'update', 'reset',
166                   'display', 'debug', 'config'))
167       begin
168           /*
169           ** 18516, "Invalid action %1!"
170           */
171           raiserror 18516, @action
172           return 17
173       end
174   
175       /*
176       ** Determine the attribute number for the attribute indicated
177       ** by the @type parameter.
178       **
179       ** NOTE: The integer values used for @attrib here must correspond to values
180       ** defined in utils/attrib.lst.  Any changes made here must also be made
181       ** in attrib.lst, and vice versa.
182       */
183   
184       if @type = 'error'
185           select @attrib = 1
186       else if @type = 'signal'
187           select @attrib = 2
188       else if (@windows = 1 and @type = 'exception')
189           select @attrib = 2
190       else if @type = 'severity'
191           select @attrib = 3
192       else if @type = 'module'
193           select @attrib = 4
194       else if @type = 'defaults'
195           select @attrib = 5
196       else if @type = 'timeslice'
197           select @attrib = 6
198       else if @type = 'panic'
199           select @attrib = 7
200       else if @type = 'message'
201           select @attrib = 8
202       else if @type = 'dbcc'
203           select @attrib = 9
204       else if @type = 'codepoint'
205           select @attrib = 10
206       else if @action = 'debug'
207       begin
208           select @action = 'display'
209           select @type = 'debug'
210       end
211       else if @action not in ('display', 'config')
212       begin
213           /*
214           ** We are here because @type does not have a valid value
215           ** and the @action value is not 'display' or 'config'. 
216           ** The 'config' option is responsible for validating its own
217           ** types.  The display option does not have a type flag.
218           */
219           /*
220           ** 18492, "Invalid dump condition type %1!"
221           */
222           raiserror 18492, @type
223           return 1
224       end
225   
226       /* 
227       ** If we are on windows and the user entered the "exception" condition
228       ** then we need to byte-swap the value stored in @value.
229       */
230       if (@windows = 1 and @type = 'exception')
231       begin
232           select @hvalue = inttohex(@value)
233           select @hvalue = substring(@hvalue, 7, 2) +
234               substring(@hvalue, 5, 2) +
235               substring(@hvalue, 3, 2) +
236               substring(@hvalue, 1, 2)
237           select @value = hextoint(@hvalue)
238       end
239   
240       /* ----------------- Identify and Perform the Command ----------- */
241   
242       /*
243       ** Add a new dump condition or configuration parameter
244       */
245       if (@action in ('add', 'update', 'reset'))
246       begin
247   
248           /* 
249           ** If granular permissions is not enabled then sa_role is required.
250           ** If granular permissions is enabled then the permission 
251           ** 'manage server configuration' is required.  proc_role and 
252           ** proc_auditperm will also do auditing if required. Both will also 
253           ** print error message if required.
254           */
255   
256           select @nullarg = NULL
257           execute @status = sp_aux_checkroleperm "sa_role",
258               "manage server configuration", @nullarg, @gp_enabled output
259   
260           /* For Auditing */
261           if (@gp_enabled = 0)
262           begin
263               if (proc_role("sa_role") = 0)
264                   return (2)
265           end
266           else
267           begin
268               select @dummy = proc_auditperm("manage server configuration",
269                       @status)
270           end
271   
272           if (@status != 0)
273               return (2)
274   
275           /*
276           ** Make sure valid parameters were provided
277           */
278           if (@action = 'add')
279           begin
280               if (@type = 'defaults')
281               begin
282                   /*
283                   ** 18493 "You cannot add the system default settings. Use update."
284                   */
285                   raiserror 18493
286                   return 3
287               end
288   
289               if ((@value is NULL) and
290                       (@type not in ('timeslice', 'panic', 'dbcc')))
291               begin
292                   /*
293                   ** 18494 "No value for %1! was given."
294                   */
295                   raiserror 18494, @type
296                   return 4
297               end
298   
299               /*
300               ** Determine whether there is room to add another dump condition.
301               ** Get configured maximum number of dump conditions
302               */
303               select @maxconds = value
304               from master.dbo.sysconfigures
305               where name = 'maximum dump conditions'
306   
307               /*
308               ** Count number of conditions set for type error, signal or module
309               */
310               select @curcount = count(*)
311               from master.dbo.sysattributes
312               where class = @DUMPCOND_CLASS
313                   and object_info1 = @CFG_PRIMARY
314                   and attribute != 5 /* Skip default entry */
315   
316               /*
317               ** Raise an error if there is no more room
318               */
319               if (@curcount >= @maxconds)
320               begin
321                   /*
322                   ** 18495, "The maximum number of dump conditions (%1!) are already set."
323                   */
324                   raiserror 18495, @maxconds
325   
326                   /*
327                   ** 18496,  "Either drop a dump condition or increase the value of 'maximum dump conditions'."
328                   */
329                   raiserror 18496
330                   return 5
331               end
332           end
333           else if (@action != 'reset')
334           begin
335               /*
336               ** Make sure that the user has provided arguments for at
337               ** least one updatable value.
338               */
339               if (@maxdumps is NULL and @dirname is NULL and @filename is NULL
340                       and @optarg1 is NULL and @optarg2 is NULL
341                       and @optarg3 is NULL and @optarg4 is NULL
342                       and @optarg5 is NULL)
343               begin
344                   /*
345                   ** 18497, "No values to update were given."
346                   */
347                   raiserror 18497
348                   return 6
349               end
350           end
351   
352           select @object = @value
353   
354           /*
355           ** Determine whether there are currently any records for the
356           ** the conditions supplied by the user.  This information is
357           ** used below.
358           */
359           if (@type in ('severity', 'defaults', 'timeslice', 'panic', 'dbcc'))
360           begin
361               if exists (select * from master.dbo.sysattributes
362                       where class = @DUMPCOND_CLASS
363                           and attribute = @attrib)
364               begin
365                   select @recfound = 1
366               end
367               else
368               begin
369                   select @recfound = 0
370               end
371           end
372           else
373           begin
374               if exists (select * from master.dbo.sysattributes
375                       where class = @DUMPCOND_CLASS
376                           and attribute = @attrib
377                           and object = @object)
378               begin
379                   select @recfound = 1
380               end
381               else
382               begin
383                   select @recfound = 0
384               end
385           end
386   
387           /*
388           ** Determine whether action can proceed.  For add, record must
389           ** not already exist, for update it must exist.
390           */
391           if (@action = 'add' and @recfound = 1)
392           begin
393               if (@type in ('severity', 'defaults', 'timeslice',
394                           'panic', 'dbcc'))
395               begin
396                   /*
397                   ** 18498, "There is already a condition of type %1!"
398                   */
399                   raiserror 18498, @type
400               end
401               else
402               begin
403                   /*
404                   ** 18499, "There is already a condition of type %1! and value %2!"
405                   */
406                   raiserror 18499, @type, @value
407               end
408               return 7
409           end
410           else if (@action = 'update' and @recfound = 0 and @type != 'defaults')
411           begin
412               if (@type in ('severity', 'timeslice', 'panic', 'dbcc'))
413               begin
414                   /*
415                   ** 18500, "No record found for %1!"
416                   */
417                   raiserror 18500, @type
418               end
419               else
420               begin
421                   /*
422                   ** 18501, "No record found for %1! %2!"
423                   */
424                   raiserror 18501, @type, @value
425               end
426               return 8
427           end
428   
429           /*
430           ** Validate the dump condition. Signal value cannot be
431           ** verified, since this is determined by the operating
432           ** system.  Message value cannot be validated either 
433           ** since there is no way to look this up. Dbcc type
434           ** has no value specified.  Codepoint also has no lookup.
435           */
436           if (@type = 'error')
437           begin
438               /*
439               ** Verify that an row exists for this error number
440               ** in the master..sysmessages table
441               */
442               if not exists (select * from master..sysmessages
443                       where error = @value)
444               begin
445                   /*
446                   ** 18502, "%1! is not a valid number for the 'error' dump condition.
447                   ** Try dump type 'message' instead.
448                   */
449                   raiserror 18502, @value
450                   return 9
451               end
452           end
453           else if (@type = 'module')
454           begin
455               /*
456               ** Make sure there is at least one error in
457               ** master..sysmessages that belongs to this module
458               */
459               if ((@value % 100 != 0)
460                       or not exists (select * from master..sysmessages
461                           where error between @value
462                               and @value + 99))
463               begin
464                   /*
465                   ** 18503, "%1! is not a valid module"
466                   */
467                   raiserror 18503, @value
468                   return 10
469               end
470           end
471           else if (@type = 'severity')
472           begin
473               /*
474               ** Minimum severity = 10; maximum severity = 26
475               */
476               if (@value < 10 or @value > 26)
477               begin
478                   /*
479                   `** 18504, "Severity must be between 10 and 26"
480                   */
481                   raiserror 18504
482                   return 11
483               end
484   
485               /*
486               ** Make sure we have the correct severity value
487               */
488               if (@action = 'update')
489               begin
490                   select @object = object
491                   from master.dbo.sysattributes
492                   where class = @DUMPCOND_CLASS
493                       and attribute = @attrib
494               end
495           end
496           else if (@type = 'defaults')
497           begin
498               if (@value is not null)
499               begin
500                   /*
501                   ** 18536, "The value parameter must be NULL when setting system defaults."
502                   */
503                   raiserror 18536
504                   goto error_exit
505               end
506   
507               /*
508               ** If there is not a default record, add one.
509               */
510               if (@recfound = 0)
511               begin
512                   select @action = 'add'
513               end
514           end
515   
516           /*
517           ** Reset the dump count for this condition.  This does not require
518           ** updating the sysattributes table, but a call must be made to
519           ** attrib_notify() to reset the value.
520           */
521           if (@action = 'reset')
522           begin
523               if (@type = 'defaults')
524               begin
525                   /*
526                   ** 18518,  "You cannot reset the dump count for the default setting."
527                   */
528                   raiserror 18518
529                   return 12
530               end
531   
532               /*
533               ** A non-zero value for info2 for the maxdumps entry
534               ** indicates that the dump count should be reset.
535               */
536               select @not_status
537                   = attrib_notify(@DUMPCOND_CLASS, /*cl*/
538                       @attrib, /*attrib */
539                       @OBJTYPE, /*type*/
540                       @object, /*object*/
541                       @CFG_MAXDUMPS, /*info1*/
542                       1, /*info2*/
543                       NULL, /*info3*/
544                       NULL, /*cinfo*/
545                       NULL, /*intval*/
546                       NULL, /*charval*/
547                       NULL, /*textval*/
548                       NULL, /*imageval*/
549                       NULL, /*comment*/
550                       @ATTR_CHANGE)
551   
552               if (@not_status = 0)
553               begin
554                   /*
555                   ** 18505, "Notification failed. Condition not set."
556                   */
557                   raiserror 18505
558                   return 13
559               end
560   
561               /*
562               ** 18517, "Dump count reset for %1! %2!"
563               */
564               exec sp_getmessage 18517, @print_str output
565               print @print_str, @type, @value
566               return 0
567           end
568   
569           /*
570           ** Values have been validated. Begin transaction and
571           ** insert primary row if needed.
572           */
573           begin tran add_condition
574   
575           /*
576           ** For add action, the primary record must first be added. For
577           ** update, it already exists.
578           */
579           if (@action = 'add')
580           begin
581               /*
582               ** Insert primary record for new entry in sysattributes 
583               ** table and invoke the notification routine if insert 
584               ** is successful.
585               */
586               insert master.dbo.sysattributes
587               (class, attribute, object_type, object, object_info1)
588               values (@DUMPCOND_CLASS, @attrib, @OBJTYPE, @object,
589                   @CFG_PRIMARY)
590   
591               if (@@error = 0)
592               begin
593                   select @not_status = attrib_notify(@DUMPCOND_CLASS,
594                           @attrib, @OBJTYPE,
595                           @object, @CFG_PRIMARY,
596                           NULL, NULL, NULL, NULL,
597                           NULL, NULL, NULL, NULL,
598                           @ATTR_ADD)
599   
600                   if (@not_status = 0)
601                   begin
602                       /*
603                       ** 18505, "Notification failed. Condition not set."
604                       */
605                       raiserror 18505
606                       goto error_exit
607                   end
608   
609                   select @notify_cnt = @notify_cnt + 1
610               end
611               else
612               begin
613                   /*
614                   ** 18506, "Insert of new record for %1! %2! failed."
615                   */
616                   raiserror 18506, @type, @value
617                   goto error_exit
618               end
619           end
620   
621           /*
622           ** Now insert rows for any additional condition settings
623           ** that were specified by the user.
624           */
625           if (@maxdumps is not NULL)
626           begin
627               if (@maxdumps <= 0)
628               begin
629                   /*
630                   ** 18519, "The maxdumps parameter value must be greater than zero."
631                   */
632                   raiserror 18519
633                   goto error_exit
634               end
635   
636               /*
637               ** A value of 0 means that the existing maxdumps setting
638               ** for this condition is being dropped. The sysattributes
639               ** row is removed and attrib_notify() is called to unset
640               ** the maxdumps value internally.
641               */
642               /*
643               ** Delete existing entry, if there is one
644               */
645               if (@action = 'update'
646                       and exists (select * from master.dbo.sysattributes
647                           where class = @DUMPCOND_CLASS
648                               and attribute = @attrib
649                               and object_type = @OBJTYPE
650                               and object = @object
651                               and object_info1 = @CFG_MAXDUMPS))
652               begin
653                   delete master.dbo.sysattributes
654                   where class = @DUMPCOND_CLASS
655                       and attribute = @attrib
656                       and object_type = @OBJTYPE
657                       and object = @object
658                       and object_info1 = @CFG_MAXDUMPS
659               end
660   
661               if (@maxdumps != 0)
662               begin
663                   insert master.dbo.sysattributes
664                   (class, attribute, object_type, object,
665                       object_info1, int_value)
666                   values (@DUMPCOND_CLASS, @attrib, @OBJTYPE,
667                       @object, @CFG_MAXDUMPS, @maxdumps)
668               end
669   
670               if (@@error = 0)
671               begin
672                   /*
673                   ** info2 must be set to zero to indicate the
674                   ** the maxdumps value should be updated.
675                   */
676                   select @not_status
677                       = attrib_notify(@DUMPCOND_CLASS, /*cl*/
678                           @attrib, /*attrib */
679                           @OBJTYPE, /*type*/
680                           @object, /*object*/
681                           @CFG_MAXDUMPS, /*info1*/
682                           0, /*info2*/
683                           NULL, /*info3*/
684                           NULL, /*cinfo*/
685                           @maxdumps, /*intval*/
686                           NULL, /*charval*/
687                           NULL, /*textval*/
688                           NULL, /*imageval*/
689                           NULL, /*comment*/
690                           @ATTR_CHANGE)
691   
692                   if (@not_status = 0)
693                   begin
694                       /*
695                       ** 18505, "Notification failed. Condition not set."
696                       */
697                       raiserror 18505
698                       goto error_exit
699                   end
700   
701                   select @notify_cnt = @notify_cnt + 1
702               end
703               else
704               begin
705                   goto error_exit
706               end
707   
708               /*
709               ** Warn the user that there is a dump file specified
710               ** for this condition and that setting maxdumps > 1 may
711               ** lead to dump files being oeverwritten.
712               */
713               if (@maxdumps > 1
714                       and exists (select *
715                           from master.dbo.sysattributes
716                           where class = @DUMPCOND_CLASS
717                               and attribute = @attrib
718                               and object_type = @OBJTYPE
719                               and object = @object
720                               and object_info1 = @CFG_FILENAME))
721               begin
722                   /*
723                   ** WARNING:  There is a dump file name configured for
724                   ** this dump condition.  Setting maxdumps to a value
725                   ** greater than 1 may cause the dump file to be
726                   ** overwritten if more than one shared memory dump
727                   ** is performed.
728                   */
729                   raiserror 19440
730               end
731           end
732   
733           /*
734           ** Set dump directory name if specified.  If user supplies a
735           ** @dirname value of "", drop the current value.
736           */
737           if (@dirname is not NULL)
738           begin
739               /*
740               ** Delete existing entry, if there is one
741               */
742               if (@action = 'update'
743                       and exists (select * from master.dbo.sysattributes
744                           where class = @DUMPCOND_CLASS
745                               and attribute = @attrib
746                               and object_type = @OBJTYPE
747                               and object = @object
748                               and object_info1 = @CFG_DIRNAME))
749               begin
750                   delete master.dbo.sysattributes
751                   where class = @DUMPCOND_CLASS
752                       and attribute = @attrib
753                       and object_type = @OBJTYPE
754                       and object = @object
755                       and object_info1 = @CFG_DIRNAME
756               end
757   
758               /*
759               ** If user supplies a @dirname value of "", then just
760               ** drop the current setting but do not insert a new one.
761               */
762               if (@dirname != "")
763               begin
764                   insert master.dbo.sysattributes
765                   (class, attribute, object_type, object,
766                       object_info1, char_value)
767                   values (@DUMPCOND_CLASS, @attrib, @OBJTYPE,
768                       @object, @CFG_DIRNAME, @dirname)
769   
770                   if (@@error = 0)
771                   begin
772                       select @not_status
773                           = attrib_notify(@DUMPCOND_CLASS, /*cl*/
774                               @attrib, /*attrib*/
775                               @OBJTYPE, /*type*/
776                               @object, /*object*/
777                               @CFG_DIRNAME, /*info1*/
778                               NULL, /*info2*/
779                               NULL, /*info3*/
780                               NULL, /*cinfo*/
781                               NULL, /*intval*/
782                               @dirname, /*charval*/
783                               NULL, /*textval*/
784                               NULL, /*imageval*/
785                               NULL, /*comment*/
786                               @ATTR_CHANGE)
787   
788                       if (@not_status = 0)
789                       begin
790                           /*
791                           ** 18505, "Notification failed. Condition not set."
792                           */
793                           raiserror 18505
794                           goto error_exit
795                       end
796   
797                       select @notify_cnt = @notify_cnt + 1
798                   end
799                   else
800                   begin
801                       goto error_exit
802                   end
803               end
804               else
805               begin
806                   /*
807                   ** Drop the dump directory entry for this
808                   ** condition.
809                   */
810                   if (@@error = 0)
811                   begin
812                       select @not_status
813                           = attrib_notify(@DUMPCOND_CLASS, /*cl*/
814                               @attrib, /*attrib*/
815                               @OBJTYPE, /*type*/
816                               @object, /*object*/
817                               @CFG_DIRNAME, /*info1*/
818                               NULL, /*info2*/
819                               NULL, /*info3*/
820                               NULL, /*cinfo*/
821                               NULL, /*intval*/
822                               NULL, /*charval*/
823                               NULL, /*textval*/
824                               NULL, /*imageval*/
825                               NULL, /*comment*/
826                               @ATTR_DROP)
827   
828                       if (@not_status = 0)
829                       begin
830                           /*
831                           ** 18505, "Notification failed. Condition not set."
832                           */
833                           raiserror 18505
834                           goto error_exit
835                       end
836                       select @notify_cnt = @notify_cnt + 1
837                   end
838                   else
839                   begin
840                       goto error_exit
841                   end
842               end
843           end
844   
845           /*
846           ** Set dump file name if specified. Drop the current value if
847           ** the user supplies a @filename value of "".
848           */
849           if (@filename is not NULL)
850           begin
851               /*
852               ** Delete existing entry, if there is one
853               */
854               if (@action = 'update'
855                       and exists (select * from master.dbo.sysattributes
856                           where class = @DUMPCOND_CLASS
857                               and attribute = @attrib
858                               and object_type = @OBJTYPE
859                               and object = @object
860                               and object_info1 = @CFG_FILENAME))
861               begin
862                   delete master.dbo.sysattributes
863                   where class = @DUMPCOND_CLASS
864                       and attribute = @attrib
865                       and object_type = @OBJTYPE
866                       and object = @object
867                       and object_info1 = @CFG_FILENAME
868               end
869   
870               /*
871               ** If the user supplies a @filename value of "", drop
872               ** the current value but do not insert a new one.
873               */
874               if (@filename != "")
875               begin
876                   /*
877                   ** Make sure the new file name is not longer than
878                   ** 30 characters
879                   */
880                   if ((select char_length(@filename)) > 30)
881                   begin
882                       /*
883                       ** The shared memory dump file name must be 30
884                       ** characters or less in length.
885                       */
886                       raiserror 19441
887                       goto error_exit
888                   end
889   
890                   insert master.dbo.sysattributes
891                   (class, attribute, object_type, object,
892                       object_info1, char_value)
893                   values (@DUMPCOND_CLASS, @attrib, @OBJTYPE,
894                       @object, @CFG_FILENAME, @filename)
895   
896                   if (@@error = 0)
897                   begin
898                       select @not_status
899                           = attrib_notify(@DUMPCOND_CLASS, /*cl*/
900                               @attrib, /*attrib */
901                               @OBJTYPE, /*type*/
902                               @object, /*object*/
903                               @CFG_FILENAME, /*info1*/
904                               NULL, /*info2*/
905                               NULL, /*info3*/
906                               NULL, /*cinfo*/
907                               NULL, /*intval*/
908                               @filename, /*charval*/
909                               NULL, /*textval*/
910                               NULL, /*imageval*/
911                               NULL, /*comment*/
912                               @ATTR_CHANGE)
913   
914                       if (@not_status = 0)
915                       begin
916                           /*
917                           ** 18505, "Notification failed. Condition not set."
918                           */
919                           raiserror 18505
920                           goto error_exit
921                       end
922                       select @notify_cnt = @notify_cnt + 1
923                   end
924                   else
925                   begin
926                       goto error_exit
927                   end
928   
929                   /*
930                   ** Warn the user that maxdumps is > 1 so using
931                   ** a fixed file name may result in dump files
932                   ** being overwritten but continue processing.
933                   */
934                   select @temp_maxdumps = int_value
935                   from master.dbo.sysattributes
936                   where class = @DUMPCOND_CLASS
937                       and attribute = @attrib
938                       and object_type = @OBJTYPE
939                       and object = @object
940                       and object_info1 = @CFG_MAXDUMPS
941   
942                   if (@temp_maxdumps > 1)
943                   begin
944                       /*
945                       ** WARNING:  The maxdumps value for this dump
946                       ** condition is greater than 1.  Using a
947                       ** configured file name may cause the dump file
948                       ** to be overwritten if more than one
949                       ** shared memory dump is performed.
950                       */
951                       raiserror 19439
952                   end
953               end
954               else
955               begin
956                   /*
957                   ** Drop the dump file name entry for this
958                   ** condition.
959                   */
960                   if (@@error = 0)
961                   begin
962                       select @not_status
963                           = attrib_notify(@DUMPCOND_CLASS, /*cl*/
964                               @attrib, /*attrib*/
965                               @OBJTYPE, /*type*/
966                               @object, /*object*/
967                               @CFG_FILENAME, /*info1*/
968                               NULL, /*info2*/
969                               NULL, /*info3*/
970                               NULL, /*cinfo*/
971                               NULL, /*intval*/
972                               NULL, /*charval*/
973                               NULL, /*textval*/
974                               NULL, /*imageval*/
975                               NULL, /*comment*/
976                               @ATTR_DROP)
977   
978                       if (@not_status = 0)
979                       begin
980                           /*
981                           ** 18505, "Notification failed. Condition not set."
982                           */
983                           raiserror 18505
984                           goto error_exit
985                       end
986                       select @notify_cnt = @notify_cnt + 1
987                   end
988                   else
989                   begin
990                       goto error_exit
991                   end
992               end
993           end
994   
995           if (@optarg1 is not NULL or @optarg2 is not NULL or @optarg3 is not NULL
996                   or @optarg4 is not NULL or @optarg5 is not NULL)
997           begin
998               select @counter = 0
999               while (@counter < 5)
1000              begin
1001                  /*
1002                  ** Set @curarg to current argument's value
1003                  */
1004                  if (@counter = 0)
1005                      select @curarg = @optarg1
1006                  else if (@counter = 1)
1007                      select @curarg = @optarg2
1008                  else if (@counter = 2)
1009                      select @curarg = @optarg3
1010                  else if (@counter = 3)
1011                      select @curarg = @optarg4
1012                  else if (@counter = 4)
1013                      select @curarg = @optarg5
1014  
1015                  /*
1016                  ** If arg is unset, go to next one
1017                  */
1018                  if (@curarg is NULL)
1019                  begin
1020                      select @counter = @counter + 1
1021                      continue
1022                  end
1023  
1024                  /*
1025                  ** Determine settings based on user's input
1026                  */
1027                  if (@curarg = "include_page")
1028                  begin
1029                      select @opttype = @CFG_PAGECACHE
1030                      select @optsetting = @CFG_INCLUDE
1031                  end
1032                  else if (@curarg = "omit_page")
1033                  begin
1034                      select @opttype = @CFG_PAGECACHE
1035                      select @optsetting = @CFG_OMIT
1036                  end
1037                  else if (@curarg = "default_page")
1038                  begin
1039                      select @opttype = @CFG_PAGECACHE
1040                      select @optsetting = @CFG_DEFAULT
1041                  end
1042                  else if (@curarg = "include_proc")
1043                  begin
1044                      select @opttype = @CFG_PROCCACHE
1045                      select @optsetting = @CFG_INCLUDE
1046                  end
1047                  else if (@curarg = "omit_proc")
1048                  begin
1049                      select @opttype = @CFG_PROCCACHE
1050                      select @optsetting = @CFG_OMIT
1051                  end
1052                  else if (@curarg = "default_proc")
1053                  begin
1054                      select @opttype = @CFG_PROCCACHE
1055                      select @optsetting = @CFG_DEFAULT
1056                  end
1057                  else if (@curarg = "include_unused")
1058                  begin
1059                      select @opttype = @CFG_UNUSED
1060                      select @optsetting = @CFG_INCLUDE
1061                  end
1062                  else if (@curarg = "omit_unused")
1063                  begin
1064                      select @opttype = @CFG_UNUSED
1065                      select @optsetting = @CFG_OMIT
1066                  end
1067                  else if (@curarg = "default_unused")
1068                  begin
1069                      select @opttype = @CFG_UNUSED
1070                      select @optsetting = @CFG_DEFAULT
1071                  end
1072                  else if (@curarg = "core")
1073                  begin
1074                      select @opttype = @CFG_CORE
1075                      select @optsetting = @CFG_INCLUDE
1076                  end
1077                  else if (@curarg = "nocore")
1078                  begin
1079                      select @opttype = @CFG_CORE
1080                      select @optsetting = @CFG_OMIT
1081                  end
1082                  else if (@curarg = "csmd")
1083                  begin
1084                      select @opttype = @CFG_CSMD
1085                      select @optsetting = @CFG_INCLUDE
1086                  end
1087                  else if (@curarg = "nocsmd")
1088                  begin
1089                      select @opttype = @CFG_CSMD
1090                      select @optsetting = @CFG_OMIT
1091                  end
1092                  else if (@curarg = "halt")
1093                  begin
1094                      select @opttype = @CFG_HALT
1095                      select @optsetting = @CFG_INCLUDE
1096                  end
1097                  else if (@curarg = "no_halt")
1098                  begin
1099                      select @opttype = @CFG_HALT
1100                      select @optsetting = @CFG_OMIT
1101                  end
1102                  else if (@curarg = "default_halt")
1103                  begin
1104                      select @opttype = @CFG_HALT
1105                      select @optsetting = @CFG_DEFAULT
1106                  end
1107                  else if (@curarg = "cluster_all")
1108                  begin
1109                      select @opttype = @CFG_CLUSTER
1110                      select @optsetting = @CFG_INCLUDE
1111                  end
1112                  else if (@curarg = "cluster_local")
1113                  begin
1114                      select @opttype = @CFG_CLUSTER
1115                      select @optsetting = @CFG_OMIT
1116                  end
1117                  else if (@curarg = "default_cluster")
1118                  begin
1119                      select @opttype = @CFG_CLUSTER
1120                      select @optsetting = @CFG_DEFAULT
1121                  end
1122                  else
1123                  begin
1124                      /*
1125                      ** 18507, "Invalid option mode %1!"
1126                      */
1127                      raiserror 18507, @curarg
1128                      goto error_exit
1129                  end
1130  
1131                  /*
1132                  ** Delete existing entry, if there is one
1133                  */
1134                  if (@action = 'update'
1135                          and exists (select * from master.dbo.sysattributes
1136                              where class = @DUMPCOND_CLASS
1137                                  and attribute = @attrib
1138                                  and object_type = @OBJTYPE
1139                                  and object = @object
1140                                  and object_info1 = @opttype))
1141                  begin
1142                      delete master.dbo.sysattributes
1143                      where class = @DUMPCOND_CLASS
1144                          and attribute = @attrib
1145                          and object_type = @OBJTYPE
1146                          and object = @object
1147                          and object_info1 = @opttype
1148                  end
1149  
1150                  /*
1151                  ** There is no need to insert a row to set
1152                  ** option setting to default. Any previous
1153                  ** row should be deleted and the notification
1154                  ** function must be called.
1155                  */
1156                  if (@optsetting != @CFG_DEFAULT)
1157                  begin
1158                      /*
1159                      ** Insert row into sysattributes table
1160                      */
1161                      insert master.dbo.sysattributes
1162                      (class, attribute, object_type,
1163                          object, object_info1,
1164                          int_value)
1165                      values (@DUMPCOND_CLASS, @attrib,
1166                          @OBJTYPE, @object, @opttype,
1167                          @optsetting)
1168  
1169                      if (@@error = 0)
1170                      begin
1171                          select @not_status
1172                              = attrib_notify(
1173                                  @DUMPCOND_CLASS, /*cl*/
1174                                  @attrib, /*attrib */
1175                                  @OBJTYPE, /*type*/
1176                                  @object, /*object*/
1177                                  @opttype, /*info1*/
1178                                  NULL, /*info2*/
1179                                  NULL, /*info3*/
1180                                  NULL, /*cinfo*/
1181                                  @optsetting, /*intval*/
1182                                  NULL, /*charval*/
1183                                  NULL, /*textval*/
1184                                  NULL, /*imageval*/
1185                                  NULL, /*comment*/
1186                                  @ATTR_CHANGE)
1187  
1188                          if (@not_status = 0)
1189                          begin
1190                              /*
1191                              ** 18505, "Notification failed. Condition not set."
1192                              */
1193                              raiserror 18505
1194                              goto error_exit
1195                          end
1196                          select @notify_cnt = @notify_cnt + 1
1197                      end
1198                      else
1199                      begin
1200                          goto error_exit
1201                      end
1202                  end
1203                  else
1204                  begin
1205                      /*
1206                      ** Drop this option setting for this
1207                      ** condition.
1208                      */
1209                      if (@@error = 0)
1210                      begin
1211                          select @not_status
1212                              = attrib_notify(
1213                                  @DUMPCOND_CLASS, /*cl*/
1214                                  @attrib, /*attrib */
1215                                  @OBJTYPE, /*type*/
1216                                  @object, /*object*/
1217                                  @opttype, /*info1*/
1218                                  NULL, /*info2*/
1219                                  NULL, /*info3*/
1220                                  NULL, /*cinfo*/
1221                                  NULL, /*intval*/
1222                                  NULL, /*charval*/
1223                                  NULL, /*textval*/
1224                                  NULL, /*imageval*/
1225                                  NULL, /*comment*/
1226                                  @ATTR_DROP)
1227  
1228                          if (@not_status = 0)
1229                          begin
1230                              /*
1231                              ** 18505, "Notification failed. Condition not set."
1232                              */
1233                              raiserror 18505
1234                              goto error_exit
1235                          end
1236                          select @notify_cnt = @notify_cnt + 1
1237                      end
1238                      else
1239                      begin
1240                          goto error_exit
1241                      end
1242                  end
1243  
1244                  select @counter = @counter + 1
1245              end
1246          end
1247  
1248          /*
1249          ** All rows successfully added for this condition.
1250          ** Commit transaction.
1251          */
1252          commit tran add_condition
1253      end
1254      /*
1255      ** Drop a dump condition
1256      */
1257      else if (@action = 'drop')
1258      begin
1259          exec sp_shmdumpdrop @type, @value, @attrib
1260      end
1261      /*
1262      ** Display current dump condition configuration
1263      */
1264      else if (@action = 'display')
1265      begin
1266          exec sp_shmdumpdisp @type
1267      end
1268      /*
1269      ** Execute the config action
1270      */
1271      else if (@action = 'config')
1272      begin
1273          exec sp_shmdumpconfig_config @type, @value
1274      end
1275  
1276      /*
1277      ** Indicate success
1278      */
1279      return 0
1280  
1281      /*
1282      ** An error occured while inserting rows into the sysattributes table.
1283      ** Check to see whether this was an add operation.  If so, remove any in-memory 
1284      ** entries added before error occured.  There is a possibility that the
1285      ** in-memory data structure will be left in a state that is not consistent
1286      ** with the sysattributes table entries.  This would be the case if we were
1287      ** performing an update of an existing dump condition and one or more
1288      ** rows had been successfully added to sysattributes before the failure
1289      ** occured.  In that case, the in-memory table would also have been updated.
1290      ** These updates are not transactional and we have no way of restoring them
1291      ** to their state prior to the execution of the stored procedure. This
1292      ** will only happen in the case of an update operation.  In the case of an 
1293      ** add operation, the in-memory entries will be removed by the call to
1294      ** attrib_notify() below. To correct this problem, drop and re-add the
1295      ** dump condition.
1296      */
1297  error_exit:
1298  
1299      if (@action = 'add' and @notify_cnt > 0)
1300      begin
1301          /*
1302          ** An error occured while adding a new dump
1303          ** condition but the runtime has already been notified.
1304          ** Remove the reference to this condition before
1305          ** returning.
1306          */
1307          select @not_status = attrib_notify(
1308                  @DUMPCOND_CLASS, /*class*/
1309                  @attrib, /*attrib */
1310                  @OBJTYPE, /*type*/
1311                  @object, /*object*/
1312                  @CFG_PRIMARY, /*info1*/
1313                  NULL, /*info2*/
1314                  NULL, /*info3*/
1315                  NULL, /*cinfo*/
1316                  NULL, /*intval*/
1317                  NULL, /*charval*/
1318                  NULL, /*textval*/
1319                  NULL, /*imageval*/
1320                  NULL, /*comment*/
1321                  @ATTR_DROP)
1322  
1323          if (@not_status = 0)
1324          begin
1325              /*
1326              ** 18505, "Notification failed. Condition not set."
1327              */
1328              raiserror 18505
1329          end
1330      end
1331  
1332      /*
1333      ** Rollback any active transaction to undo changes
1334      ** made to the sysattributes table.
1335      */
1336      select @trancount = @@trancount
1337  
1338      if (@trancount > 0)
1339      begin
1340          /*
1341          ** Rollback the current transaction
1342          */
1343          rollback tran add_condition
1344      end
1345  
1346      return 18
1347  
1348  /*
1349  ** End of sp_shmdumpconfig
1350  */
1351  


exec sp_procxmode 'sp_shmdumpconfig', 'AnyMode'
go

Grant Execute on sp_shmdumpconfig to public
go
DEFECTS
 MCTR 4 Conditional Begin Tran or Commit Tran 573
 MCTR 4 Conditional Begin Tran or Commit Tran 1252
 MEST 4 Empty String will be replaced by Single Space 33
 MEST 4 Empty String will be replaced by Single Space 762
 MEST 4 Empty String will be replaced by Single Space 874
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MTYP 4 Assignment type mismatch attribute: smallint = int 588
 MTYP 4 Assignment type mismatch class: smallint = int 588
 MTYP 4 Assignment type mismatch attribute: smallint = int 666
 MTYP 4 Assignment type mismatch class: smallint = int 666
 MTYP 4 Assignment type mismatch attribute: smallint = int 767
 MTYP 4 Assignment type mismatch class: smallint = int 767
 MTYP 4 Assignment type mismatch attribute: smallint = int 893
 MTYP 4 Assignment type mismatch class: smallint = int 893
 MTYP 4 Assignment type mismatch attribute: smallint = int 1165
 MTYP 4 Assignment type mismatch class: smallint = int 1165
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 312
 QTYP 4 Comparison type mismatch smallint = int 312
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 314
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 362
 QTYP 4 Comparison type mismatch smallint = int 362
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 363
 QTYP 4 Comparison type mismatch smallint = int 363
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 375
 QTYP 4 Comparison type mismatch smallint = int 375
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 376
 QTYP 4 Comparison type mismatch smallint = int 376
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 492
 QTYP 4 Comparison type mismatch smallint = int 492
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 493
 QTYP 4 Comparison type mismatch smallint = int 493
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 647
 QTYP 4 Comparison type mismatch smallint = int 647
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 648
 QTYP 4 Comparison type mismatch smallint = int 648
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 654
 QTYP 4 Comparison type mismatch smallint = int 654
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 655
 QTYP 4 Comparison type mismatch smallint = int 655
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 716
 QTYP 4 Comparison type mismatch smallint = int 716
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 717
 QTYP 4 Comparison type mismatch smallint = int 717
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 744
 QTYP 4 Comparison type mismatch smallint = int 744
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 745
 QTYP 4 Comparison type mismatch smallint = int 745
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 751
 QTYP 4 Comparison type mismatch smallint = int 751
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 752
 QTYP 4 Comparison type mismatch smallint = int 752
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 856
 QTYP 4 Comparison type mismatch smallint = int 856
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 857
 QTYP 4 Comparison type mismatch smallint = int 857
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 863
 QTYP 4 Comparison type mismatch smallint = int 863
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 864
 QTYP 4 Comparison type mismatch smallint = int 864
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 936
 QTYP 4 Comparison type mismatch smallint = int 936
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 937
 QTYP 4 Comparison type mismatch smallint = int 937
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1136
 QTYP 4 Comparison type mismatch smallint = int 1136
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1137
 QTYP 4 Comparison type mismatch smallint = int 1137
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1143
 QTYP 4 Comparison type mismatch smallint = int 1143
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1144
 QTYP 4 Comparison type mismatch smallint = int 1144
 MGTP 3 Grant to public master..sysattributes  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public sybsystemprocs..sp_shmdumpconfig  
 MNER 3 No Error Check should check return value of exec 564
 MNER 3 No Error Check should check @@error after delete 653
 MNER 3 No Error Check should check @@error after insert 663
 MNER 3 No Error Check should check @@error after delete 750
 MNER 3 No Error Check should check @@error after delete 862
 MNER 3 No Error Check should check @@error after delete 1142
 MNER 3 No Error Check should check return value of exec 1259
 MNER 3 No Error Check should check return value of exec 1266
 MNER 3 No Error Check should check return value of exec 1273
 MUCO 3 Useless Code Useless Brackets 165
 MUCO 3 Useless Code Useless Brackets 188
 MUCO 3 Useless Code Useless Brackets 230
 MUCO 3 Useless Code Useless Brackets 245
 MUCO 3 Useless Code Useless Brackets 261
 MUCO 3 Useless Code Useless Brackets 263
 MUCO 3 Useless Code Useless Brackets 264
 MUCO 3 Useless Code Useless Brackets 272
 MUCO 3 Useless Code Useless Brackets 273
 MUCO 3 Useless Code Useless Brackets 278
 MUCO 3 Useless Code Useless Brackets 280
 MUCO 3 Useless Code Useless Brackets 289
 MUCO 3 Useless Code Useless Brackets 319
 MUCO 3 Useless Code Useless Brackets 333
 MUCO 3 Useless Code Useless Brackets 339
 MUCO 3 Useless Code Useless Brackets 359
 MUCO 3 Useless Code Useless Brackets 391
 MUCO 3 Useless Code Useless Brackets 393
 MUCO 3 Useless Code Useless Brackets 410
 MUCO 3 Useless Code Useless Brackets 412
 MUCO 3 Useless Code Useless Brackets 436
 MUCO 3 Useless Code Useless Brackets 453
 MUCO 3 Useless Code Useless Brackets 459
 MUCO 3 Useless Code Useless Brackets 471
 MUCO 3 Useless Code Useless Brackets 476
 MUCO 3 Useless Code Useless Brackets 488
 MUCO 3 Useless Code Useless Brackets 496
 MUCO 3 Useless Code Useless Brackets 498
 MUCO 3 Useless Code Useless Brackets 510
 MUCO 3 Useless Code Useless Brackets 521
 MUCO 3 Useless Code Useless Brackets 523
 MUCO 3 Useless Code Useless Brackets 552
 MUCO 3 Useless Code Useless Brackets 579
 MUCO 3 Useless Code Useless Brackets 591
 MUCO 3 Useless Code Useless Brackets 600
 MUCO 3 Useless Code Useless Brackets 625
 MUCO 3 Useless Code Useless Brackets 627
 MUCO 3 Useless Code Useless Brackets 645
 MUCO 3 Useless Code Useless Brackets 661
 MUCO 3 Useless Code Useless Brackets 670
 MUCO 3 Useless Code Useless Brackets 692
 MUCO 3 Useless Code Useless Brackets 713
 MUCO 3 Useless Code Useless Brackets 737
 MUCO 3 Useless Code Useless Brackets 742
 MUCO 3 Useless Code Useless Brackets 762
 MUCO 3 Useless Code Useless Brackets 770
 MUCO 3 Useless Code Useless Brackets 788
 MUCO 3 Useless Code Useless Brackets 810
 MUCO 3 Useless Code Useless Brackets 828
 MUCO 3 Useless Code Useless Brackets 849
 MUCO 3 Useless Code Useless Brackets 854
 MUCO 3 Useless Code Useless Brackets 874
 MUCO 3 Useless Code Useless Brackets 880
 MUCO 3 Useless Code Useless Brackets 896
 MUCO 3 Useless Code Useless Brackets 914
 MUCO 3 Useless Code Useless Brackets 942
 MUCO 3 Useless Code Useless Brackets 960
 MUCO 3 Useless Code Useless Brackets 978
 MUCO 3 Useless Code Useless Brackets 995
 MUCO 3 Useless Code Useless Brackets 999
 MUCO 3 Useless Code Useless Brackets 1004
 MUCO 3 Useless Code Useless Brackets 1006
 MUCO 3 Useless Code Useless Brackets 1008
 MUCO 3 Useless Code Useless Brackets 1010
 MUCO 3 Useless Code Useless Brackets 1012
 MUCO 3 Useless Code Useless Brackets 1018
 MUCO 3 Useless Code Useless Brackets 1027
 MUCO 3 Useless Code Useless Brackets 1032
 MUCO 3 Useless Code Useless Brackets 1037
 MUCO 3 Useless Code Useless Brackets 1042
 MUCO 3 Useless Code Useless Brackets 1047
 MUCO 3 Useless Code Useless Brackets 1052
 MUCO 3 Useless Code Useless Brackets 1057
 MUCO 3 Useless Code Useless Brackets 1062
 MUCO 3 Useless Code Useless Brackets 1067
 MUCO 3 Useless Code Useless Brackets 1072
 MUCO 3 Useless Code Useless Brackets 1077
 MUCO 3 Useless Code Useless Brackets 1082
 MUCO 3 Useless Code Useless Brackets 1087
 MUCO 3 Useless Code Useless Brackets 1092
 MUCO 3 Useless Code Useless Brackets 1097
 MUCO 3 Useless Code Useless Brackets 1102
 MUCO 3 Useless Code Useless Brackets 1107
 MUCO 3 Useless Code Useless Brackets 1112
 MUCO 3 Useless Code Useless Brackets 1117
 MUCO 3 Useless Code Useless Brackets 1134
 MUCO 3 Useless Code Useless Brackets 1156
 MUCO 3 Useless Code Useless Brackets 1169
 MUCO 3 Useless Code Useless Brackets 1188
 MUCO 3 Useless Code Useless Brackets 1209
 MUCO 3 Useless Code Useless Brackets 1228
 MUCO 3 Useless Code Useless Brackets 1257
 MUCO 3 Useless Code Useless Brackets 1264
 MUCO 3 Useless Code Useless Brackets 1271
 MUCO 3 Useless Code Useless Brackets 1299
 MUCO 3 Useless Code Useless Brackets 1323
 MUCO 3 Useless Code Useless Brackets 1338
 QAFM 3 Var Assignment from potentially many rows 303
 QAFM 3 Var Assignment from potentially many rows 490
 QAFM 3 Var Assignment from potentially many rows 934
 QIWC 3 Insert with not all columns specified missing 10 columns out of 15 587
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 664
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 765
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 891
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 1162
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {name}
305
 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_info1, attribute}
312
 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, attribute}
362
 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, class, attribute}
375
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
443
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
461
 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, attribute}
492
 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_info1, object_type, object, attribute, class}
647
 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_info1, object_type, object, attribute, class}
654
 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_info1, object_type, object, attribute, class}
716
 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_info1, object_type, object, attribute, class}
744
 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_info1, object_type, object, attribute, class}
751
 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_info1, object_type, object, attribute, class}
856
 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_info1, object_type, object, attribute, class}
863
 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_info1, object_type, object, attribute, class}
936
 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_info1, object_type, object, attribute, class}
1136
 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_info1, object_type, object, attribute, class}
1143
 VNRD 3 Variable is not read @ATTR_FETCH 142
 VNRD 3 Variable is not read @dummy 268
 MSUB 2 Subquery Marker 361
 MSUB 2 Subquery Marker 374
 MSUB 2 Subquery Marker 442
 MSUB 2 Subquery Marker 460
 MSUB 2 Subquery Marker 646
 MSUB 2 Subquery Marker 714
 MSUB 2 Subquery Marker 743
 MSUB 2 Subquery Marker 855
 MSUB 2 Subquery Marker 1135
 MTR1 2 Metrics: Comments Ratio Comments: 41% 30
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 153 = 168dec - 17exi + 2 30
 MTR3 2 Metrics: Query Complexity Complexity: 542 30

DATA PROPAGATION detailed
ColumnWritten To
@dirnamesysattributes.char_value   sysattributes.int_value   °.char_value   sp_dropdevice_rset_001.device sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.status sp_forceonline_object_rset_002.status sp_forceonline_page_rset_001.status sp_forceonline_page_rset_002.status sp_listsuspect_object_rset_001.Access
sp_listsuspect_page_rset_001.Access sp_makesuspect_obj_rset_001.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Indid °.LogType °.PageType
°.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_passwordpolicy_rset_001.message
sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name sp_setsuspect_granularity_rset_001.Online mode sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@filenamesysattributes.char_value   sysattributes.int_value   °.char_value   sp_dropdevice_rset_001.device sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.status sp_forceonline_object_rset_002.status sp_forceonline_page_rset_001.status sp_forceonline_page_rset_002.status sp_listsuspect_object_rset_001.Access
sp_listsuspect_page_rset_001.Access sp_makesuspect_obj_rset_001.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Indid °.LogType °.PageType
°.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_passwordpolicy_rset_001.message
sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name sp_setsuspect_granularity_rset_001.Online mode sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@maxdumpssysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file sp_passwordpolicy_rset_001.message sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@valuesysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file sp_passwordpolicy_rset_001.message sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_shmdumpdisp  
   read_writes table tempdb..#conditions (1) 
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)  
   calls proc sybsystemprocs..sp_getmessage  
      calls proc sybsystemprocs..sp_validlang  
         reads table master..syslanguages (1)  
      reads table master..syslanguages (1)  
      reads table sybsystemprocs..sysusermessages  
      reads table master..sysmessages (1)  
   read_writes table tempdb..#attname (1) 
   reads table master..sysmessages (1)  
   calls proc sybsystemprocs..sp_shmdumpsize  
      reads table master..sysconfigures (1)  
      reads table master..sysattributes (1)  
      reads table master..syscurconfigs (1)  
   reads table master..sysattributes (1)  
reads table master..sysmessages (1)  
calls proc sybsystemprocs..sp_shmdumpdrop  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
      reads table master..syscurconfigs (1)  
      reads table master..sysconfigures (1)  
   writes table master..sysattributes (1)  
calls proc sybsystemprocs..sp_getmessage  
calls proc sybsystemprocs..sp_aux_checkroleperm  
calls proc sybsystemprocs..sp_shmdumpconfig_config  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
   read_writes table master..sysattributes (1)  
read_writes table master..sysattributes (1)  
reads table master..sysconfigures (1)