improced commit-rollback behaviour on multi-step transactions
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -67,9 +67,16 @@ public class SqliteDb extends BaseDb implements ContactDb{
|
||||
db.setAutoCommit(false);
|
||||
Query.delete().from(TABLE_CONTACTS).where(ID,equal(contact.id())).execute(db);
|
||||
Query.delete().from(TABLE_CONTACTS_USERS).where(CONTACT_ID,equal(contact.id())).execute(db);
|
||||
db.setAutoCommit(true);
|
||||
} catch (SQLException e){
|
||||
try {
|
||||
db.rollback();
|
||||
} catch (SQLException ignored){};
|
||||
throw failedToDropObject(t(CONTACT_WITH_ID, ID,contact.id())).causedBy(e);
|
||||
} finally {
|
||||
try {
|
||||
db.setAutoCommit(true);
|
||||
} catch (SQLException ignored){};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user