Skip to content

Commit

Permalink
Merge pull request #12454 from tharikaGitHub/patch-master-fixes
Browse files Browse the repository at this point in the history
Fix error creating new revision
  • Loading branch information
tharikaGitHub committed May 30, 2024
2 parents bb09c58 + 312e7b1 commit abb91c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ?";
Expand Down

0 comments on commit abb91c3

Please sign in to comment.