DaanHoogland commented on code in PR #11974:
URL: https://github.com/apache/cloudstack/pull/11974#discussion_r2575939113


##########
engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDetailsDaoImpl.java:
##########
@@ -31,4 +34,18 @@ public void addDetail(long resourceId, String key, String 
value, boolean display
         super.addDetail(new VMInstanceDetailVO(resourceId, key, value, 
display));
     }
 
+    @Override
+    public int removeDetailsWithPrefix(long vmId, String prefix) {
+        if (StringUtils.isBlank(prefix)) {
+            return 0;
+        }
+        SearchBuilder<VMInstanceDetailVO> sb = createSearchBuilder();
+        sb.and("vmId", sb.entity().getResourceId(), SearchCriteria.Op.EQ);
+        sb.and("prefix", sb.entity().getName(), SearchCriteria.Op.LIKE);
+        sb.done();
+        SearchCriteria<VMInstanceDetailVO> sc = sb.create();
+        sc.setParameters("vmId", vmId);
+        sc.setParameters("prefix", prefix + "%");

Review Comment:
   This bit gives me to think that we might want to include these in a 
DbConstants, similar to the ApiConstants. No critisism on this PR as I know 
this is the general practice atm.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to