本文整理匯總了Java中com.j256.ormlite.stmt.DeleteBuilder.setWhere方法的典型用法代碼示例。如果您正苦於以下問題:Java DeleteBuilder.setWhere方法的具體用法?Java DeleteBuilder.setWhere怎麽用?Java DeleteBuilder.setWhere使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.j256.ormlite.stmt.DeleteBuilder
的用法示例。
在下文中一共展示了DeleteBuilder.setWhere方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: log
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
protected void log(String logName, int priority, String message) {
if (BuildConfig.DEBUG) {
android.util.Log.println(priority, LOG_NAME, message);
}
try {
// Store this log message to the database
errorLogDao.create(new ErrorLogEntry(priority, logName, message));
// Truncate the error log
DeleteBuilder<ErrorLogEntry, Integer> db = errorLogDao.deleteBuilder();
db.setWhere(db.where().le(ErrorLogEntry.DATEANDTIME, new Date(new Date().getTime() - MAX_LOG_AGE)));
errorLogDao.delete(db.prepare());
} catch (Exception e) {
android.util.Log.e(LOG_NAME, "Cannot write log message to database: " + e.toString());
}
}
示例2: removeByMed
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public void removeByMed(Medicine med) {
try {
DeleteBuilder<PickupInfo, Long> qb = dao.deleteBuilder();
qb.setWhere(qb.where().eq(PickupInfo.COLUMN_MEDICINE, med));
qb.delete();
} catch (SQLException e) {
throw new RuntimeException("Error deleting pickups by medicine", e);
}
}
示例3: removeAllFrom
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public void removeAllFrom(final ScheduleItem scheduleItem) {
final DeleteBuilder<DailyScheduleItem, Long> db = dao.deleteBuilder();
try {
db.setWhere(db.where().eq(DailyScheduleItem.COLUMN_SCHEDULE_ITEM, scheduleItem));
db.delete();
} catch (SQLException e) {
throw new RuntimeException("Error deleting items", e);
}
}
示例4: removeOlderThan
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public int removeOlderThan(LocalDate date) {
try {
DeleteBuilder<DailyScheduleItem, Long> qb = dao.deleteBuilder();
qb.setWhere(qb.where().lt(DailyScheduleItem.COLUMN_DATE, date));
return qb.delete();
} catch (SQLException e) {
throw new RuntimeException("Error finding model", e);
}
}
示例5: removeBeyond
import com.j256.ormlite.stmt.DeleteBuilder; //導入方法依賴的package包/類
public int removeBeyond(LocalDate date) {
try {
DeleteBuilder<DailyScheduleItem, Long> qb = dao.deleteBuilder();
qb.setWhere(qb.where().gt(DailyScheduleItem.COLUMN_DATE, date));
return qb.delete();
} catch (SQLException e) {
throw new RuntimeException("Error finding model", e);
}
}