613-518-1166 info@zimdatabases.com

ZIM Development Center (DC) for Zim 7


< All Topics


Handle deadlock situations after database operations.


pDeadLockHandler ( inout vlStatus,
                   inout vlRetryCount )



A return value of either “ERROR” or blank.


The current retry count on entry; can be updated by pDeadLockHandler


The pDeadLockHandler provides a specific method of dealing with deadlock conditions during database operations. It would normally be called within an ON DEADLOCK construct. It enables transactions to be retried a specified number of times before an error message is produced.

The variable vMaxRetries (defined in $DeployServices) is assumed to contain the maximum number of times the applications wishes to retry a transaction that has deadlocked. It must be set by the application. For each transaction, the application should maintain a local variable that holds the current retry count, initially zero. When a deadlock is detected during a database operation such as ADD or CHANGE, pDeadLockHandler can be called. If the current retry count is less than the maximum permitted, the retry count is incremented and vlStatus is set to blank. The application then retries the application. If the retry count reaches or exceeds vMaxRetries, the user is asked if they wish to retry the transaction anyway. If they agree, vlStatus is set to blank. Otherwise, vlStatus is set to “ERROR”. The application should check for this return value and abandon the transaction.



Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents