summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-artifact-handler
diff options
context:
space:
mode:
authorPatrick Brady <patrick.brady@att.com>2019-07-17 13:22:35 -0700
committerPatrick Brady <patrick.brady@att.com>2019-07-17 13:22:39 -0700
commitafad136327003c1a4b8f3a5708e27d96e3374d67 (patch)
tree70294dd3974fc0cf79cc2e4744ec225d4c1ee0f8 /appc-inbound/appc-artifact-handler
parentc8783f0346c69d00ca686a07cb418db751598bb2 (diff)
Fixes for parameterized sql queries
The old non-parameterized queries would treat null entries in the SvcLogicContext as "null" string values. The parameterized query treats these as NULL sql values. This change keeps those values as "null" strings. Change-Id: Iee7f7a1861bdd82dc65d59db2be7862b49cf1207 Signed-off-by: Patrick Brady <patrick.brady@att.com> Issue-ID: APPC-1639
Diffstat (limited to 'appc-inbound/appc-artifact-handler')
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/CtxParameterizedResolver.java3
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/DBService.java1
2 files changed, 3 insertions, 1 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/CtxParameterizedResolver.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/CtxParameterizedResolver.java
index d44ba066b..344463cd3 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/CtxParameterizedResolver.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/CtxParameterizedResolver.java
@@ -79,7 +79,8 @@ public class CtxParameterizedResolver {
if (term != null) {
term = term.replaceAll("'", "''");
}
- arguments.add(term);
+ //valueOf will store null values as a String "null"
+ arguments.add(String.valueOf(term));
return "?";
} else {
return (term);
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/DBService.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/DBService.java
index 471b0b019..4f1df9b99 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/DBService.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/dbservices/DBService.java
@@ -104,6 +104,7 @@ public class DBService {
if (dblib != null && ctx != null) {
String key = "select max(ASDC_ARTIFACTS_ID) as id from ASDC_ARTIFACTS WHERE ARTIFACT_NAME = ?";
ArrayList<String> arguments = new ArrayList<>();
+ arguments.add(artifactName);
log.info("Getting Artifact ID String :" + key);
status = dblib.query(key, ctx, arguments);
if (status.toString().equals(FAILURE_PARAM)) {