From 5570349cd1d89ccb4dc60a6a110498f703d191a0 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Tue, 20 Jun 2017 18:05:39 +0530 Subject: [PATCH 1/2] Reverting back the other databases to use the arrays. --- .../device/mgt/core/search/mgt/impl/ProcessorImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java index 40f9346338..f08e4a3899 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java @@ -376,9 +376,8 @@ public class ProcessorImpl implements Processor { } else { query += "?) ORDER BY DEVICE_ID"; stmt = conn.prepareStatement(query); - for (int i = 0; i < devices.size(); i++) { - stmt.setInt(i, devices.get(i).getId()); - } + Array array = conn.createArrayOf("INT", Utils.getArrayOfDeviceIds(devices)); + stmt.setArray(1, array); } rs = stmt.executeQuery(); From 4bfd35cc74fbfd320f8f2e76571bc7c5d85507a0 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Tue, 20 Jun 2017 18:54:36 +0530 Subject: [PATCH 2/2] Fixing issue in mssql database issue in processor. --- .../carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java index f08e4a3899..cf7a1eb069 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java @@ -363,7 +363,8 @@ public class ProcessorImpl implements Processor { String query = "SELECT * FROM DM_DEVICE_INFO WHERE DEVICE_ID IN ("; if (conn.getMetaData().getDatabaseProductName().contains(DeviceManagementConstants.DataBaseTypes.DB_TYPE_H2) || conn.getMetaData() .getDatabaseProductName().contains(DeviceManagementConstants.DataBaseTypes.DB_TYPE_MYSQL) || - conn.getMetaData().getDatabaseProductName().contains(DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE)) { + conn.getMetaData().getDatabaseProductName().contains(DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE) || + conn.getMetaData().getDatabaseProductName().contains(DeviceManagementConstants.DataBaseTypes.DB_TYPE_MSSQL)) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < devices.size(); i++) { builder.append("?,");