Exemplo n.º 1
0
 <T> void deleteByPaymentGroup(Dao<T, Long> dao, PaymentGroup group) {
   DeleteBuilder<T, Long> builder = dao.deleteBuilder();
   try {
     builder.where().eq("paymentGroup_id", group.id);
     dao.delete(builder.prepare());
   } catch (SQLException e) {
     Logger.e(e);
   }
 }
 public void clearLocal(Dao<NoiseEntry, Long> noiseDao, Dao<CommentEntry, Long> commDao) {
   this.is_local = false;
   this.my_capacity = 0.0;
   this.my_crowd = 0.0;
   this.my_productivity = 0.0;
   this.my_n_surveys = 0;
   try {
     // delete local noise data
     DeleteBuilder<NoiseEntry, Long> deletion = noiseDao.deleteBuilder();
     deletion.where().eq(NoiseEntry.COLUMN_NAME_IS_LOCAL, Boolean.TRUE);
     noiseDao.delete(deletion.prepare());
     // delete local comment data
     DeleteBuilder<CommentEntry, Long> deletion2 = commDao.deleteBuilder();
     deletion2.where().eq(CommentEntry.COLUMN_NAME_IS_LOCAL, Boolean.TRUE);
     commDao.delete(deletion2.prepare());
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
 public void deleteNoteLite(int memberid) {
   try {
     Dao<NoteLite, Integer> dao = getNoteLiteDataDao();
     DeleteBuilder<NoteLite, Integer> deleteBuilder = dao.deleteBuilder();
     deleteBuilder.where().eq(Constants.memberNotes_UserId, memberid);
     deleteBuilder.delete();
   } catch (SQLException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 4
0
  @Override
  public int delete(int id) {
    final String methodName = "delete";
    Log.i(TAG, "START: " + methodName);
    long time = System.currentTimeMillis();

    int rows = 0;
    try {
      DeleteBuilder<Route, Integer> db = routetDao.deleteBuilder();
      db.where().eq("id", id);
      rows = routetDao.delete(db.prepare());
    } catch (SQLException e) {
      Log.e(TAG, methodName + " - blad przy usuwaniu trasy. " + e.getMessage());
      e.printStackTrace();
    }

    Log.i(TAG, "END: " + methodName + " TIME: " + (System.currentTimeMillis() - time));
    return rows;
  }
  private void deleteCatagory() {

    final Dao<CatagoryModel, Integer> catagoryDoa;

    try {
      catagoryDoa = getHelper().getCatagoryDao();

      DeleteBuilder<CatagoryModel, Integer> deleteBuilder = catagoryDoa.deleteBuilder();
      deleteBuilder
          .where()
          .eq("categoryId", Integer.valueOf(catagoryModel.getCategoryId()))
          .and()
          .eq("catagoryName", catagoryModel.getCatagoryName());
      deleteBuilder.delete();

      Snackbar snackbar =
          Snackbar.make(view, "Catagory deleted sucessfully!!", Snackbar.LENGTH_LONG);
      snackbar.show();

    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
 @Override
 public void tearDown() throws Exception {
   DeleteBuilder<Card, Long> deleteBuilder = cardDao.deleteBuilder();
   deleteBuilder.where().like(Card.Column.TAGS, "test");
   deleteBuilder.delete();
 }