}
} catch (DbException e) {
e = e.addSQL(sql);
SQLException s = e.getSQLException();
database.exceptionThrown(s, sql);
database.checkPowerOff();
if (s.getErrorCode() == ErrorCode.DEADLOCK_1) {
session.rollback();
} else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) {
// there is a serious problem:
// the transaction may be applied partially