DatabaseProcApplicationCreatedLinks
sybsystemprocssp_addextendedproc  31 Aug 14Defects Dependencies

1     
2     
3     /* 
4     ** Messages from addextendedproc
5     **
6     ** 17260, "Can't run %1! from within a transaction." 
7     ** 18388, "You must be in the master database to run %1!"
8     ** 17240, "'%1!' is not a valid name."
9     ** 18387  "addextendedproc failed. Check the server error log file."
10    */
11    
12    create procedure sp_addextendedproc
13        @esp_name varchar(255), /* esp name */
14        @dll_name varchar(259) /* dll name (which may
15    						   include extension) */
16    as
17    
18    
19        /* If we're not in the master database, disallow addextendedproc */
20    
21        if db_name() != "master"
22        begin
23            /*
24            ** 18388, "You must be in the master database in order to run %1!
25            */
26            raiserror 18388, "sp_addextendedproc"
27            return (1)
28        end
29    
30        /*
31        **  If we're in a transaction, disallow this since it might make recovery
32        **  impossible.
33        */
34        if @@trancount > 0
35        begin
36            /*
37            ** 17260, "Can't run %1! from within a transaction." 
38            */
39            raiserror 17260, "sp_addextendedproc"
40            return (1)
41        end
42    
43        set chained off
44    
45        set transaction isolation level 1
46        /* check if user has sa role, proc_role will also do auditing
47        ** if required. proc_role will also print error message if required.
48        */
49        if (proc_role("sa_role") = 0)
50            return (1)
51    
52        /* check that esp_name is a valid identifier */
53        if valid_name(@esp_name, 255) = 0
54        begin
55            /*
56            ** 17240, "'%1!' is not a valid name."
57            */
58            raiserror 17240, @esp_name
59            return (1)
60        end
61    
62        /* can't check that dll_name is valid since it might
63        ** include .syntax, so check length only:
64        */
65        if char_length(@dll_name) > 255
66        begin
67            /*
68            ** 17240, "'%1!' is not a valid name." 
69            */
70            raiserror 17240, @dll_name
71            return (1)
72        end
73    
74    
75        dbcc addextendedproc(@esp_name, @dll_name)
76    
77        if (@@error != 0)
78        begin
79            /*
80            ** 18387, "sp_addextendedproc failed."
81            */
82            raiserror 18387
83            return (1)
84        end
85    
86        return (0)
87    
88    


exec sp_procxmode 'sp_addextendedproc', 'AnyMode'
go

Grant Execute on sp_addextendedproc to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_addextendedproc  
 MUCO 3 Useless Code Useless Brackets 27
 MUCO 3 Useless Code Useless Brackets 40
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 50
 MUCO 3 Useless Code Useless Brackets 59
 MUCO 3 Useless Code Useless Brackets 71
 MUCO 3 Useless Code Useless Brackets 77
 MUCO 3 Useless Code Useless Brackets 83
 MUCO 3 Useless Code Useless Brackets 86
 QISO 3 Set isolation level 45
 MTR1 2 Metrics: Comments Ratio Comments: 59% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 6dec - 6exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 28 12

DEPENDENCIES