@@ -32,6 +32,8 @@ public static void init(ConfigDto dto) throws SQLException {
32
32
}
33
33
34
34
public static String runPl (String plName , Map <String , String > param ) throws SQLException {
35
+ int idx ;
36
+
35
37
// fill parans
36
38
param .putAll (configDto .getParamsAsMap ());
37
39
@@ -45,10 +47,10 @@ public static String runPl(String plName, Map<String, String> param) throws SQLE
45
47
46
48
sql .append (String .format (" NUM_ENTRIES := %s;\n " , param .size ()));
47
49
48
- int idx = 1 ;
50
+ idx = 1 ;
49
51
for (Map .Entry <String , String > entry : param .entrySet ()) {
50
- sql .append (String .format (" NAME_ARRAY(%s) := '%s'; \n " , idx , entry .getKey ()));
51
- sql .append (String .format (" VALUE_ARRAY(%s) := '%s'; \n " , idx , escape (entry .getValue ())));
52
+ sql .append (String .format (" NAME_ARRAY(%s) := ?; -- '%s'\n " , idx , entry .getKey ()));
53
+ sql .append (String .format (" VALUE_ARRAY(%s) := ?; -- '%s'\n " , idx , escape (entry .getValue ())));
52
54
idx ++;
53
55
}
54
56
@@ -63,9 +65,17 @@ public static String runPl(String plName, Map<String, String> param) throws SQLE
63
65
64
66
log .info ("QUERY:\n {}" , sql .toString ());
65
67
66
- stmt .executeUpdate (sql .toString ());
68
+ PreparedStatement pstmt = conn .prepareStatement (sql .toString ());
69
+ idx = 1 ;
70
+ for (Map .Entry <String , String > entry : param .entrySet ()) {
71
+ pstmt .setString (idx , entry .getKey ());
72
+ idx ++;
73
+ pstmt .setString (idx , entry .getValue ());
74
+ idx ++;
75
+ }
76
+
77
+ pstmt .execute ();
67
78
68
- log .info ("GET RESULT" );
69
79
return getResult ();
70
80
}
71
81
0 commit comments