Skip to content

Commit 312e7b1

Browse files
committed
Fix error creating new revision
1 parent a8877e0 commit 312e7b1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java

+12
Original file line numberDiff line numberDiff line change
@@ -16935,6 +16935,10 @@ public void addAPIRevision(APIRevision apiRevision) throws APIManagementExceptio
1693516935
// Add to AM_API_RESOURCE_SCOPE_MAPPING table and to AM_API_PRODUCT_MAPPING
1693616936
PreparedStatement getRevisionedURLMappingsStatement = connection
1693716937
.prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID);
16938+
if (connection.getMetaData().getDriverName().contains("MySQL")) {
16939+
getRevisionedURLMappingsStatement = connection.prepareStatement(
16940+
SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL);
16941+
}
1693816942
PreparedStatement insertScopeResourceMappingStatement = connection
1693916943
.prepareStatement(SQLConstants.APIRevisionSqlConstants.INSERT_SCOPE_RESOURCE_MAPPING);
1694016944
PreparedStatement insertProductResourceMappingStatement = connection
@@ -18139,6 +18143,10 @@ public void addAPIProductRevision(APIRevision apiRevision) throws APIManagementE
1813918143
// Add to AM_API_RESOURCE_SCOPE_MAPPING table and to AM_API_PRODUCT_MAPPING
1814018144
PreparedStatement getRevisionedURLMappingsStatement = connection
1814118145
.prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID);
18146+
if (connection.getMetaData().getDriverName().contains("MySQL")) {
18147+
getRevisionedURLMappingsStatement = connection.prepareStatement(
18148+
SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL);
18149+
}
1814218150
PreparedStatement insertScopeResourceMappingStatement = connection
1814318151
.prepareStatement(SQLConstants.APIRevisionSqlConstants.INSERT_SCOPE_RESOURCE_MAPPING);
1814418152
PreparedStatement insertProductResourceMappingStatement = connection
@@ -18372,6 +18380,10 @@ public void restoreAPIProductRevision(APIRevision apiRevision) throws APIManagem
1837218380
//Insert Scope Mappings and operation policy mappings
1837318381
PreparedStatement getRevisionedURLMappingsStatement = connection
1837418382
.prepareStatement(SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID);
18383+
if (connection.getMetaData().getDriverName().contains("MySQL")) {
18384+
getRevisionedURLMappingsStatement = connection.prepareStatement(
18385+
SQLConstants.APIRevisionSqlConstants.GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL);
18386+
}
1837518387
PreparedStatement addResourceScopeMapping = connection.prepareStatement(
1837618388
SQLConstants.ADD_API_RESOURCE_SCOPE_MAPPING);
1837718389
PreparedStatement addOperationPolicyStatement = connection

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java

+6
Original file line numberDiff line numberDiff line change
@@ -3777,6 +3777,12 @@ public static class APIRevisionSqlConstants {
37773777
public static final String GET_REVISIONED_URL_MAPPINGS_ID = "SELECT URL_MAPPING_ID FROM AM_API_URL_MAPPING " +
37783778
"WHERE API_ID = ? AND REVISION_UUID = ? AND HTTP_METHOD = ? AND AUTH_SCHEME = ? AND URL_PATTERN = ? " +
37793779
"AND THROTTLING_TIER = ? ";
3780+
3781+
public static final String GET_REVISIONED_URL_MAPPINGS_ID_CASE_SENSITIVE_MYSQL = "SELECT URL_MAPPING_ID " +
3782+
"FROM AM_API_URL_MAPPING " + "WHERE API_ID = ? AND REVISION_UUID = ? AND HTTP_METHOD = ? AND " +
3783+
"AUTH_SCHEME = ? AND URL_PATTERN = CONVERT(? USING utf8mb4) COLLATE utf8mb4_bin " +
3784+
"AND THROTTLING_TIER = ? ";
3785+
37803786
public static final String GET_URL_MAPPINGS_ID = "SELECT URL_MAPPING_ID FROM AM_API_URL_MAPPING " +
37813787
"WHERE API_ID = ? AND HTTP_METHOD = ? AND AUTH_SCHEME = ? AND URL_PATTERN = ? " +
37823788
"AND THROTTLING_TIER = ? AND REVISION_UUID = ?";

0 commit comments

Comments
 (0)