public void deleteTran(Account acct, String transID) { String[] args = {Integer.toString(acct.ID), transID}; db.beginTransaction(); try { db.delete("trans", "acct_id=? and trans_id=?", args); db.setTransactionSuccessful(); } finally { db.endTransaction(); } }
private void updateTran(Transaction trans) { db.beginTransaction(); try { ContentValues newValue = tranValues(trans); String[] args = {Integer.toString(trans.ID)}; db.update("trans", newValue, "_id=?", args); db.setTransactionSuccessful(); } finally { db.endTransaction(); } }
private void updateAccount(Account acct) { db.beginTransaction(); try { ContentValues newValue = acctValues(acct); String[] args = {Integer.toString(acct.ID)}; db.update("acct", newValue, "_id=?", args); db.setTransactionSuccessful(); } finally { db.endTransaction(); } }
private int addAccount(Account acct) { db.beginTransaction(); int acct_id; try { ContentValues newValue = acctValues(acct); acct_id = (int) db.insertOrThrow("acct", "name", newValue); acct.ID = acct_id; db.setTransactionSuccessful(); } finally { db.endTransaction(); } return acct_id; }
private int addTran(Transaction trans) { db.beginTransaction(); int tran_id; try { ContentValues newValue = tranValues(trans); tran_id = (int) db.insertOrThrow("trans", "acct_id", newValue); trans.ID = tran_id; db.setTransactionSuccessful(); } finally { db.endTransaction(); } return tran_id; }