diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java index dd1197b00501..c2be5d3c7def 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java @@ -16935,6 +16935,10 @@ public void addAPIRevision(APIRevision apiRevision) throws APIManagementExceptio // Add to AM_API_RESOURCE_SCOPE_MAPPING table and to AM_API_PRODUCT_MAPPING PreparedStatement getRevisionedURLMappingsStatement = connection .prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID); + if (connection.getMetaData().getDriverName().contains("MySQL")) { + getRevisionedURLMappingsStatement = connection.prepareStatement( + SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL); + } PreparedStatement insertScopeResourceMappingStatement = connection .prepareStatement(SQLConstants.APIRevisionSqlConstants.INSERT_SCOPE_RESOURCE_MAPPING); PreparedStatement insertProductResourceMappingStatement = connection @@ -18139,6 +18143,10 @@ public void addAPIProductRevision(APIRevision apiRevision) throws APIManagementE // Add to AM_API_RESOURCE_SCOPE_MAPPING table and to AM_API_PRODUCT_MAPPING PreparedStatement getRevisionedURLMappingsStatement = connection .prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID); + if (connection.getMetaData().getDriverName().contains("MySQL")) { + getRevisionedURLMappingsStatement = connection.prepareStatement( + SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL); + } PreparedStatement insertScopeResourceMappingStatement = connection .prepareStatement(SQLConstants.APIRevisionSqlConstants.INSERT_SCOPE_RESOURCE_MAPPING); PreparedStatement insertProductResourceMappingStatement = connection @@ -18372,6 +18380,10 @@ public void restoreAPIProductRevision(APIRevision apiRevision) throws APIManagem //Insert Scope Mappings and operation policy mappings PreparedStatement getRevisionedURLMappingsStatement = connection .prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID); + if (connection.getMetaData().getDriverName().contains("MySQL")) { + getRevisionedURLMappingsStatement = connection.prepareStatement( + SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL); + } PreparedStatement addResourceScopeMapping = connection.prepareStatement( SQLConstants.ADD_API_RESOURCE_SCOPE_MAPPING); PreparedStatement addOperationPolicyStatement = connection diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java index 1a73f621ff63..198019391647 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java @@ -3777,6 +3777,12 @@ public static class APIRevisionSqlConstants { public static final String GET_REVISIONED_URL_MAPPINGS_ID = "SELECT URL_MAPPING_ID FROM AM_API_URL_MAPPING " + "WHERE API_ID = ? AND REVISION_UUID = ? AND HTTP_METHOD = ? AND AUTH_SCHEME = ? AND URL_PATTERN = ? " + "AND THROTTLING_TIER = ? "; + + public static final String GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL = "SELECT URL_MAPPING_ID " + + "FROM AM_API_URL_MAPPING " + "WHERE API_ID = ? AND REVISION_UUID = ? AND HTTP_METHOD = ? AND " + + "AUTH_SCHEME = ? AND URL_PATTERN = CONVERT(? USING utf8mb4) COLLATE utf8mb4_bin " + + "AND THROTTLING_TIER = ? "; + public static final String GET_URL_MAPPINGS_ID = "SELECT URL_MAPPING_ID FROM AM_API_URL_MAPPING " + "WHERE API_ID = ? AND HTTP_METHOD = ? AND AUTH_SCHEME = ? AND URL_PATTERN = ? " + "AND THROTTLING_TIER = ? AND REVISION_UUID = ?";