示例#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 int deleteMarkRead() {
   try {
     DeleteBuilder<ArticleSyncAction, Integer> deleteBuilder = deleteBuilder();
     deleteBuilder.where().eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkRead);
     return deleteBuilder.delete();
   } catch (SQLException e) {
     throw new RuntimeException(e);
   }
 }
 public void deleteByDataset(final int dataset) {
   try {
     DeleteBuilder<Data, Integer> deleteBuilder = getDataDao().deleteBuilder();
     Where<Data, Integer> where = deleteBuilder.where();
     where.eq("dataset_id", dataset);
     deleteBuilder.delete();
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#4
0
 @Override
 public void deleteBySensorRefId(int sensorRefId) {
   try {
     DeleteBuilder<Alarm, Integer> deleteBuilder = this.getDao().deleteBuilder();
     deleteBuilder.where().eq(Alarm.SENSOR_REF_ID, sensorRefId);
     int count = deleteBuilder.delete();
     _logger.debug("deleted alarms with sensorRefId:[{}], Deletion Count:{}", sensorRefId, count);
   } catch (SQLException ex) {
     _logger.error("unable to delete alarms with sensorRefId:[{}]", sensorRefId, ex);
   }
 }
 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();
   }
 }
  public void delectedDataFromTable(String[] datetime) {
    StaticReference.userMf.deleteBuilder(ViewModuleRecord.class).where();

    DeleteBuilder<ViewModuleRecord, Long> viewDeleteBuilder =
        StaticReference.userMf.deleteBuilder(ViewModuleRecord.class);
    try {
      viewDeleteBuilder.where().in("datetimes", datetime);
      viewDeleteBuilder.delete();
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
示例#7
0
  public static int delete(
      DatabaseHelper databaseHelper, String columnvalue, String originalvalue) {
    RuntimeExceptionDao<system_messageVo, Integer> system_messageDao =
        databaseHelper.getSystem_messageDao();
    DeleteBuilder<system_messageVo, Integer> deleteBuilder = system_messageDao.deleteBuilder();
    try {
      // 判斷式 哪一欄 = 值
      deleteBuilder.where().eq(columnvalue, originalvalue);

      return deleteBuilder.delete();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return 0;
  }
  public void delete(final Dataset dataset, final Field field, final String data) {
    try {
      DeleteBuilder<Data, Integer> deleteBuilder = getDataDao().deleteBuilder();
      Where<Data, Integer> where = deleteBuilder.where();
      where.eq("dataset_id", dataset);
      where.and();
      where.eq("field_id", field);
      where.and();
      where.eq("data", data);
      deleteBuilder.delete();

    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
 @SuppressWarnings("unchecked")
 public int deleteMarkStarredAndUnStarred(Article article) {
   try {
     DeleteBuilder<ArticleSyncAction, Integer> deleteBuilder = deleteBuilder();
     Where<ArticleSyncAction, Integer> where = deleteBuilder.where();
     where.and(
         where.eq(COLUMN_ARTICLEID, article.getId()),
         where
             .eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkStarred)
             .or()
             .eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkUnstarred));
     return deleteBuilder.delete();
   } catch (SQLException e) {
     throw new RuntimeException(e);
   }
 }
示例#10
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();
    }
  }
 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();
   }
 }
 @Override
 public void tearDown() throws Exception {
   DeleteBuilder<Card, Long> deleteBuilder = cardDao.deleteBuilder();
   deleteBuilder.where().like(Card.Column.TAGS, "test");
   deleteBuilder.delete();
 }