We are encountering a slew of issues with one customer, whose system tends towards large transactions featuring a small range of SKU records, where the transaction is encountering a record deadlock, and being rolled back by sql server. These deadlocks are (to my mind) legitimate (in that one transaction is updating SKU A then SKU B, and the other one is trying to do B then A).
According to the documentation
Normally, Uniface sets $status to -10 if a user tries to modify and store a record which has been locked by another user, but because Microsoft SQL Server does not return a status in this situation, Uniface is unable to do this.
Although the userver log file does show a message from sql server about the transaction being killed.
If I can spot that this has happened before the commit, I can execute a rollback and either automatically or manually redo the transaction. (It's a client/server situation, the server encounters the error).
Does anyone have a trick or workaround which would enable Uniface proc to spot this very dangerous effect (my business logic integrity is severely compromised by it (for example) updating a delivery note without removing the stock....)
I have thought that I might be able to query the sql server process id at the beginning of the transaction, and the point of commit, and if they are different, then rollback instead. Would this be right? Would it get a different sql server process id at that point?
If our users can't trust the stock figures from our system, they can't trust the system and won't be our users very long, so it is vital I can come up with something to spot these things as they happen.



