本文整理匯總了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();
}