Deadlock Detection Using DBI

What is the correct way to detect deadlock using Perl DBI?

Should I use eval { } ? What exception can be caught?

+4
source share
1 answer

The answer will depend on the DBMS.

Some DBMSs cannot detect a deadlock at all; you will have to impose some kind of timeout on the database operation, and it is not clear which state DBI and corresponding DBD will be included if the timeout is triggered.

Some DBMSs will detect a deadlock and report an error, in which case you will handle the error more or less like any other error, but the special handling of the error code for the "deadlock error" depends on the specific DBMS used.

I am not sure if there are other important options.

+2
source

Source: https://habr.com/ru/post/1439633/


All Articles