It's up to the user to set the correct transaction isolation level.
However if the transaction fails, the code will be executed again in a
new transaction. Therefore the code must not have any side effects
besides SQL statements. Also the isolation level should be conserved for
the repeated transaction.
A transaction is considered as failed if a PDOException or an exception
which has a PDOException as any previous exception was raised.
If the code throws any other exception, the transaction is rolled back
and won't be replayed.