Database | Proc | Application | Created | Links |
sybsystemprocs | sp_validateconfigname | 31 Aug 14 | Defects Dependencies |
1 2 3 /* 4 ** Messages for "sp_validateconfigname" 5 ** 6 ** 17410, "Configuration option doesn't exist. 7 ** 8 ** 17411, "Configuration option is not unique." 9 ** 10 */ 11 12 /* 13 ** Syntax: 14 ** 15 ** sp_validateconfigname "configname", [confignum , fullconfigname] 16 ** 17 ** This stored procedure validates a config parameter name. The name 18 ** supplied is checked if it is a valid config parameter name. 19 ** 20 ** Parameters: 21 ** configname - full/partial config parameter name. 22 ** confignum - optional output parameter. The config num of 23 ** the config parameter if input config name is 24 ** valid. 25 ** fullconfigname - optional output parameter. Full config name 26 ** as the input may have been partial. 27 ** Returns: 28 ** 1 - if invalid or non-unique config parameter. 29 ** 0 - if valid parameter. 30 */ 31 32 create procedure sp_validateconfigname 33 @configname varchar(255), 34 @confignum int = 0 output, 35 @fullconfigname varchar(255) = NULL output 36 as 37 38 declare @msg varchar(1024) 39 declare @configcount int 40 declare @configcount2 int 41 42 if @@trancount > 0 43 begin 44 /* 17260, "Can't run %1! from within a transaction." */ 45 raiserror 17260, "sp_validateconfigname" 46 return (1) 47 end 48 else 49 begin 50 set chained off 51 end 52 53 set transaction isolation level 1 54 55 /* we don't want too much of output */ 56 set nocount on 57 58 /* 59 ** Note that we don't want to select config variables related to 60 ** cache manager. This is done by checking for 'parent'. Cache 61 ** manager config variables are handled separately by the cache 62 ** manager stored procedures. 63 */ 64 select @configcount = count(*) 65 from master.dbo.sysconfigures 66 where name like "%" + @configname + "%" 67 and parent != 19 68 69 70 /* Check if there is duplicate row for the current instance */ 71 select @configcount2 = count(*) 72 from master.dbo.sysconfigures 73 where name like "%" + @configname + "%" 74 and parent != 19 75 76 77 /* 78 ** If more than one option like @configname, show the 79 ** duplicates and return. 80 */ 81 if @configcount > 1 or @configcount2 > 1 82 begin 83 /* 84 ** 17411, "Configuration option is not unique." 85 */ 86 exec sp_getmessage 17411, @msg output 87 print @msg 88 89 select option_name = convert(char(30), name), 90 config_value = convert(char(11), space(11 - char_length( 91 isnull(a.value2, convert(char(32), a.value)))) + 92 isnull(a.value2, convert(char(32), a.value))), 93 run_value = convert(char(11), space(11 - char_length( 94 isnull(b.value2, convert(char(32), b.value)))) + 95 96 isnull(b.value2, convert(char(32), b.value))) 97 98 99 from master.dbo.sysconfigures a, 100 master.dbo.syscurconfigs b 101 where 102 a.config *= b.config 103 and name like "%" + @configname + "%" 104 and parent != 19 105 and a.config != 19 106 107 108 return (1) 109 end 110 else 111 begin 112 /* 113 ** Check if user-supplied config option is valid. 114 */ 115 if @configcount = 0 116 begin 117 /* 118 ** 17410, "Configuration option doesn't exist. 119 */ 120 exec sp_getmessage 17410, @msg output 121 print @msg 122 return (1) 123 end 124 end 125 126 /* 127 ** Get the config number. 128 */ 129 select @confignum = config, 130 @fullconfigname = name 131 from master.dbo.sysconfigures 132 where name like "%" + @configname + "%" 133 and parent != 19 134 and config != 19 135 136 137 return (0) 138
exec sp_procxmode 'sp_validateconfigname', 'AnyMode' go Grant Execute on sp_validateconfigname to public go
RESULT SETS | |
sp_validateconfigname_rset_001 |
DEPENDENCIES |
PROCS AND TABLES USED reads table master..syscurconfigs (1) calls proc sybsystemprocs..sp_getmessage reads table sybsystemprocs..sysusermessages calls proc sybsystemprocs..sp_validlang reads table master..syslanguages (1) reads table master..sysmessages (1) reads table master..syslanguages (1) reads table master..sysconfigures (1) CALLERS called by proc sybsystemprocs..sp_monitorconfig called by proc sybsystemprocs..sp_sysmon_mdcache called by proc sybsystemprocs..sp_sysmon_analyze called by proc sybsystemprocs..sp_sysmon called by proc sybsystemprocs..sp_helpconfig called by proc sybsystemprocs..sp_countmetadata |