This is unnecessary complexity.  Let's ensure that all operations which modify the database are of the form:
db.beginTransaction();
db.performQuery(query);
db.commitTransaction();

for simplicity and maintainability.