Database | Proc | Application | Created | Links |
sybsystemprocs | sp_addengine ![]() | ![]() | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G% */ 3 4 /* 5 ** Messages for "sp_addengine" 6 ** 7 ** 17260, "Can't run %1! from within a transaction." 8 ** 18248, "Validation of Engine Group modification failed. Check server 9 ** errorlog for any additional information." 10 ** 18249, "Name '%1!' is not valid." 11 ** 18250, "Failed to add engine '%1!' to engine group '%2!'. Check server 12 ** errorlog for any additional information. List of engines in 13 ** engine group unchanged. 14 ** 18251, "Cannot modify pre-defined engine groups." 15 ** 19703, "Instance id '%1!' is not valid under instance system view." 16 */ 17 18 create procedure sp_addengine 19 @engine_number int, /* engine number of engine */ 20 @engine_group varchar(255), /* group that engine belongs to */ 21 @instanceid smallint = NULL /* instance id */ 22 as 23 24 declare @attrib_id int, 25 @action int, 26 @engine_name varchar(5), 27 @object_type varchar(2), 28 @new_list varchar(768), 29 @engine_list varchar(768), 30 @upcase_str varchar(255) 31 32 IF @@kernelmode != 'process' 33 BEGIN 34 /* 35 ** 17117 - "The '%1!' command is supported only in process kernel mode" 36 */ 37 raiserror 17117, "sp_addengine" 38 return 1 39 END 40 41 /* 42 ** IF we're in a transaction, disallow this since it might make recovery 43 ** impossible. 44 ** This check must be done before any select statement. Otherwise, 45 ** the select statement might start a transaction if the session is 46 ** running in chained mode. 47 */ 48 IF @@trancount > 0 49 BEGIN 50 /* 51 ** 17260, "Can't run %1! from within a transaction." 52 */ 53 raiserror 17260, "sp_addengine" 54 return (1) 55 END 56 ELSE 57 BEGIN 58 /* Use TSQL mode of unchained transactions */ 59 set chained off 60 END 61 62 select @action = 1 /* add or modify entry */ 63 select @attrib_id = 1 /* attribute is ENGINE_GROUP */ 64 select @object_type = 'EG' 65 select @engine_list = NULL /* var to hold list of engines in group */ 66 67 /* Dont do "Dirty Reads" */ 68 set transaction isolation level 1 69 70 /* 71 ** Check to see that the input params are correct and then hook up with 72 ** Sysattributes table to enter data. 73 */ 74 75 /* first convert any system defined engine group name to upper case */ 76 select @upcase_str = upper(@engine_group) 77 IF ((@upcase_str = "ANYENGINE") OR (@upcase_str = "LASTONLINE")) 78 select @engine_group = @upcase_str 79 80 /* Cannot add to pre-defined groups */ 81 if (@engine_group = "ANYENGINE" OR @engine_group = "LASTONLINE") 82 BEGIN 83 /* 84 ** 18251, "Cannot modify pre-defined engine groups." 85 */ 86 raiserror 18251 87 return (1) 88 END 89 90 IF ((@engine_group != "ANYENGINE") AND (@engine_group != "LASTONLINE")) 91 BEGIN 92 IF valid_name(@engine_group, 30) = 0 93 BEGIN 94 /* 95 ** 18249, "Name '%1!' is not valid." 96 */ 97 raiserror 18249, @engine_group 98 return (1) 99 END 100 END 101 102 /* For SDC, use @@instanceid if NULL is specified */ 103 if (@@clustermode = "shared disk cluster") 104 BEGIN 105 if ((@@system_view = "instance") AND 106 (@instanceid != NULL) AND 107 (@instanceid != @@instanceid)) 108 BEGIN 109 /* 110 ** 19703, "Instance id '%1!' is not valid under instance 111 ** system view." 112 */ 113 raiserror 19703, @instanceid 114 return (1) 115 END 116 117 if (@instanceid = NULL) 118 select @instanceid = @@instanceid 119 END 120 else 121 select @instanceid = NULL 122 123 /* 124 ** The validation routine checks that the supplied engine is not 125 ** already in the group and that it is a valid engine number 126 */ 127 IF attrib_valid(6, @attrib_id, @object_type, NULL, NULL, NULL, 128 @instanceid, @engine_group, @engine_number, NULL, NULL, 129 NULL, "", @action) = 0 130 BEGIN 131 /* 132 ** 18248, "Validation of Engine Group modification failed. Check 133 ** server errorlog for any additional information." 134 */ 135 raiserror 18248 136 return (1) 137 END 138 139 IF ((@engine_group != "ANYENGINE") AND (@engine_group != "LASTONLINE")) 140 BEGIN 141 /* 142 ** The list of engines belonging to an engine 143 ** group are kept in the format - 144 ** engine # : engine # : .... 145 ** So add the new engine in the correct format 146 */ 147 select @engine_name = str(@engine_number, 5) 148 IF exists (select * from master..sysattributes where 149 class = 6 AND 150 attribute = 1 AND 151 object_type = 'EG' AND 152 object_cinfo = @engine_group AND 153 object_info3 = @instanceid) 154 BEGIN 155 select @engine_list = (select char_value 156 from master..sysattributes where 157 class = 6 AND 158 attribute = 1 AND 159 object_type = 'EG' AND 160 object_cinfo = @engine_group AND 161 object_info3 = @instanceid) 162 163 select @new_list = (@engine_list + 164 @engine_name + ":") 165 166 update master..sysattributes 167 set char_value = @new_list 168 where class = 6 AND 169 attribute = 1 AND 170 object_type = 'EG' AND 171 object_cinfo = @engine_group AND 172 object_info3 = @instanceid 173 END 174 ELSE 175 BEGIN 176 select @new_list = (@engine_name + ":") 177 insert master..sysattributes 178 (class, attribute, object_type, object_info3, object_cinfo, char_value) 179 values (6, @attrib_id, @object_type, @instanceid, @engine_group, @new_list) 180 END 181 END 182 183 if (attrib_notify(6, @attrib_id, @object_type, NULL, @engine_number, NULL, 184 @instanceid, @engine_group, NULL, NULL, NULL, NULL, "", 185 @action)) = 0 186 BEGIN 187 /* 188 ** 18250, "Failed to add engine '%1!' to engine group '%2!'. Check 189 ** server errorlog for any additional information. List of 190 ** engines in engine group unchanged." 191 */ 192 IF (@engine_list is not NULL) 193 update master..sysattributes 194 set char_value = @engine_list 195 where class = 6 AND 196 attribute = 1 AND 197 object_type = 'EG' AND 198 object_cinfo = @engine_group AND 199 object_info3 = @instanceid 200 ELSE 201 delete master..sysattributes where 202 class = 6 AND 203 attribute = 1 AND 204 object_type = 'EG' AND 205 object_cinfo = @engine_group AND 206 object_info3 = @instanceid 207 208 raiserror 18250, @engine_number, @engine_group 209 return (1) 210 END 211 212 return (0) 213
DEFECTS | |
![]() | 129 |
![]() | 184 |
![]() | master..sysattributes |
![]() | 118 |
![]() | 179 |
![]() | 149 |
![]() | 150 |
![]() | 153 |
![]() | 157 |
![]() | 158 |
![]() | 161 |
![]() | 168 |
![]() | 169 |
![]() | 172 |
![]() | 195 |
![]() | 196 |
![]() | 199 |
![]() | 202 |
![]() | 203 |
![]() | 206 |
![]() | |
![]() | 106 |
![]() | 117 |
![]() | 166 |
![]() | 177 |
![]() | 193 |
![]() | 201 |
![]() | 54 |
![]() | 77 |
![]() | 81 |
![]() | 87 |
![]() | 90 |
![]() | 98 |
![]() | 103 |
![]() | 105 |
![]() | 114 |
![]() | 117 |
![]() | 136 |
![]() | 139 |
![]() | 183 |
![]() | 192 |
![]() | 209 |
![]() | 212 |
![]() | 201 |
![]() | 68 |
![]() | 178 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object_info3, object_cinfo, attribute, class} | 149 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object_info3, object_cinfo, attribute, class} | 157 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object_info3, object_cinfo, attribute, class} | 168 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object_info3, object_cinfo, attribute, class} | 195 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object_info3, object_cinfo, attribute, class} | 202 |
![]() | 148 |
![]() | 155 |
![]() | 18 |
![]() | 18 |
![]() | 18 |
DEPENDENCIES |
PROCS AND TABLES USED read_writes table master..sysattributes (1) ![]() |