DatabaseProcApplicationCreatedLinks
sybsystemprocssp_aux_encr_lookup  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_aux_encr_lookup
3         @owner varchar(30),
4         @keyname varchar(255),
5         @db_name varchar(30)
6     as
7         begin
8             declare @keydbid varchar(8)
9                 , @sqlstmt varchar(1100)
10                , @wrapped_dbname varchar(32)
11                , @tab_str char(3)
12                , @blank_str char(3)
13    
14            select @tab_str = '%	%'
15            select @blank_str = '% %'
16            select @keydbid = convert(varchar(8), db_id(@db_name))
17            /*
18            ** Database name in which there is tab or blank must be
19            ** delimited with '[]' for selection in sql cmd.
20            */
21            select @wrapped_dbname = @db_name
22            if ((patindex(@tab_str, @db_name) > 0)
23                    or (patindex(@blank_str, @db_name) > 0))
24            begin
25                select @wrapped_dbname = '[' + @db_name + ']'
26            end
27    
28            select @sqlstmt =
29                "insert #encrypted_column_info(keyname, keyowner,  username, objname, colname) " +
30                "select o2.name, u.name, user_name(o1.uid), o1.name, c.name " +
31                "from syscolumns c, sysobjects o1, " +
32                @wrapped_dbname + "..sysobjects o2, " + @wrapped_dbname + "..sysusers u " +
33                "where c.id = o1.id and " +
34                "(c.encrkeydb = " + "'" + @wrapped_dbname + "'" +
35                "or (c.encrkeydb is NULL and " + "'" + @keydbid + "'" +
36                " = convert(varchar(8), db_id()))) " +
37                "and c.encrkeyid = o2.id " +
38                "and o2.type in ('EK') " +
39                "and o2.name like " + "'" + @keyname + "' " +
40                "and o2.uid = u.uid " +
41                "and u.name like " + "'" + @owner + "'"
42    
43            exec sp_exec_SQL @sqlstmt, "sp_aux_encr_lookup"
44        end
45    
46    

DEFECTS
 MNER 3 No Error Check should check return value of exec 43
 MUCO 3 Useless Code Useless Begin-End Pair 7
 MUCO 3 Useless Code Useless Brackets 22
 MTR1 2 Metrics: Comments Ratio Comments: 7% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 3dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 12 2

DATA PROPAGATION detailed
ColumnWritten To
@db_namesp_exec_SQL_rset_001.sqlbNoName57
@keynamesp_exec_SQL_rset_001.sqlbNoName57
@ownersp_exec_SQL_rset_001.sqlbNoName57

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_exec_SQL  
   writes table sybsystemprocs..sp_exec_SQL_rset_001