本文整理汇总了Java中com.j256.ormlite.dao.Dao.deleteBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java Dao.deleteBuilder方法的具体用法?Java Dao.deleteBuilder怎么用?Java Dao.deleteBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.dao.Dao
的用法示例。
在下文中一共展示了Dao.deleteBuilder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpgrade
import com.j256.ormlite.dao.Dao; //导入方法依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher version number. This allows you to adjust
* the various data to match the new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
Log.i(TAG, "onUpgrade");
TableUtils.dropTable(connectionSource, SuspectedApp.class, true);
Log.d(TAG, String.format("Dropped suspected app table!"));
Dao<WhiteEntry, Integer> whiteListDao = getWhiteListDao();
DeleteBuilder<WhiteEntry, Integer> deleteBuilder = whiteListDao.deleteBuilder();
deleteBuilder.where().eq("systemEntry", Boolean.TRUE);
int deleted = deleteBuilder.delete();
Log.d(TAG, String.format("Delete %d old system whitelist entries", deleted));
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(TAG, "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例2: clearHistory
import com.j256.ormlite.dao.Dao; //导入方法依赖的package包/类
private void clearHistory() {
try {
Dao<DetectedOverlay, Integer> detectedOverlayDao = DatabaseHelper.getHelper(getActivity()).getDetectedOverlayDao();
DeleteBuilder<DetectedOverlay, Integer> deleteBuilder = detectedOverlayDao.deleteBuilder();
deleteBuilder.where().gt("id", 0);
int deleted = deleteBuilder.delete();
Log.i(getTag(), "Deleted " + deleted + " entries from DetectedOverlay");
} catch (SQLException e) {
Log.e(getTag(), "Failed to deleted entries", e);
}
mAdapter.clear();
}