コード例 #1
0
 public void updateKid(Kid kid) {
   // Lock it!
   mLock.lock();
   try {
     startTransaction();
     kidsTable.updateEntry(localDatabase, kid, kid.getId(), kidsTable.getMapper());
   } catch (DBException e) {
     Logger.error(this, "Problems starting transaction");
   } finally {
     endTransaction();
     mLock.unlock();
   }
 }
コード例 #2
0
 /**
  * Delete Kid
  *
  * @param kid
  */
 public void deleteKid(Kid kid) {
   // Lock it!
   mLock.lock();
   try {
     startTransaction();
     int deleted =
         kidsTable.deleteEntryWhere(
             localDatabase, KidsTable.KID_ID, String.valueOf(kid.getKidId()));
     Logger.debug("Deleted " + deleted + " kids ");
   } catch (DBException e) {
     Logger.error(this, "Problems starting transaction");
   } finally {
     endTransaction();
     mLock.unlock();
   }
 }
コード例 #3
0
 /**
  * Add a new Kid
  *
  * @param kid
  * @return Kid
  */
 public Kid addKid(final Kid kid) {
   // Lock it!
   mLock.lock();
   try {
     startTransaction();
     long id = kidsTable.insertEntry(localDatabase, kid, kidsTable.getMapper());
     kid.setId(id);
     return kid;
   } catch (DBException e) {
     Logger.error(this, "Problems starting transaction");
   } finally {
     endTransaction();
     mLock.unlock();
   }
   return null;
 }