Fix conflict issue on authz code and token cleanup
@@ -233,8 +233,18 @@ BEGIN
SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE START ON TABLE IDN_OAUTH2_ACCESS_TOKEN WITH : '+CAST(@batchCount as varchar);
END
+ BEGIN TRANSACTION
+ DELETE IDN_OIDC_REQ_OBJECT_REFERENCE where TOKEN_ID in (select TOKEN_ID from BATCH_IDN_OAUTH2_ACCESS_TOKEN);
DELETE IDN_OAUTH2_ACCESS_TOKEN where TOKEN_ID in (select TOKEN_ID from BATCH_IDN_OAUTH2_ACCESS_TOKEN);
SELECT @deleteCount= @@rowcount;
+ IF @@ERROR <> 0
+ BEGIN
+ ROLLBACK TRANSACTION
+ END
+ ELSE
+ BEGIN
+ COMMIT TRANSACTION
+ END
IF (@enableLog = 1)
BEGIN
@@ -362,8 +372,18 @@ BEGIN
SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE START ON TABLE IDN_OAUTH2_AUTHORIZATION_CODE WITH : '+CAST(@batchCount as varchar);
END
+ BEGIN TRANSACTION
+ DELETE FROM IDN_OIDC_REQ_OBJECT_REFERENCE where CODE_ID in (select CODE_ID from BATCH_IDN_OATH2_AUTHRIZATN_CDE);
DELETE FROM IDN_OAUTH2_AUTHORIZATION_CODE where CODE_ID in (select CODE_ID from BATCH_IDN_OATH2_AUTHRIZATN_CDE);
SELECT @deleteCount= @@rowcount;
+ IF @@ERROR <> 0
+ BEGIN
+ ROLLBACK TRANSACTION
+ END
+ ELSE
+ BEGIN
+ COMMIT TRANSACTION
+ END
IF (@enableLog = 1)
BEGIN
